-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
7 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2532,13 +2532,17 @@ def last_insert_id(self, cursor, model): | |
schema = '' | ||
if meta.schema: | ||
schema = '%s.' % meta.schema | ||
result = None | ||
if seq: | ||
cursor.execute("SELECT CURRVAL('%s\"%s\"')" % (schema, seq)) | ||
return cursor.fetchone()[0] | ||
result = cursor.fetchone()[0] | ||
elif meta.auto_increment: | ||
cursor.execute("SELECT CURRVAL('%s\"%s_%s_seq\"')" % ( | ||
schema, meta.db_table, meta.primary_key.db_column)) | ||
return cursor.fetchone()[0] | ||
result = cursor.fetchone()[0] | ||
if self.get_autocommit(): | ||
self.get_conn().commit() | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
justinrosenthal
|
||
return result | ||
|
||
def get_indexes_for_table(self, table): | ||
res = self.execute_sql(""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Do you know if there's a side effect of calling
commit()
on a connection that's not in a transaction? In this case, if the primary_key is not a sequence or auto_incrementing, that'll happen.