aboutsummaryrefslogtreecommitdiff
path: root/src/tokenize.c
diff options
context:
space:
mode:
authordrh <>2025-01-31 01:34:19 +0000
committerdrh <>2025-01-31 01:34:19 +0000
commite16b3452435dd03dbae8f355feeb33385780af3d (patch)
tree361515759a6d50c375aefc5d6a608eac844f23ed /src/tokenize.c
parent0911f86abf39bfaf0f3b144f07860238baf6a483 (diff)
downloadsqlite-e16b3452435dd03dbae8f355feeb33385780af3d.tar.gz
sqlite-e16b3452435dd03dbae8f355feeb33385780af3d.zip
Add the SQLITE_DBCONFIG_ENABLE_COMMENTS setting (default on) to enable or
disable the ability to include comments in SQL input text. FossilOrigin-Name: 393749a2e22d5c8eba36e2106a35909420aa6316652d1ab4f18ef699247b6fba
Diffstat (limited to 'src/tokenize.c')
-rw-r--r--src/tokenize.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/tokenize.c b/src/tokenize.c
index b49b2aa16..901a4f038 100644
--- a/src/tokenize.c
+++ b/src/tokenize.c
@@ -288,7 +288,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
case CC_MINUS: {
if( z[1]=='-' ){
for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
- *tokenType = TK_SPACE; /* IMP: R-22934-25134 */
+ *tokenType = TK_COMMENT;
return i;
}else if( z[1]=='>' ){
*tokenType = TK_PTR;
@@ -324,7 +324,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
}
for(i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){}
if( c ) i++;
- *tokenType = TK_SPACE; /* IMP: R-22934-25134 */
+ *tokenType = TK_COMMENT;
return i;
}
case CC_PERCENT: {
@@ -653,12 +653,12 @@ int sqlite3RunParser(Parse *pParse, const char *zSql){
if( tokenType>=TK_WINDOW ){
assert( tokenType==TK_SPACE || tokenType==TK_OVER || tokenType==TK_FILTER
|| tokenType==TK_ILLEGAL || tokenType==TK_WINDOW
- || tokenType==TK_QNUMBER
+ || tokenType==TK_QNUMBER || tokenType==TK_COMMENT
);
#else
if( tokenType>=TK_SPACE ){
assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL
- || tokenType==TK_QNUMBER
+ || tokenType==TK_QNUMBER || tokenType==TK_COMMENT
);
#endif /* SQLITE_OMIT_WINDOWFUNC */
if( AtomicLoad(&db->u1.isInterrupted) ){
@@ -692,6 +692,9 @@ int sqlite3RunParser(Parse *pParse, const char *zSql){
assert( n==6 );
tokenType = analyzeFilterKeyword((const u8*)&zSql[6], lastTokenParsed);
#endif /* SQLITE_OMIT_WINDOWFUNC */
+ }else if( tokenType==TK_COMMENT && (db->flags & SQLITE_Comments)!=0 ){
+ zSql += n;
+ continue;
}else if( tokenType!=TK_QNUMBER ){
Token x;
x.z = zSql;