Skip to content

Commit

Permalink
Update to SQLite 3.35.1
Browse files Browse the repository at this point in the history
  • Loading branch information
utelle committed Mar 15, 2021
1 parent 62ad82e commit 870621f
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 55 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dnl Copyright (C) 2019-2021 Ulrich Telle <ulrich@telle-online.de>
dnl
dnl This file is covered by the same licence as the entire SQLite3 Multiple Ciphers package.

AC_INIT([sqlite3mc], [1.2.0], [ulrich@telle-online.de])
AC_INIT([sqlite3mc], [1.2.1], [ulrich@telle-online.de])

dnl This is the version tested with, might work with earlier ones.
AC_PREREQ([2.69])
Expand Down
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ In the course of time several developers had asked for a stand-alone version of

In late February 2020 work started on a new implementation of a SQLite encryption extension that will be able to support SQLite 3.32.0 and later. The new approach is based on [SQLite's VFS feature](https://www.sqlite.org/vfs.html). This approach has its pros and cons. On the one hand, the code is less closely coupled with SQLite itself; on the other hand, access to SQLite's internal data structures is more complex.

This project is _Work In Progress_. As of December 2020, the code base is now rather stable, however, further major code modifications and/or reorganizations may still occur.
This project is _Work In Progress_. As of March 2021, the code base is now rather stable, however, further major code modifications and/or reorganizations may still occur.

The code was mainly developed under Windows, but was tested under Linux as well. At the moment no major issues are known.

## Version history

* 1.2.1 - *March 2021*
- Based on SQLite version 3.35.1
* 1.2.0 - *March 2021*
- Based on SQLite version 3.35.0
- Enabled new SQLite Math Extension (Note: _log_ function now computes _log10_, not _ln_.)
Expand Down
4 changes: 2 additions & 2 deletions src/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -14037,13 +14037,13 @@ static const char *(azHelp[]) = {
".databases List names and files of attached databases",
".dbconfig ?op? ?val? List or change sqlite3_db_config() options",
".dbinfo ?DB? Show status information about the database",
".dump ?TABLE? Render database content as SQL",
".dump ?OBJECTS? Render database content as SQL",
" Options:",
" --data-only Output only INSERT statements",
" --newlines Allow unescaped newline characters in output",
" --nosys Omit system tables (ex: \"sqlite_stat1\")",
" --preserve-rowids Include ROWID values in the output",
" TABLE is a LIKE pattern for the tables to dump",
" OBJECTS is a LIKE pattern for tables, indexes, triggers or views to dump",
" Additional LIKE patterns can be given in subsequent arguments",
".echo on|off Turn command echo on or off",
".eqp on|off|full|... Enable or disable automatic EXPLAIN QUERY PLAN",
Expand Down
64 changes: 41 additions & 23 deletions src/sqlite3.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
** version 3.35.0. By combining all the individual C code files into this
** version 3.35.1. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation
** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements
Expand Down Expand Up @@ -1186,9 +1186,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.35.0"
#define SQLITE_VERSION_NUMBER 3035000
#define SQLITE_SOURCE_ID "2021-03-12 15:10:09 acd63062eb06748bfe9e4886639e4f2b54ea6a496a83f10716abbaba4115500b"
#define SQLITE_VERSION "3.35.1"
#define SQLITE_VERSION_NUMBER 3035001
#define SQLITE_SOURCE_ID "2021-03-15 16:53:57 aea12399bf1fdc76af43499d4624c3afa17c3e6c2459b71c195804bb98def66a"

/*
** CAPI3REF: Run-Time Library Version Numbers
Expand Down Expand Up @@ -17007,7 +17007,10 @@ struct sqlite3 {
unsigned orphanTrigger : 1; /* Last statement is orphaned TEMP trigger */
unsigned imposterTable : 1; /* Building an imposter table */
unsigned reopenMemdb : 1; /* ATTACH is really a reopen using MemDB */
unsigned bDropColumn : 1; /* Doing schema check after DROP COLUMN */
char **azInit; /* "type", "name", and "tbl_name" columns */
/* or if bDropColumn, then azInit[0] is the */
/* name of the column being dropped */
} init;
int nVdbeActive; /* Number of VDBEs currently running */
int nVdbeRead; /* Number of active VDBEs that read or write */
Expand Down Expand Up @@ -99167,6 +99170,7 @@ static int lookupName(
assert( pExpr->op==TK_ID );
if( ExprHasProperty(pExpr,EP_DblQuoted)
&& areDoubleQuotedStringsEnabled(db, pTopNC)
&& (db->init.bDropColumn==0 || sqlite3StrICmp(zCol, db->init.azInit[0])!=0)
){
/* If a double-quoted identifier does not match any known column name,
** then treat it as a string.
Expand All @@ -99181,6 +99185,11 @@ static int lookupName(
** Someday, I hope to get rid of this hack. Unfortunately there is
** a huge amount of legacy SQL that uses it. So for now, we just
** issue a warning.
**
** 2021-03-15: ticket 1c24a659e6d7f3a1
** Do not do the ID-to-STRING conversion when doing the schema
** sanity check following a DROP COLUMN if the identifer name matches
** the name of the column being dropped.
*/
sqlite3_log(SQLITE_WARNING,
"double-quoted string literal: \"%w\"", zCol);
Expand Down Expand Up @@ -106780,17 +106789,18 @@ static void renameTestSchema(
Parse *pParse, /* Parse context */
const char *zDb, /* Name of db to verify schema of */
int bTemp, /* True if this is the temp db */
const char *zWhen /* "when" part of error message */
const char *zWhen, /* "when" part of error message */
const char *zDropColumn /* Name of column being dropped */
){
pParse->colNamesSet = 1;
sqlite3NestedParse(pParse,
"SELECT 1 "
"FROM \"%w\"." DFLT_SCHEMA_TABLE " "
"WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
" AND sql NOT LIKE 'create virtual%%'"
" AND sqlite_rename_test(%Q, sql, type, name, %d, %Q)=NULL ",
" AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %Q)=NULL ",
zDb,
zDb, bTemp, zWhen
zDb, bTemp, zWhen, zDropColumn
);

if( bTemp==0 ){
Expand All @@ -106799,8 +106809,8 @@ static void renameTestSchema(
"FROM temp." DFLT_SCHEMA_TABLE " "
"WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
" AND sql NOT LIKE 'create virtual%%'"
" AND sqlite_rename_test(%Q, sql, type, name, 1, %Q)=NULL ",
zDb, zWhen
" AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %Q)=NULL ",
zDb, zWhen, zDropColumn
);
}
}
Expand Down Expand Up @@ -106963,7 +106973,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable(
"sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), "
"tbl_name = "
"CASE WHEN tbl_name=%Q COLLATE nocase AND "
" sqlite_rename_test(%Q, sql, type, name, 1, 'after rename') "
" sqlite_rename_test(%Q, sql, type, name, 1, 'after rename',0) "
"THEN %Q ELSE tbl_name END "
"WHERE type IN ('view', 'trigger')"
, zDb, zTabName, zName, zTabName, zDb, zName);
Expand All @@ -106983,7 +106993,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable(
#endif

renameReloadSchema(pParse, iDb, INITFLAG_AlterRename);
renameTestSchema(pParse, zDb, iDb==1, "after rename");
renameTestSchema(pParse, zDb, iDb==1, "after rename", 0);

exit_rename_table:
sqlite3SrcListDelete(db, pSrc);
Expand Down Expand Up @@ -107351,7 +107361,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn(

/* Drop and reload the database schema. */
renameReloadSchema(pParse, iSchema, INITFLAG_AlterRename);
renameTestSchema(pParse, zDb, iSchema==1, "after rename");
renameTestSchema(pParse, zDb, iSchema==1, "after rename", 0);

exit_rename_column:
sqlite3SrcListDelete(db, pSrc);
Expand Down Expand Up @@ -107775,12 +107785,17 @@ static int renameParseSql(
const char *zDb, /* Name of schema SQL belongs to */
sqlite3 *db, /* Database handle */
const char *zSql, /* SQL to parse */
int bTemp /* True if SQL is from temp schema */
int bTemp, /* True if SQL is from temp schema */
const char *zDropColumn /* Name of column being dropped */
){
int rc;
char *zErr = 0;

db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb);
if( zDropColumn ){
db->init.bDropColumn = 1;
db->init.azInit = (char**)&zDropColumn;
}

/* Parse the SQL statement passed as the first argument. If no error
** occurs and the parse does not result in a new table, index or
Expand Down Expand Up @@ -107813,6 +107828,7 @@ static int renameParseSql(
#endif

db->init.iDb = 0;
db->init.bDropColumn = 0;
return rc;
}

Expand Down Expand Up @@ -108114,7 +108130,7 @@ static void renameColumnFunc(
#ifndef SQLITE_OMIT_AUTHORIZATION
db->xAuth = 0;
#endif
rc = renameParseSql(&sParse, zDb, db, zSql, bTemp);
rc = renameParseSql(&sParse, zDb, db, zSql, bTemp, 0);

/* Find tokens that need to be replaced. */
memset(&sWalker, 0, sizeof(Walker));
Expand Down Expand Up @@ -108318,7 +108334,7 @@ static void renameTableFunc(
sWalker.xSelectCallback = renameTableSelectCb;
sWalker.u.pRename = &sCtx;

rc = renameParseSql(&sParse, zDb, db, zInput, bTemp);
rc = renameParseSql(&sParse, zDb, db, zInput, bTemp, 0);

if( rc==SQLITE_OK ){
int isLegacy = (db->flags & SQLITE_LegacyAlter);
Expand Down Expand Up @@ -108434,6 +108450,7 @@ static void renameTableFunc(
** 3: Object name.
** 4: True if object is from temp schema.
** 5: "when" part of error message.
** 6: Name of column being dropped, or NULL.
**
** Unless it finds an error, this function normally returns NULL. However, it
** returns integer value 1 if:
Expand All @@ -108452,6 +108469,7 @@ static void renameTableTest(
int bTemp = sqlite3_value_int(argv[4]);
int isLegacy = (db->flags & SQLITE_LegacyAlter);
char const *zWhen = (const char*)sqlite3_value_text(argv[5]);
char const *zDropColumn = (const char*)sqlite3_value_text(argv[6]);

#ifndef SQLITE_OMIT_AUTHORIZATION
sqlite3_xauth xAuth = db->xAuth;
Expand All @@ -108462,7 +108480,7 @@ static void renameTableTest(
if( zDb && zInput ){
int rc;
Parse sParse;
rc = renameParseSql(&sParse, zDb, db, zInput, bTemp);
rc = renameParseSql(&sParse, zDb, db, zInput, bTemp, zDropColumn);
if( rc==SQLITE_OK ){
if( isLegacy==0 && sParse.pNewTable && sParse.pNewTable->pSelect ){
NameContext sNC;
Expand Down Expand Up @@ -108530,7 +108548,7 @@ static void dropColumnFunc(
#endif

UNUSED_PARAMETER(NotUsed);
rc = renameParseSql(&sParse, zDb, db, zSql, iSchema==1);
rc = renameParseSql(&sParse, zDb, db, zSql, iSchema==1, 0);
if( rc!=SQLITE_OK ) goto drop_column_done;
pTab = sParse.pNewTable;
if( pTab==0 || pTab->nCol==1 || iCol>=pTab->nCol ){
Expand Down Expand Up @@ -108623,7 +108641,7 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token *
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
assert( iDb>=0 );
zDb = db->aDb[iDb].zDbSName;
renameTestSchema(pParse, zDb, iDb==1, "");
renameTestSchema(pParse, zDb, iDb==1, "", 0);
sqlite3NestedParse(pParse,
"UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET "
"sql = sqlite_drop_column(%d, sql, %d) "
Expand All @@ -108633,7 +108651,7 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token *

/* Drop and reload the database schema. */
renameReloadSchema(pParse, iDb, INITFLAG_AlterDrop);
renameTestSchema(pParse, zDb, iDb==1, "after drop column");
renameTestSchema(pParse, zDb, iDb==1, "after drop column", zCol);

/* Edit rows of table on disk */
if( pParse->nErr==0 && (pTab->aCol[iCol].colFlags & COLFLAG_VIRTUAL)==0 ){
Expand Down Expand Up @@ -108693,7 +108711,7 @@ SQLITE_PRIVATE void sqlite3AlterFunctions(void){
static FuncDef aAlterTableFuncs[] = {
INTERNAL_FUNCTION(sqlite_rename_column, 9, renameColumnFunc),
INTERNAL_FUNCTION(sqlite_rename_table, 7, renameTableFunc),
INTERNAL_FUNCTION(sqlite_rename_test, 6, renameTableTest),
INTERNAL_FUNCTION(sqlite_rename_test, 7, renameTableTest),
INTERNAL_FUNCTION(sqlite_drop_column, 3, dropColumnFunc),
};
sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs));
Expand Down Expand Up @@ -229192,7 +229210,7 @@ static void fts5SourceIdFunc(
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
sqlite3_result_text(pCtx, "fts5: 2021-03-12 15:10:09 acd63062eb06748bfe9e4886639e4f2b54ea6a496a83f10716abbaba4115500b", -1, SQLITE_TRANSIENT);
sqlite3_result_text(pCtx, "fts5: 2021-03-15 16:53:57 aea12399bf1fdc76af43499d4624c3afa17c3e6c2459b71c195804bb98def66a", -1, SQLITE_TRANSIENT);
}

/*
Expand Down Expand Up @@ -234118,9 +234136,9 @@ SQLITE_API int sqlite3_stmt_init(
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */

/************** End of stmt.c ************************************************/
#if __LINE__!=234121
#if __LINE__!=234139
#undef SQLITE_SOURCE_ID
#define SQLITE_SOURCE_ID "2021-03-12 15:10:09 acd63062eb06748bfe9e4886639e4f2b54ea6a496a83f10716abbaba4115alt2"
#define SQLITE_SOURCE_ID "2021-03-15 16:53:57 aea12399bf1fdc76af43499d4624c3afa17c3e6c2459b71c195804bb98dealt2"
#endif
/* Return the source-id for this library */
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
Expand Down
6 changes: 3 additions & 3 deletions src/sqlite3.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.35.0"
#define SQLITE_VERSION_NUMBER 3035000
#define SQLITE_SOURCE_ID "2021-03-12 15:10:09 acd63062eb06748bfe9e4886639e4f2b54ea6a496a83f10716abbaba4115500b"
#define SQLITE_VERSION "3.35.1"
#define SQLITE_VERSION_NUMBER 3035001
#define SQLITE_SOURCE_ID "2021-03-15 16:53:57 aea12399bf1fdc76af43499d4624c3afa17c3e6c2459b71c195804bb98def66a"

/*
** CAPI3REF: Run-Time Library Version Numbers
Expand Down
4 changes: 2 additions & 2 deletions src/sqlite3mc_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#define SQLITE3MC_VERSION_MAJOR 1
#define SQLITE3MC_VERSION_MINOR 2
#define SQLITE3MC_VERSION_RELEASE 0
#define SQLITE3MC_VERSION_RELEASE 1
#define SQLITE3MC_VERSION_SUBRELEASE 0
#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.2.0"
#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.2.1"

#endif /* SQLITE3MC_VERSION_H_ */
Loading

0 comments on commit 870621f

Please sign in to comment.