implement getlastrowid for sqlite

This commit is contained in:
sqlcoder 2009-08-04 21:48:03 +01:00
parent 61d2a83779
commit dde35fa65b

View File

@ -155,7 +155,7 @@ class fpdb_db:
return (self.host, self.database, self.user, self.password) return (self.host, self.database, self.user, self.password)
#end def get_db_info #end def get_db_info
def getLastInsertId(self): def getLastInsertId(self, cursor=None):
try: try:
if self.backend == self.MYSQL_INNODB: if self.backend == self.MYSQL_INNODB:
ret = self.db.insert_id() ret = self.db.insert_id()
@ -177,9 +177,7 @@ class fpdb_db:
else: else:
ret = row[0] ret = row[0]
elif self.backend == fpdb_db.SQLITE: elif self.backend == fpdb_db.SQLITE:
# don't know how to do this in sqlite ret = cursor.lastrowid
print "getLastInsertId(): not coded for sqlite yet"
ret = -1
else: else:
print "getLastInsertId(): unknown backend ", self.backend print "getLastInsertId(): unknown backend ", self.backend
ret = -1 ret = -1