Skip to content

Commit

Permalink
reverting commit 498b405: db.insert(...) causes cache.flush() again
Browse files Browse the repository at this point in the history
  • Loading branch information
kozlovsky committed Nov 21, 2013
1 parent e44c122 commit e2c221d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pony/orm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,10 @@ def insert(database, table_name, returning=None, **kwargs):
arguments = adapter(kwargs.values()) # order of values same as order of keys
cache = database._get_cache()
if cache.optimistic: cache.flush()
with cache.flush_disabled():
if returning is None:
cursor = database._exec_sql(sql, arguments)
return getattr(cursor, 'lastrowid', None)
new_id = database._exec_sql(sql, arguments, returning_id=True)
return new_id
if returning is not None:
return database._exec_sql(sql, arguments, returning_id=True)
cursor = database._exec_sql(sql, arguments)
return getattr(cursor, 'lastrowid', None)
def _ast2sql(database, sql_ast):
sql, adapter = database.provider.ast2sql(sql_ast)
return sql, adapter
Expand Down

0 comments on commit e2c221d

Please sign in to comment.