From 909758df8edf5e319127216bc2c4ce0fe780de21 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 17 Jun 2007 00:49:08 +0000 Subject: - result.last_inserted_ids() should return a list that is identically sized to the primary key constraint of the table. values that were "passively" created and not available via cursor.lastrowid will be None. - sqlite: string PK column inserts dont get overwritten with OID [ticket:603] --- lib/sqlalchemy/databases/sqlite.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/databases/sqlite.py') diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py index aaaf55697..8e776fb26 100644 --- a/lib/sqlalchemy/databases/sqlite.py +++ b/lib/sqlalchemy/databases/sqlite.py @@ -148,7 +148,9 @@ def descriptor(): class SQLiteExecutionContext(default.DefaultExecutionContext): def post_exec(self): if self.compiled.isinsert: - self._last_inserted_ids = [self.cursor.lastrowid] + if not len(self._last_inserted_ids) or self._last_inserted_ids[0] is None: + self._last_inserted_ids = [self.cursor.lastrowid] + self._last_inserted_ids[1:] + super(SQLiteExecutionContext, self).post_exec() class SQLiteDialect(ansisql.ANSIDialect): -- cgit v1.2.1