diff options
author | Hiroshi Inoue | 2002-04-01 03:01:15 +0000 |
---|---|---|
committer | Hiroshi Inoue | 2002-04-01 03:01:15 +0000 |
commit | 6df395f63a3f4be10b8f5b81dea1b426021ce5ce (patch) | |
tree | c0d27c22957c562ea9805343833f0f46c30fea93 /src/interfaces/odbc/parse.c | |
parent | 87b08080205833fe9ebdb40ac779be0abf900157 (diff) |
1) Add rollback functionality to updatable cursors.
2) Implement some options for SQLGetDescField().
3) Handle *Inifinity* timestamp for SQL_C_CHAR type output.
4) Separate Unicode conversions from common implementations.
5) Improve internal parse_statement() function.
Diffstat (limited to 'src/interfaces/odbc/parse.c')
-rw-r--r-- | src/interfaces/odbc/parse.c | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/src/interfaces/odbc/parse.c b/src/interfaces/odbc/parse.c index 3549ff2ef7a..d86e62f85bb 100644 --- a/src/interfaces/odbc/parse.c +++ b/src/interfaces/odbc/parse.c @@ -304,7 +304,8 @@ parse_statement(StatementClass *stmt) in_on = FALSE, in_from = FALSE, in_where = FALSE, - in_table = FALSE; + in_table = FALSE, + out_table = TRUE; char in_field = FALSE, in_expr = FALSE, in_func = FALSE, @@ -610,12 +611,21 @@ parse_statement(StatementClass *stmt) if (in_from) { - if (!in_table) + if (token[0] == ';') { - if (!token[0]) + in_from = FALSE; + break; + } + switch (token[0]) + { + case '\0': continue; - if (token[0] == ';') - break; + case ',': + out_table = TRUE; + continue; + } + if (out_table && !in_table) /* new table */ + { if (!(stmt->ntab % TAB_INCR)) { @@ -660,22 +670,47 @@ parse_statement(StatementClass *stmt) mylog("got table = '%s'\n", ti[stmt->ntab]->name); if (delim == ',') + { + out_table = TRUE; mylog("more than 1 tables\n"); + } else + { + out_table = FALSE; in_table = TRUE; + } stmt->ntab++; continue; } - if (token[0] == ';') - break; - if (stricmp(token, "as")) + if (!dquote && stricmp(token, "JOIN") == 0) + { + in_table = FALSE; + out_table = TRUE; + continue; + } + if (in_table && stricmp(token, "as")) { + if (!dquote) + { + if (stricmp(token, "LEFT") == 0 || + stricmp(token, "RIGHT") == 0 || + stricmp(token, "OUTER") == 0 || + stricmp(token, "FULL") == 0 || + stricmp(token, "ON") == 0) + { + in_table = FALSE; + continue; + } + } strcpy(ti[stmt->ntab - 1]->alias, token); mylog("alias for table '%s' is '%s'\n", ti[stmt->ntab - 1]->name, ti[stmt->ntab - 1]->alias); in_table = FALSE; if (delim == ',') + { + out_table = TRUE; mylog("more than 1 tables\n"); + } } } /* in_from */ } |