[dovecot-cvs] dovecot/src/lib-dict dict-sql.c,1.13,1.14

cras at dovecot.org cras at dovecot.org
Mon Aug 28 19:54:57 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-dict
In directory talvi:/tmp/cvs-serv3142

Modified Files:
	dict-sql.c 
Log Message:
Fixes. select/where fields were used in wrong order



Index: dict-sql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-dict/dict-sql.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- dict-sql.c	30 Jul 2006 19:27:26 -0000	1.13
+++ dict-sql.c	28 Aug 2006 16:54:55 -0000	1.14
@@ -332,8 +332,8 @@
 			"ON DUPLICATE KEY UPDATE %s = '%s'",
 			dict->table, dict->select_field, dict->where_field,
 			dict->username_field,
-			sql_escape_string(dict->db, key),
 			sql_escape_string(dict->db, value),
+			sql_escape_string(dict->db, key),
 			sql_escape_string(dict->db, dict->username),
 			dict->select_field,
 			sql_escape_string(dict->db, value));
@@ -342,8 +342,8 @@
 			"INSERT INTO %s (%s, %s) VALUES ('%s', '%s') "
 			"ON DUPLICATE KEY UPDATE %s = '%s'",
 			dict->table, dict->select_field, dict->where_field,
-			sql_escape_string(dict->db, key),
 			sql_escape_string(dict->db, value),
+			sql_escape_string(dict->db, key),
                         dict->select_field,
 			sql_escape_string(dict->db, value));
 	}
@@ -402,11 +402,11 @@
 	t_push();
 	if (priv) {
 		query = t_strdup_printf(
-			"INSERT INTO %s (%s, %s, %s) VALUES ('%s', %lld, '%s') "
+			"INSERT INTO %s (%s, %s, %s) VALUES (%lld, '%s', '%s') "
 			"ON DUPLICATE KEY UPDATE %s = %s + %lld",
 			dict->table, dict->select_field, dict->where_field,
 			dict->username_field,
-                        sql_escape_string(dict->db, key), diff,
+                        diff, sql_escape_string(dict->db, key),
 			sql_escape_string(dict->db, dict->username),
                         dict->select_field, dict->select_field, diff);
 	} else {
@@ -414,7 +414,7 @@
 			"INSERT INTO %s (%s, %s) VALUES (%s, %lld) "
 			"ON DUPLICATE KEY UPDATE %s = %s + %lld",
 			dict->table, dict->select_field, dict->where_field,
-                        sql_escape_string(dict->db, key), diff,
+                        diff, sql_escape_string(dict->db, key),
                         dict->select_field, dict->select_field, diff);
 	}
 	sql_update(ctx->sql_ctx, query);



More information about the dovecot-cvs mailing list