Mercurial > avadmin > converted
changeset 484:0bf665111b2a
Change av_settings.py to use dbid interface
(Logical change 1.144)
author | optonline.net!jeffpc |
---|---|
date | Fri, 02 Jan 2004 02:39:00 +0000 |
parents | 968e80689c04 |
children | 5f7c546c2f33 |
files | av_settings.py |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/av_settings.py Fri Jan 02 02:15:11 2004 +0000 +++ b/av_settings.py Fri Jan 02 02:39:00 2004 +0000 @@ -24,17 +24,21 @@ """ Returns string from the db returns string """ - results = conn.db.execSQL("SELECT `value` FROM `settings` WHERE `name`=\"" + name + "\";") - return results[0][0] # FIXME: very bad + dbid = conn.db.newid() + dbid.execute("SELECT `value` FROM `settings` WHERE `name`=\"" + name + "\";") + value = dbid.fetchone()[0] # FIXME: this should be checked + + return value def setSetting(conn,name,value): """ Sets name to value in DB does not return anything """ + dbid = conn.db.newid() if (getSetting(conn,name)): - conn.db.execSQL("UPDATE `settings` SET `value`=\"" + conn.utils.sqlify(value) + "\" WHERE `name`=\"" + conn.utils.sqlify(name) + "\";") + dbid.execute("UPDATE `settings` SET `value`=\"" + conn.utils.sqlify(value) + "\" WHERE `name`=\"" + conn.utils.sqlify(name) + "\";") else: - conn.db.execSQL("INSERT INTO `settings` (`id`, `name`, `value`) VALUES (NULL, \"" + conn.utils.sqlify(name) + "\", \"" + conn.utils.sqlify(value) + "\");") + dbid.execute("INSERT INTO `settings` (`id`, `name`, `value`) VALUES (NULL, \"" + conn.utils.sqlify(name) + "\", \"" + conn.utils.sqlify(value) + "\");") if __name__ == "__main__": print "ERROR"