Commit c0a37670 authored by Benoît Minisini's avatar Benoît Minisini

Take newlines, tabs, and backticks into account when analyzing a table schema.

[GB.DB.SQLITE3]
* BUG: Take newlines, tabs, and backticks into account when analyzing a table schema.
parent 52b4f743
......@@ -1835,7 +1835,11 @@ static int field_info(DB_DATABASE *db, const char *table, const char *field, DB_
char *p, *p2;
char *field_desc;
int len;
char quote;
fprintf(stderr, "field = %s / schema = %s\n", _fieldName, schema);
len = strlen(_fieldName);
p = strchr(schema, '(');
if (p)
{
......@@ -1846,13 +1850,14 @@ static int field_info(DB_DATABASE *db, const char *table, const char *field, DB_
if (!p2)
p2 = p + strlen(p) - 1;
while (p < p2 && *p == ' ')
while (p < p2 && (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r'))
p++;
if (*p == '\'' || *p == '"')
p++;
if (*p == '\'' || *p == '"' || *p == '`')
quote = *p++;
else
quote = 0;
len = strlen(_fieldName);
if ((p2 - p) < len || strncasecmp(p, _fieldName, len))
{
p = p2;
......@@ -1860,7 +1865,7 @@ static int field_info(DB_DATABASE *db, const char *table, const char *field, DB_
}
p += len;
if (*p == '\'')
if (*p == quote)
p++;
len = p2 - p;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment