Skip to content

Commit

Permalink
dict-sql: Change "uint" type to mean 64bit instead of 32bit integer.
Browse files Browse the repository at this point in the history
This is likely what is usually wanted (especially in e.g. quotas).
If someone actually wants it to be restricted to 32bit, we could add
uint32 later on.
  • Loading branch information
sirainen authored and cmouse committed Sep 8, 2017
1 parent 9f0fc74 commit 1a672c1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib-dict/dict-sql.c
Expand Up @@ -219,21 +219,21 @@ sql_dict_value_escape(string_t *str, struct sql_dict *dict,
const char **error_r)
{
buffer_t *buf;
unsigned int num;
uint64_t num;

switch (value_type) {
case DICT_SQL_TYPE_STRING:
str_printfa(str, "'%s%s'", sql_escape_string(dict->db, value),
value_suffix);
return 0;
case DICT_SQL_TYPE_UINT:
if (value_suffix[0] != '\0' || str_to_uint(value, &num) < 0) {
if (value_suffix[0] != '\0' || str_to_uint64(value, &num) < 0) {
*error_r = t_strdup_printf(
"%s field's value isn't unsigned integer: %s%s (in pattern: %s)",
"%s field's value isn't 64bit unsigned integer: %s%s (in pattern: %s)",
field_name, value, value_suffix, map->pattern);
return -1;
}
str_printfa(str, "%u", num);
str_printfa(str, "%"PRIu64, num);
return 0;
case DICT_SQL_TYPE_HEXBLOB:
break;
Expand Down

0 comments on commit 1a672c1

Please sign in to comment.