1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Faster and smaller test to ensure that the sqlite_schema.sql field is always

a CREATE statement of some kind.

FossilOrigin-Name: 76de2bb04b1c02a6c0300cd61d9b3d2477d845aa0d1cdb9dbe4f354b9fedd923
This commit is contained in:
drh
2021-01-01 21:02:37 +00:00
parent 37114fbfcc
commit 630fc34c1a
3 changed files with 15 additions and 8 deletions

View File

@@ -102,11 +102,18 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */
if( argv[3]==0 ){
corruptSchema(pData, argv[1], 0);
}else if( sqlite3_strnicmp(argv[4],"create ",7)==0 ){
}else if( argv[4]
&& 'c'==sqlite3UpperToLower[(unsigned char)argv[4][0]]
&& 'r'==sqlite3UpperToLower[(unsigned char)argv[4][1]] ){
/* Call the parser to process a CREATE TABLE, INDEX or VIEW.
** But because db->init.busy is set to 1, no VDBE code is generated
** or executed. All the parser does is build the internal data
** structures that describe the table, index, or view.
**
** No other valid SQL statement, other than the variable CREATE statements,
** can begin with the letters "C" and "R". Thus, it is not possible run
** any other kind of statement while parsing the schema, even a corrupt
** schema.
*/
int rc;
u8 saved_iDb = db->init.iDb;