X-Git-Url: http://git.plutz.net/?p=tabnote;a=blobdiff_plain;f=tabnote;fp=tabnote;h=897685814f6ef5c98eee948e99b53bbddf55c04d;hp=79295deab0a21e60c75a149ed5274ef3b2f6bfbd;hb=67131696c2baeeace589fef820b30f1144979eb5;hpb=6507e315fdfcd3c90a1420578f025b83dbc13337 diff --git a/tabnote b/tabnote index 79295de..8976858 100755 --- a/tabnote +++ b/tabnote @@ -81,7 +81,7 @@ class Persistence(): for c in string: if c == '"': ret += '""' else: ret += c - return ret + return str(ret) def allRecords(self): """ @@ -101,7 +101,7 @@ class Persistence(): if content: content = self.escape(content) else: content = '' self.dbcur.execute('INSERT INTO notes (uuid, label, content, revision, lastsync) VALUES ' + - '(lower(hex(randomblob(16))), "' + label + '", "' + content + + '(lower(hex(randomblob(16))), "' + str(label) + '", "' + str(content) + '", datetime(\'now\'), datetime(\'1970-01-01\'));') else: if content: @@ -111,7 +111,11 @@ class Persistence(): if label: self.dbcur.execute('UPDATE notes SET label = "' + self.escape(label) + '", revision = datetime(\'now\') WHERE uuid = "' + str(uuid) + '";') - return self.dbcur.lastrowid + + try: + self.dbcur.execute('SELECT uuid FROM notes WHERE seq = "' + str(self.dbcur.lastrowid) + '";') + return self.dbcur.fetchall()[0][0] + except: return 0 def delRecord(self, uuid): """