[dovecot-cvs] dovecot/src/lib-dict dict-sql.c,1.8.2.1,1.8.2.2
cras at dovecot.org
cras at dovecot.org
Fri Jun 16 11:47:49 EEST 2006
Update of /var/lib/cvs/dovecot/src/lib-dict
In directory talvi:/tmp/cvs-serv5857
Modified Files:
Tag: branch_1_0
dict-sql.c
Log Message:
Fixes to SQL update statements
Index: dict-sql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-dict/dict-sql.c,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -u -d -r1.8.2.1 -r1.8.2.2
--- dict-sql.c 14 Jun 2006 11:16:11 -0000 1.8.2.1
+++ dict-sql.c 16 Jun 2006 08:47:47 -0000 1.8.2.2
@@ -306,23 +306,23 @@
t_push();
if (priv) {
query = t_strdup_printf(
- "INSERT INTO %s (%s, %s, %s) VALUES (%s, %s, %s) "
+ "INSERT INTO %s (%s, %s, %s) VALUES ('%s', '%s', '%s') "
"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, dict->username),
- sql_escape_string(dict->db, key),
+ dict->select_field,
sql_escape_string(dict->db, value));
} else {
query = t_strdup_printf(
- "INSERT INTO %s (%s, %s) VALUES (%s, %s) "
+ "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));
}
sql_update(ctx->sql_ctx, query);
@@ -344,22 +344,20 @@
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 ('%s', %lld, '%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,
sql_escape_string(dict->db, dict->username),
- sql_escape_string(dict->db, key),
- sql_escape_string(dict->db, key), diff);
+ dict->select_field, dict->select_field, diff);
} else {
query = t_strdup_printf(
"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,
- sql_escape_string(dict->db, key),
- sql_escape_string(dict->db, key), diff);
+ dict->select_field, dict->select_field, diff);
}
sql_update(ctx->sql_ctx, query);
t_pop();
More information about the dovecot-cvs
mailing list