Merge "res_config_mysql: Fix broken column type checking" into 13

changes/66/466/1
Joshua Colp 10 years ago committed by Gerrit Code Review
commit 5fcaf727cc

@ -1202,7 +1202,8 @@ 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) {
} 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;
@ -1213,7 +1214,9 @@ static int require_mysql(const char *database, const char *tablename, va_list ap
} else {
res = -1;
}
} else if ((strncmp(column->type, "datetime", 8) == 0 || strncmp(column->type, "timestamp", 9) == 0) && type != RQ_DATETIME) {
}
} 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;
@ -1224,7 +1227,9 @@ static int require_mysql(const char *database, const char *tablename, va_list ap
} else {
res = -1;
}
} else if ((strncmp(column->type, "date", 4) == 0) && type != RQ_DATE) {
}
} 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;
@ -1235,6 +1240,7 @@ static int require_mysql(const char *database, const char *tablename, va_list ap
} else {
res = -1;
}
}
} else { /* Other, possibly unsupported types? */
if (table->database->requirements == RQ_WARN) {
ast_log(LOG_WARNING, "Possibly unsupported column type '%s' on column '%s'\n", column->type, column->name);

Loading…
Cancel
Save