I some add information about bug...
Dovecot 2.2.19 version on server FreeBSD 10.2 Release. Config quota (dict + mysql) Database create Postfixadmin 2.3.7
Old version Dovecot 2.2.13 use method UPDATE in MySQL base + dict example mysql.log
Connect postfix@localhost on postfix 134 Query SELECT bytes FROM quota2 WHERE username = 'user@mydomain.lan' 135 Query SELECT bytes FROM quota2 WHERE username = 'user@mydomain.lan' 135 Query BEGIN 135 Query UPDATE quota2 SET bytes=bytes+2570,messages=messages+1 WHERE username = 'user@mydomain.lan' 136 Connect postfix@localhost on postfix 136 Query BEGIN 136 Query UPDATE domain SET quota=quota+2570 WHERE domain = 'mydomain.lan' 134 Query BEGIN 134 Query UPDATE quota2 SET bytes=bytes+1723,messages=messages+1 WHERE username = 'user@mydomain.lan' 137 Connect postfix@localhost on postfix 137 Query BEGIN 137 Query UPDATE domain SET quota=quota+1723 WHERE domain = 'mydomain.lan' 136 Query UPDATE quota2 SET messages=messages+1 WHERE username = 'mydomain.lan' - - - 137 Query COMMIT 151004 3:12:27 128 Quit
# cat dovecot-2.2.13/src/lib-dict/dict-sql.c === some text delete ===
static const char * sql_dict_update_query(const struct dict_sql_build_query *build) { struct sql_dict *dict = build->dict; const struct dict_sql_build_query_field *fields; unsigned int i, field_count; string_t *query;
i_assert(build->inc);
fields = array_get(&build->fields, &field_count);
i_assert(field_count > 0);
query = t_str_new(64);
str_printfa(query, "UPDATE %s SET ", fields[0].map->table); #### this
in code, work excellent for (i = 0; i < field_count; i++) { if (i > 0) str_append_c(query, ','); str_printfa(query, "%s=%s", fields[i].map->value_field, fields[i].map->value_field); if (fields[i].value[0] != '-') str_append_c(query, '+'); str_append(query, fields[i].value); }
sql_dict_where_build(dict, fields[0].map, build->extra_values,
build->key1, SQL_DICT_RECURSE_NONE, query);
return str_c(query);
}
=== === ===
Latest version Dovecot 2.2.19 use method DELETE/INSERT in MySQL base + dict
140 Connect postfix@localhost on postfix
140 Query SELECT quota FROM domain WHERE domain =
'mydomain.lan' 140 Query SELECT quota FROM domain WHERE domain = 'mydomain.lan' 140 Query SELECT messages FROM quota2 WHERE username = 'mydomain.lan' 140 Query BEGIN 140 Query DELETE FROM domain WHERE domain = 'mydomain.lan' 140 Query DELETE FROM quota2 WHERE username = 'mydomain.lan' 140 Query INSERT INTO domain (quota,domain) VALUES ('8581','mydomain.lan') ON DUPLICATE KEY UPDATE quota='8581' 151004 15:18:45 140 Quit
# cat dovecot-2.2.19/src/lib-dict/dict-sql.c === some text delete ===
static void sql_dict_unset(struct dict_transaction_context *_ctx, const char *key) { struct sql_dict_transaction_context *ctx = (struct sql_dict_transaction_context *)_ctx; struct sql_dict *dict = (struct sql_dict *)_ctx->dict; const struct dict_sql_map *map; ARRAY_TYPE(const_string) values;
if (ctx->prev_inc_map != NULL)
sql_dict_prev_inc_flush(ctx);
map = sql_dict_find_map(dict, key, &values);
if (map == NULL) {
i_error("sql dict unset: Invalid/unmapped key: %s", key);
ctx->failed = TRUE;
return;
}
T_BEGIN {
string_t *query = t_str_new(256);
const char *error;
str_printfa(query, "DELETE FROM %s", map->table); #### here
deleted all information about domain, this code i think need change if (sql_dict_where_build(dict, map, &values, key[0], SQL_DICT_RECURSE_NONE, query, &error) < 0) { i_error("dict-sql: Failed to delete %s: %s", key, error); ctx->failed = TRUE; } else { sql_update(ctx->sql_ctx, str_c(query)); } } T_END; } === === ===
Now dic + mysql doesn’t work in Dovecot 2.2.19, because first DELETE operator delete information from base about my domain mydomain.lan
Thanks!
Simon.
-- View this message in context: http://dovecot.2317879.n4.nabble.com/More-information-about-Dovecot-2-2-x-qu... Sent from the Dovecot mailing list archive at Nabble.com.