[mw-devel] MW3 r1096 - trunk/src

arthur at sucs.org arthur at sucs.org
Wed Oct 28 14:55:59 GMT 2009


Author: arthur
Date: 2009-10-28 14:55:59 +0000 (Wed, 28 Oct 2009)
New Revision: 1096

Modified:
   trunk/src/sqlite.c
Log:
delete entries when set to an empty value


Modified: trunk/src/sqlite.c
===================================================================
--- trunk/src/sqlite.c	2009-10-28 14:32:33 UTC (rev 1095)
+++ trunk/src/sqlite.c	2009-10-28 14:55:59 UTC (rev 1096)
@@ -317,6 +317,11 @@
 
 	/* set a new value */
 	struct db_result *res;
+	if (arg==NULL || *arg==0) {
+		char *query = sqlite3_mprintf("DELETE FROM %q WHERE user=%Q AND opt=%Q", table, user, opt);
+		db_free(db_query(path, query, 1));
+		sqlite3_free(query);
+	}else
 	if (old != NULL) {
 		char *query = sqlite3_mprintf("UPDATE %q SET arg=%Q WHERE user=%Q AND opt=%Q", table, arg, user, opt);
 		db_free(db_query(path, query, 1));




More information about the mw-devel mailing list