From 67131696c2baeeace589fef820b30f1144979eb5 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 12 Jan 2011 01:43:18 +0000 Subject: [PATCH] Bugfix: dataloss because of wrong return value in setRecord, fixed! svn path=/trunk/; revision=5 --- tabnote | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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): """ -- 2.39.2