Skip to content

Commit 804527c

Browse files
committed
sqlite3: Implement cursor.lastrowid .
1 parent b2aa759 commit 804527c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sqlite3/sqlite3.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
# using "d" return type gives wrong results
2727
sqlite3_column_double = sq3.func("f", "sqlite3_column_double", "pi")
2828
sqlite3_column_text = sq3.func("s", "sqlite3_column_text", "pi")
29+
#sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
30+
# TODO: should return long int
31+
sqlite3_last_insert_rowid = sq3.func("i", "sqlite3_last_insert_rowid", "p")
2932
#const char *sqlite3_errmsg(sqlite3*);
3033
sqlite3_errmsg = sq3.func("s", "sqlite3_errmsg", "p")
3134

@@ -93,6 +96,7 @@ def execute(self, sql, params=None):
9396
if not self.num_cols:
9497
v = self.fetchone()
9598
assert v is None
99+
self.lastrowid = sqlite3_last_insert_rowid(self.h)
96100

97101
def close(self):
98102
s = sqlite3_finalize(self.stmnt)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy