mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-07-16 00:36:43 +08:00
Add SQL quote escaping, Documentation fix
This commit is contained in:
parent
e33c909174
commit
2e5179fb63
@ -1,3 +1,7 @@
|
|||||||
|
Thu Aug 26 21:06:35 CDT 2004 Jeff Smith <whydoubt@yahoo.com>
|
||||||
|
* src/libmdb/write.c: Documentation fix
|
||||||
|
* src/sql/lexer.l: Add SQL quote escaping
|
||||||
|
|
||||||
Tue Aug 24 21:04:17 CDT 2004 Jeff Smith <whydoubt@yahoo.com>
|
Tue Aug 24 21:04:17 CDT 2004 Jeff Smith <whydoubt@yahoo.com>
|
||||||
* include/mdbsql.h:
|
* include/mdbsql.h:
|
||||||
* src/sql/mdbsql.c: Tidy up a few SQL-related functions
|
* src/sql/mdbsql.c: Tidy up a few SQL-related functions
|
||||||
|
@ -329,7 +329,7 @@ mdb_crack_row3(MdbTableDef *table, int row_start, int row_end, MdbField *fields)
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* mdb_crack_row:
|
* mdb_crack_row:
|
||||||
* @mdb: Database handle
|
* @table: Table that the row belongs to
|
||||||
* @row_start: offset to start of row on current page
|
* @row_start: offset to start of row on current page
|
||||||
* @row_end: offset to end of row on current page
|
* @row_end: offset to end of row on current page
|
||||||
* @fields: pointer to MdbField array to be popluated by mdb_crack_row
|
* @fields: pointer to MdbField array to be popluated by mdb_crack_row
|
||||||
|
@ -43,14 +43,37 @@ null { return NUL; }
|
|||||||
(>=) { return GTEQ; }
|
(>=) { return GTEQ; }
|
||||||
like { return LIKE; }
|
like { return LIKE; }
|
||||||
[ \t\r] ;
|
[ \t\r] ;
|
||||||
\"[A-z][A-z0-9 _#@]*\" {
|
|
||||||
yylval.name = strdup(&yytext[1]);
|
\"[^"]*\"\" {
|
||||||
yylval.name[strlen(yylval.name)-1]='\0';
|
yyless(yyleng-1);
|
||||||
return IDENT;
|
yymore();
|
||||||
|
}
|
||||||
|
\"[^"]*\" {
|
||||||
|
int ip, op, ilen;
|
||||||
|
ilen = strlen(yytext);
|
||||||
|
yylval.name = malloc(ilen-1);
|
||||||
|
for (ip=1, op=0; ip<ilen-1; ip++, op++) {
|
||||||
|
if (yytext[ip] != '"') {
|
||||||
|
yylval.name[op] = yytext[ip];
|
||||||
|
} else if (yytext[ip+1] == '"') {
|
||||||
|
yylval.name[op] = yytext[ip++];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
yylval.name[op]='\0';
|
||||||
|
return IDENT;
|
||||||
|
}
|
||||||
|
|
||||||
[A-z][A-z0-9_#@]* { yylval.name = strdup(yytext); return NAME; }
|
[A-z][A-z0-9_#@]* { yylval.name = strdup(yytext); return NAME; }
|
||||||
|
|
||||||
'[A-z0-9 !@#$%^&*()-_+={}[\];:",.<>/?`~|\\]*' { yylval.name = strdup(yytext); return STRING; }
|
'[^']*'' {
|
||||||
|
yyless(yyleng-1);
|
||||||
|
yymore();
|
||||||
|
}
|
||||||
|
'[^']*' {
|
||||||
|
yylval.name = strdup(yytext);
|
||||||
|
return STRING;
|
||||||
|
}
|
||||||
|
|
||||||
(-*[0-9]+|([0-9]*\.[0-9]+)([eE][-+]?[0-9]+)?) {
|
(-*[0-9]+|([0-9]*\.[0-9]+)([eE][-+]?[0-9]+)?) {
|
||||||
yylval.name = strdup(yytext); return NUMBER;
|
yylval.name = strdup(yytext); return NUMBER;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user