Added strptime function to SQL parser as a feature. This is needed to i.e. be able to query time-fields in DB and to use dates <1.1.1970 and >19.1.2038. All changes should be backwards-compatible to not break existing queries.

This commit is contained in:
leecher1337
2015-08-30 11:23:57 +02:00
parent 5ce4cc5528
commit e2449c11f3
9 changed files with 163 additions and 18 deletions

View File

@@ -42,7 +42,7 @@ static MdbSQL *g_sql;
%token <name> IDENT NAME PATH STRING NUMBER
%token SELECT FROM WHERE CONNECT DISCONNECT TO LIST TABLES AND OR NOT COUNT
%token SELECT FROM WHERE CONNECT DISCONNECT TO LIST TABLES AND OR NOT COUNT STRPTIME
%token DESCRIBE TABLE
%token LTEQ GTEQ LIKE IS NUL
@@ -132,7 +132,12 @@ nulloperator:
;
constant:
NUMBER { $$ = $1; }
STRPTIME '(' constant ',' constant ')' {
$$ = mdb_sql_strptime(_mdb_sql(NULL), $3, $5);
free($3);
free($5);
}
| NUMBER { $$ = $1; }
| STRING { $$ = $1; }
;