From dde35fa65b286f3004ffa99b9bd2c0293b070ff0 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Tue, 4 Aug 2009 21:48:03 +0100 Subject: [PATCH] implement getlastrowid for sqlite --- pyfpdb/fpdb_db.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py index e9c17bd9..f0e0de12 100644 --- a/pyfpdb/fpdb_db.py +++ b/pyfpdb/fpdb_db.py @@ -155,7 +155,7 @@ class fpdb_db: return (self.host, self.database, self.user, self.password) #end def get_db_info - def getLastInsertId(self): + def getLastInsertId(self, cursor=None): try: if self.backend == self.MYSQL_INNODB: ret = self.db.insert_id() @@ -177,9 +177,7 @@ class fpdb_db: else: ret = row[0] elif self.backend == fpdb_db.SQLITE: - # don't know how to do this in sqlite - print "getLastInsertId(): not coded for sqlite yet" - ret = -1 + ret = cursor.lastrowid else: print "getLastInsertId(): unknown backend ", self.backend ret = -1