X-Git-Url: http://git.asterisk.org/gitweb/?p=asterisk%2Fasterisk.git;a=blobdiff_plain;f=addons%2Fres_config_mysql.c;h=a805cb4b4d7b960a97ca2eb614904b10eb67be0c;hp=f44b9d5aeeafadea5489b265eba562a1ead10b73;hb=35ff01823be247c69a6f129955cbdbdc17e5fa7f;hpb=eec010829a3e2bd2901cb983f679ee89ac85bf2d diff --git a/addons/res_config_mysql.c b/addons/res_config_mysql.c index f44b9d5..a805cb4 100644 --- a/addons/res_config_mysql.c +++ b/addons/res_config_mysql.c @@ -1202,38 +1202,44 @@ static int require_mysql(const char *database, const char *tablename, va_list ap PICK_WHICH_ALTER_ACTION(bigint) } } - } else if (strncmp(column->type, "float", 5) == 0 && !ast_rq_is_int(type) && type != RQ_FLOAT) { - if (table->database->requirements == RQ_WARN) { - ast_log(LOG_WARNING, "Realtime table %s@%s: Column %s cannot be a %s\n", tablename, database, column->name, column->type); - res = -1; - } else if (table->database->requirements == RQ_CREATECLOSE && modify_mysql(database, tablename, column, type, size) == 0) { - table_altered = 1; - } else if (table->database->requirements == RQ_CREATECHAR && modify_mysql(database, tablename, column, RQ_CHAR, size) == 0) { - table_altered = 1; - } else { - res = -1; + } else if (strncmp(column->type, "float", 5) == 0) { + if (!ast_rq_is_int(type) && type != RQ_FLOAT) { + if (table->database->requirements == RQ_WARN) { + ast_log(LOG_WARNING, "Realtime table %s@%s: Column %s cannot be a %s\n", tablename, database, column->name, column->type); + res = -1; + } else if (table->database->requirements == RQ_CREATECLOSE && modify_mysql(database, tablename, column, type, size) == 0) { + table_altered = 1; + } else if (table->database->requirements == RQ_CREATECHAR && modify_mysql(database, tablename, column, RQ_CHAR, size) == 0) { + table_altered = 1; + } else { + res = -1; + } } - } else if ((strncmp(column->type, "datetime", 8) == 0 || strncmp(column->type, "timestamp", 9) == 0) && type != RQ_DATETIME) { - if (table->database->requirements == RQ_WARN) { - ast_log(LOG_WARNING, "Realtime table %s@%s: Column %s cannot be a %s\n", tablename, database, column->name, column->type); - res = -1; - } else if (table->database->requirements == RQ_CREATECLOSE && modify_mysql(database, tablename, column, type, size) == 0) { - table_altered = 1; - } else if (table->database->requirements == RQ_CREATECHAR && modify_mysql(database, tablename, column, RQ_CHAR, size) == 0) { - table_altered = 1; - } else { - res = -1; + } else if (strncmp(column->type, "datetime", 8) == 0 || strncmp(column->type, "timestamp", 9) == 0) { + if (type != RQ_DATETIME) { + if (table->database->requirements == RQ_WARN) { + ast_log(LOG_WARNING, "Realtime table %s@%s: Column %s cannot be a %s\n", tablename, database, column->name, column->type); + res = -1; + } else if (table->database->requirements == RQ_CREATECLOSE && modify_mysql(database, tablename, column, type, size) == 0) { + table_altered = 1; + } else if (table->database->requirements == RQ_CREATECHAR && modify_mysql(database, tablename, column, RQ_CHAR, size) == 0) { + table_altered = 1; + } else { + res = -1; + } } - } else if ((strncmp(column->type, "date", 4) == 0) && type != RQ_DATE) { - if (table->database->requirements == RQ_WARN) { - ast_log(LOG_WARNING, "Realtime table %s@%s: Column %s cannot be a %s\n", tablename, database, column->name, column->type); - res = -1; - } else if (table->database->requirements == RQ_CREATECLOSE && modify_mysql(database, tablename, column, type, size) == 0) { - table_altered = 1; - } else if (table->database->requirements == RQ_CREATECHAR && modify_mysql(database, tablename, column, RQ_CHAR, size) == 0) { - table_altered = 1; - } else { - res = -1; + } else if (strncmp(column->type, "date", 4) == 0) { + if (type != RQ_DATE) { + if (table->database->requirements == RQ_WARN) { + ast_log(LOG_WARNING, "Realtime table %s@%s: Column %s cannot be a %s\n", tablename, database, column->name, column->type); + res = -1; + } else if (table->database->requirements == RQ_CREATECLOSE && modify_mysql(database, tablename, column, type, size) == 0) { + table_altered = 1; + } else if (table->database->requirements == RQ_CREATECHAR && modify_mysql(database, tablename, column, RQ_CHAR, size) == 0) { + table_altered = 1; + } else { + res = -1; + } } } else { /* Other, possibly unsupported types? */ if (table->database->requirements == RQ_WARN) {