@@ -69,7 +69,7 @@ extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
69
69
/*** Begin of #include "sqlite3patched.c" ***/
70
70
/******************************************************************************
71
71
** This file is an amalgamation of many separate C source files from SQLite
72
- ** version 3.35.0 . By combining all the individual C code files into this
72
+ ** version 3.35.1 . By combining all the individual C code files into this
73
73
** single large file, the entire code can be compiled as a single translation
74
74
** unit. This allows many compilers to do optimizations that would not be
75
75
** possible if the files were compiled separately. Performance improvements
@@ -1255,9 +1255,9 @@ extern "C" {
1255
1255
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1256
1256
** [sqlite_version()] and [sqlite_source_id()].
1257
1257
*/
1258
- #define SQLITE_VERSION "3.35.0 "
1259
- #define SQLITE_VERSION_NUMBER 3035000
1260
- #define SQLITE_SOURCE_ID "2021-03-12 15:10:09 acd63062eb06748bfe9e4886639e4f2b54ea6a496a83f10716abbaba4115500b "
1258
+ #define SQLITE_VERSION "3.35.1 "
1259
+ #define SQLITE_VERSION_NUMBER 3035001
1260
+ #define SQLITE_SOURCE_ID "2021-03-15 16:53:57 aea12399bf1fdc76af43499d4624c3afa17c3e6c2459b71c195804bb98def66a "
1261
1261
1262
1262
/*
1263
1263
** CAPI3REF: Run-Time Library Version Numbers
@@ -17081,7 +17081,10 @@ struct sqlite3 {
17081
17081
unsigned orphanTrigger : 1; /* Last statement is orphaned TEMP trigger */
17082
17082
unsigned imposterTable : 1; /* Building an imposter table */
17083
17083
unsigned reopenMemdb : 1; /* ATTACH is really a reopen using MemDB */
17084
+ unsigned bDropColumn : 1; /* Doing schema check after DROP COLUMN */
17084
17085
char **azInit; /* "type", "name", and "tbl_name" columns */
17086
+ /* or if bDropColumn, then azInit[0] is the */
17087
+ /* name of the column being dropped */
17085
17088
} init;
17086
17089
int nVdbeActive; /* Number of VDBEs currently running */
17087
17090
int nVdbeRead; /* Number of active VDBEs that read or write */
@@ -99241,6 +99244,7 @@ static int lookupName(
99241
99244
assert( pExpr->op==TK_ID );
99242
99245
if( ExprHasProperty(pExpr,EP_DblQuoted)
99243
99246
&& areDoubleQuotedStringsEnabled(db, pTopNC)
99247
+ && (db->init.bDropColumn==0 || sqlite3StrICmp(zCol, db->init.azInit[0])!=0)
99244
99248
){
99245
99249
/* If a double-quoted identifier does not match any known column name,
99246
99250
** then treat it as a string.
@@ -99255,6 +99259,11 @@ static int lookupName(
99255
99259
** Someday, I hope to get rid of this hack. Unfortunately there is
99256
99260
** a huge amount of legacy SQL that uses it. So for now, we just
99257
99261
** issue a warning.
99262
+ **
99263
+ ** 2021-03-15: ticket 1c24a659e6d7f3a1
99264
+ ** Do not do the ID-to-STRING conversion when doing the schema
99265
+ ** sanity check following a DROP COLUMN if the identifer name matches
99266
+ ** the name of the column being dropped.
99258
99267
*/
99259
99268
sqlite3_log(SQLITE_WARNING,
99260
99269
"double-quoted string literal: \"%w\"", zCol);
@@ -106854,17 +106863,18 @@ static void renameTestSchema(
106854
106863
Parse *pParse, /* Parse context */
106855
106864
const char *zDb, /* Name of db to verify schema of */
106856
106865
int bTemp, /* True if this is the temp db */
106857
- const char *zWhen /* "when" part of error message */
106866
+ const char *zWhen, /* "when" part of error message */
106867
+ const char *zDropColumn /* Name of column being dropped */
106858
106868
){
106859
106869
pParse->colNamesSet = 1;
106860
106870
sqlite3NestedParse(pParse,
106861
106871
"SELECT 1 "
106862
106872
"FROM \"%w\"." DFLT_SCHEMA_TABLE " "
106863
106873
"WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
106864
106874
" AND sql NOT LIKE 'create virtual%%'"
106865
- " AND sqlite_rename_test(%Q, sql, type, name, %d, %Q)=NULL ",
106875
+ " AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %Q )=NULL ",
106866
106876
zDb,
106867
- zDb, bTemp, zWhen
106877
+ zDb, bTemp, zWhen, zDropColumn
106868
106878
);
106869
106879
106870
106880
if( bTemp==0 ){
@@ -106873,8 +106883,8 @@ static void renameTestSchema(
106873
106883
"FROM temp." DFLT_SCHEMA_TABLE " "
106874
106884
"WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
106875
106885
" AND sql NOT LIKE 'create virtual%%'"
106876
- " AND sqlite_rename_test(%Q, sql, type, name, 1, %Q)=NULL ",
106877
- zDb, zWhen
106886
+ " AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %Q )=NULL ",
106887
+ zDb, zWhen, zDropColumn
106878
106888
);
106879
106889
}
106880
106890
}
@@ -107037,7 +107047,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable(
107037
107047
"sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), "
107038
107048
"tbl_name = "
107039
107049
"CASE WHEN tbl_name=%Q COLLATE nocase AND "
107040
- " sqlite_rename_test(%Q, sql, type, name, 1, 'after rename') "
107050
+ " sqlite_rename_test(%Q, sql, type, name, 1, 'after rename',0 ) "
107041
107051
"THEN %Q ELSE tbl_name END "
107042
107052
"WHERE type IN ('view', 'trigger')"
107043
107053
, zDb, zTabName, zName, zTabName, zDb, zName);
@@ -107057,7 +107067,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable(
107057
107067
#endif
107058
107068
107059
107069
renameReloadSchema(pParse, iDb, INITFLAG_AlterRename);
107060
- renameTestSchema(pParse, zDb, iDb==1, "after rename");
107070
+ renameTestSchema(pParse, zDb, iDb==1, "after rename", 0 );
107061
107071
107062
107072
exit_rename_table:
107063
107073
sqlite3SrcListDelete(db, pSrc);
@@ -107425,7 +107435,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn(
107425
107435
107426
107436
/* Drop and reload the database schema. */
107427
107437
renameReloadSchema(pParse, iSchema, INITFLAG_AlterRename);
107428
- renameTestSchema(pParse, zDb, iSchema==1, "after rename");
107438
+ renameTestSchema(pParse, zDb, iSchema==1, "after rename", 0 );
107429
107439
107430
107440
exit_rename_column:
107431
107441
sqlite3SrcListDelete(db, pSrc);
@@ -107849,12 +107859,17 @@ static int renameParseSql(
107849
107859
const char *zDb, /* Name of schema SQL belongs to */
107850
107860
sqlite3 *db, /* Database handle */
107851
107861
const char *zSql, /* SQL to parse */
107852
- int bTemp /* True if SQL is from temp schema */
107862
+ int bTemp, /* True if SQL is from temp schema */
107863
+ const char *zDropColumn /* Name of column being dropped */
107853
107864
){
107854
107865
int rc;
107855
107866
char *zErr = 0;
107856
107867
107857
107868
db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb);
107869
+ if( zDropColumn ){
107870
+ db->init.bDropColumn = 1;
107871
+ db->init.azInit = (char**)&zDropColumn;
107872
+ }
107858
107873
107859
107874
/* Parse the SQL statement passed as the first argument. If no error
107860
107875
** occurs and the parse does not result in a new table, index or
@@ -107887,6 +107902,7 @@ static int renameParseSql(
107887
107902
#endif
107888
107903
107889
107904
db->init.iDb = 0;
107905
+ db->init.bDropColumn = 0;
107890
107906
return rc;
107891
107907
}
107892
107908
@@ -108188,7 +108204,7 @@ static void renameColumnFunc(
108188
108204
#ifndef SQLITE_OMIT_AUTHORIZATION
108189
108205
db->xAuth = 0;
108190
108206
#endif
108191
- rc = renameParseSql(&sParse, zDb, db, zSql, bTemp);
108207
+ rc = renameParseSql(&sParse, zDb, db, zSql, bTemp, 0 );
108192
108208
108193
108209
/* Find tokens that need to be replaced. */
108194
108210
memset(&sWalker, 0, sizeof(Walker));
@@ -108392,7 +108408,7 @@ static void renameTableFunc(
108392
108408
sWalker.xSelectCallback = renameTableSelectCb;
108393
108409
sWalker.u.pRename = &sCtx;
108394
108410
108395
- rc = renameParseSql(&sParse, zDb, db, zInput, bTemp);
108411
+ rc = renameParseSql(&sParse, zDb, db, zInput, bTemp, 0 );
108396
108412
108397
108413
if( rc==SQLITE_OK ){
108398
108414
int isLegacy = (db->flags & SQLITE_LegacyAlter);
@@ -108508,6 +108524,7 @@ static void renameTableFunc(
108508
108524
** 3: Object name.
108509
108525
** 4: True if object is from temp schema.
108510
108526
** 5: "when" part of error message.
108527
+ ** 6: Name of column being dropped, or NULL.
108511
108528
**
108512
108529
** Unless it finds an error, this function normally returns NULL. However, it
108513
108530
** returns integer value 1 if:
@@ -108526,6 +108543,7 @@ static void renameTableTest(
108526
108543
int bTemp = sqlite3_value_int(argv[4]);
108527
108544
int isLegacy = (db->flags & SQLITE_LegacyAlter);
108528
108545
char const *zWhen = (const char*)sqlite3_value_text(argv[5]);
108546
+ char const *zDropColumn = (const char*)sqlite3_value_text(argv[6]);
108529
108547
108530
108548
#ifndef SQLITE_OMIT_AUTHORIZATION
108531
108549
sqlite3_xauth xAuth = db->xAuth;
@@ -108536,7 +108554,7 @@ static void renameTableTest(
108536
108554
if( zDb && zInput ){
108537
108555
int rc;
108538
108556
Parse sParse;
108539
- rc = renameParseSql(&sParse, zDb, db, zInput, bTemp);
108557
+ rc = renameParseSql(&sParse, zDb, db, zInput, bTemp, zDropColumn );
108540
108558
if( rc==SQLITE_OK ){
108541
108559
if( isLegacy==0 && sParse.pNewTable && sParse.pNewTable->pSelect ){
108542
108560
NameContext sNC;
@@ -108604,7 +108622,7 @@ static void dropColumnFunc(
108604
108622
#endif
108605
108623
108606
108624
UNUSED_PARAMETER(NotUsed);
108607
- rc = renameParseSql(&sParse, zDb, db, zSql, iSchema==1);
108625
+ rc = renameParseSql(&sParse, zDb, db, zSql, iSchema==1, 0 );
108608
108626
if( rc!=SQLITE_OK ) goto drop_column_done;
108609
108627
pTab = sParse.pNewTable;
108610
108628
if( pTab==0 || pTab->nCol==1 || iCol>=pTab->nCol ){
@@ -108697,7 +108715,7 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token *
108697
108715
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
108698
108716
assert( iDb>=0 );
108699
108717
zDb = db->aDb[iDb].zDbSName;
108700
- renameTestSchema(pParse, zDb, iDb==1, "");
108718
+ renameTestSchema(pParse, zDb, iDb==1, "", 0 );
108701
108719
sqlite3NestedParse(pParse,
108702
108720
"UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET "
108703
108721
"sql = sqlite_drop_column(%d, sql, %d) "
@@ -108707,7 +108725,7 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token *
108707
108725
108708
108726
/* Drop and reload the database schema. */
108709
108727
renameReloadSchema(pParse, iDb, INITFLAG_AlterDrop);
108710
- renameTestSchema(pParse, zDb, iDb==1, "after drop column");
108728
+ renameTestSchema(pParse, zDb, iDb==1, "after drop column", zCol );
108711
108729
108712
108730
/* Edit rows of table on disk */
108713
108731
if( pParse->nErr==0 && (pTab->aCol[iCol].colFlags & COLFLAG_VIRTUAL)==0 ){
@@ -108767,7 +108785,7 @@ SQLITE_PRIVATE void sqlite3AlterFunctions(void){
108767
108785
static FuncDef aAlterTableFuncs[] = {
108768
108786
INTERNAL_FUNCTION(sqlite_rename_column, 9, renameColumnFunc),
108769
108787
INTERNAL_FUNCTION(sqlite_rename_table, 7, renameTableFunc),
108770
- INTERNAL_FUNCTION(sqlite_rename_test, 6 , renameTableTest),
108788
+ INTERNAL_FUNCTION(sqlite_rename_test, 7 , renameTableTest),
108771
108789
INTERNAL_FUNCTION(sqlite_drop_column, 3, dropColumnFunc),
108772
108790
};
108773
108791
sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs));
@@ -229276,7 +229294,7 @@ static void fts5SourceIdFunc(
229276
229294
){
229277
229295
assert( nArg==0 );
229278
229296
UNUSED_PARAM2(nArg, apUnused);
229279
- sqlite3_result_text(pCtx, "fts5: 2021-03-12 15:10:09 acd63062eb06748bfe9e4886639e4f2b54ea6a496a83f10716abbaba4115500b ", -1, SQLITE_TRANSIENT);
229297
+ sqlite3_result_text(pCtx, "fts5: 2021-03-15 16:53:57 aea12399bf1fdc76af43499d4624c3afa17c3e6c2459b71c195804bb98def66a ", -1, SQLITE_TRANSIENT);
229280
229298
}
229281
229299
229282
229300
/*
@@ -234202,9 +234220,9 @@ SQLITE_API int sqlite3_stmt_init(
234202
234220
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
234203
234221
234204
234222
/************** End of stmt.c ************************************************/
234205
- #if __LINE__!=234121
234223
+ #if __LINE__!=234139
234206
234224
#undef SQLITE_SOURCE_ID
234207
- #define SQLITE_SOURCE_ID "2021-03-12 15:10:09 acd63062eb06748bfe9e4886639e4f2b54ea6a496a83f10716abbaba4115alt2 "
234225
+ #define SQLITE_SOURCE_ID "2021-03-15 16:53:57 aea12399bf1fdc76af43499d4624c3afa17c3e6c2459b71c195804bb98dealt2 "
234208
234226
#endif
234209
234227
/* Return the source-id for this library */
234210
234228
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
@@ -234356,9 +234374,9 @@ extern "C" {
234356
234374
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
234357
234375
** [sqlite_version()] and [sqlite_source_id()].
234358
234376
*/
234359
- #define SQLITE_VERSION "3.35.0 "
234360
- #define SQLITE_VERSION_NUMBER 3035000
234361
- #define SQLITE_SOURCE_ID "2021-03-12 15:10:09 acd63062eb06748bfe9e4886639e4f2b54ea6a496a83f10716abbaba4115500b "
234377
+ #define SQLITE_VERSION "3.35.1 "
234378
+ #define SQLITE_VERSION_NUMBER 3035001
234379
+ #define SQLITE_SOURCE_ID "2021-03-15 16:53:57 aea12399bf1fdc76af43499d4624c3afa17c3e6c2459b71c195804bb98def66a "
234362
234380
234363
234381
/*
234364
234382
** CAPI3REF: Run-Time Library Version Numbers
@@ -246808,9 +246826,9 @@ SQLITE_API void sqlite3mc_vfs_shutdown();
246808
246826
246809
246827
#define SQLITE3MC_VERSION_MAJOR 1
246810
246828
#define SQLITE3MC_VERSION_MINOR 2
246811
- #define SQLITE3MC_VERSION_RELEASE 0
246829
+ #define SQLITE3MC_VERSION_RELEASE 1
246812
246830
#define SQLITE3MC_VERSION_SUBRELEASE 0
246813
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.2.0 "
246831
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.2.1 "
246814
246832
246815
246833
#endif /* SQLITE3MC_VERSION_H_ */
246816
246834
/*** End of #include "sqlite3mc_version.h" ***/
@@ -258667,6 +258685,7 @@ static void atn2Func(sqlite3_context *context, int argc, sqlite3_value **argv){
258667
258685
258668
258686
#ifndef SQLITE_ENABLE_MATH_FUNCTIONS
258669
258687
258688
+ #if SQLITE_VERSION_NUMBER < 3035000
258670
258689
/*
258671
258690
** Implementation of the sign() function
258672
258691
** return one of 3 possibilities +1,0 or -1 when the argument is respectively
@@ -258698,7 +258717,7 @@ static void signFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
258698
258717
}
258699
258718
}
258700
258719
}
258701
-
258720
+ #endif
258702
258721
258703
258722
/*
258704
258723
** smallest integer value not less than argument
0 commit comments