[dovecot-cvs] dovecot/src/lib-dict dict-sql.c,1.8.2.2,1.8.2.3

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


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

Modified Files:
      Tag: branch_1_0
	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.8.2.2
retrieving revision 1.8.2.3
diff -u -d -r1.8.2.2 -r1.8.2.3
--- dict-sql.c	16 Jun 2006 08:47:47 -0000	1.8.2.2
+++ dict-sql.c	28 Aug 2006 16:54:54 -0000	1.8.2.3
@@ -310,8 +310,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));
@@ -320,8 +320,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));
 	}
@@ -344,11 +344,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 {
@@ -356,7 +356,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