mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Change the name of the parameter table in the CLI to "sqlite_parameters".
Doing so involves adding SQLITE_DBCONFIG_WRITABLE_SCHEMA and allowing the creation of tables whose names begin with "sqlite_" and that are indexed while writable_schema is on. FossilOrigin-Name: 24ef3844692debc2db7b1d427f5dcf4050481a8c7f71c3b516766b819ecab587
This commit is contained in:
18
manifest
18
manifest
@@ -1,5 +1,5 @@
|
||||
C Earlier\sdetection\sof\scorruption\swhile\sadded\sto\sthe\sfreelist.
|
||||
D 2019-03-25T19:50:19.302
|
||||
C Change\sthe\sname\sof\sthe\sparameter\stable\sin\sthe\sCLI\sto\s"sqlite_parameters".\nDoing\sso\sinvolves\sadding\sSQLITE_DBCONFIG_WRITABLE_SCHEMA\sand\sallowing\sthe\ncreation\sof\stables\swhose\snames\sbegin\swith\s"sqlite_"\sand\sthat\sare\sindexed\nwhile\swritable_schema\sis\son.
|
||||
D 2019-03-25T21:35:41.214
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@@ -460,7 +460,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
|
||||
F src/btree.c 6bea02598917ad9549d2d0c78bf8cc288eeb7a0b0f4298cbe1713db01340f9be
|
||||
F src/btree.h 63b94fb38ce571c15eb6a3661815561b501d23d5948b2d1e951fbd7a2d04e8d3
|
||||
F src/btreeInt.h 6111c15868b90669f79081039d19e7ea8674013f907710baa3c814dc3f8bfd3f
|
||||
F src/build.c 0f88a2f52c80da71ceb6e95831622aa4aeda758b69011bde9eb87840c8d38672
|
||||
F src/build.c 2c7cde0fe872d004ae7d550bffdbe9bc063566cab5ec810fbaf3b75975460ae6
|
||||
F src/callback.c 25dda5e1c2334a367b94a64077b1d06b2553369f616261ca6783c48bcb6bda73
|
||||
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
|
||||
F src/ctime.c 109e58d00f62e8e71ee1eb5944ac18b90171c928ab2e082e058056e1137cc20b
|
||||
@@ -480,7 +480,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
|
||||
F src/insert.c 4ce12b5ba3bcbfa17ec37ce960d499fc287b6289df2c00b31201f716a3c7df45
|
||||
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
||||
F src/loadext.c e6f10875d52aca3b7e57ce1ec174aeafc9b6c00b43000cd30d791f9cb490b7a6
|
||||
F src/main.c 27d7265625ea6eaccdfe7c53ef41adc179c9357a077702a860c1a3b0a037a16f
|
||||
F src/main.c 11714c8cefd458970cb1fd005251d0ad02ad69598893833b5564ffaaef192a1f
|
||||
F src/malloc.c 0f9da2a66b230a5785af94b9672126845099b57b70a32c987d04ac28c69da990
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
|
||||
@@ -517,8 +517,8 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
||||
F src/resolve.c 09419ad5c432190b69be7c0c326e03abb548a97c2c50675b81b459e1b382d1d2
|
||||
F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93
|
||||
F src/select.c 9263f5c30dd44c7ac2eb29f40a7ec64322a96885b71c00de6bc30b756c2e1c49
|
||||
F src/shell.c.in 9c166e417a0e1d0fb7c5fa620782532c43fa16a0b82eae7d333835921a09a05d
|
||||
F src/sqlite.h.in e33a4df7e32d742aac29623b38a1edd7e07a2b964a5d0257e2923c8a724faddc
|
||||
F src/shell.c.in 35d0257ce46802f5ff2d45348bd98dd29049d9c73f22a92b8d42e36782c40cde
|
||||
F src/sqlite.h.in 633ca2147938402fe43118db929a7949dde3e2a08c138e40bbdec12a0e696129
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 960f1b86c3610fa23cb6a267572a97dcf286e77aa0dd3b9b23292ffaa1ea8683
|
||||
F src/sqliteInt.h f253c4ec15e577a293a462e5049f8ea1d0c7a31819b3a88acdd24698df8f4d0b
|
||||
@@ -1807,7 +1807,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P bcbe7d96df3c9515f679ccf671ca9ba89d081b53501495d4218eb5126196838b
|
||||
R 580d6045ffcb634a37d2e3422a64f696
|
||||
P 8c80b004cae71aaf820a31dba80c100ed162ef5bae845fb4535ff4d3be407500
|
||||
R 598d7ef91d996641cc357a2717b6bdf3
|
||||
U drh
|
||||
Z 78a18c60a5526d089ec0db954a2cdcb4
|
||||
Z 3d6b3a6f8d55ba274c391f3538973f56
|
||||
|
@@ -1 +1 @@
|
||||
8c80b004cae71aaf820a31dba80c100ed162ef5bae845fb4535ff4d3be407500
|
||||
24ef3844692debc2db7b1d427f5dcf4050481a8c7f71c3b516766b819ecab587
|
@@ -3154,6 +3154,7 @@ void sqlite3CreateIndex(
|
||||
assert( pParse->nErr==0 );
|
||||
if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0
|
||||
&& db->init.busy==0
|
||||
&& pTblName!=0
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
&& sqlite3UserAuthTable(pTab->zName)==0
|
||||
#endif
|
||||
|
@@ -843,6 +843,8 @@ int sqlite3_db_config(sqlite3 *db, int op, ...){
|
||||
{ SQLITE_DBCONFIG_TRIGGER_EQP, SQLITE_TriggerEQP },
|
||||
{ SQLITE_DBCONFIG_RESET_DATABASE, SQLITE_ResetDatabase },
|
||||
{ SQLITE_DBCONFIG_DEFENSIVE, SQLITE_Defensive },
|
||||
{ SQLITE_DBCONFIG_WRITABLE_SCHEMA, SQLITE_WriteSchema|
|
||||
SQLITE_NoSchemaError },
|
||||
};
|
||||
unsigned int i;
|
||||
rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
|
||||
|
@@ -2748,16 +2748,20 @@ static void restore_debug_trace_modes(void){
|
||||
}
|
||||
|
||||
/* Name of the TEMP table that holds bind parameter values */
|
||||
#define BIND_PARAM_TABLE "$Parameters"
|
||||
#define BIND_PARAM_TABLE "sqlite_parameters"
|
||||
|
||||
/* Create the TEMP table used to store parameter bindings */
|
||||
static void bind_table_init(ShellState *p){
|
||||
int wrSchema = 0;
|
||||
sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema);
|
||||
sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0);
|
||||
sqlite3_exec(p->db,
|
||||
"CREATE TABLE IF NOT EXISTS temp.[" BIND_PARAM_TABLE "](\n"
|
||||
"CREATE TABLE IF NOT EXISTS temp." BIND_PARAM_TABLE "(\n"
|
||||
" key TEXT PRIMARY KEY,\n"
|
||||
" value ANY\n"
|
||||
") WITHOUT ROWID;",
|
||||
0, 0, 0);
|
||||
sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2785,7 +2789,7 @@ static void bind_prepared_stmt(ShellState *pArg, sqlite3_stmt *pStmt){
|
||||
return; /* Parameter table does not exist */
|
||||
}
|
||||
rc = sqlite3_prepare_v2(pArg->db,
|
||||
"SELECT value FROM temp.\"" BIND_PARAM_TABLE "\""
|
||||
"SELECT value FROM temp." BIND_PARAM_TABLE
|
||||
" WHERE key=?1", -1, &pQ, 0);
|
||||
if( rc || pQ==0 ) return;
|
||||
for(i=1; i<=nVar; i++){
|
||||
@@ -7142,8 +7146,12 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
** Clear all bind parameters by dropping the TEMP table that holds them.
|
||||
*/
|
||||
if( nArg==2 && strcmp(azArg[1],"clear")==0 ){
|
||||
sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp.[" BIND_PARAM_TABLE "];",
|
||||
int wrSchema = 0;
|
||||
sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema);
|
||||
sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0);
|
||||
sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp." BIND_PARAM_TABLE ";",
|
||||
0, 0, 0);
|
||||
sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0);
|
||||
}else
|
||||
|
||||
/* .parameter list
|
||||
@@ -7155,7 +7163,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
int len = 0;
|
||||
rx = sqlite3_prepare_v2(p->db,
|
||||
"SELECT max(length(key)) "
|
||||
"FROM temp.[" BIND_PARAM_TABLE "];", -1, &pStmt, 0);
|
||||
"FROM temp." BIND_PARAM_TABLE ";", -1, &pStmt, 0);
|
||||
if( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
|
||||
len = sqlite3_column_int(pStmt, 0);
|
||||
if( len>40 ) len = 40;
|
||||
@@ -7165,7 +7173,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
if( len ){
|
||||
rx = sqlite3_prepare_v2(p->db,
|
||||
"SELECT key, quote(value) "
|
||||
"FROM temp.[" BIND_PARAM_TABLE "];", -1, &pStmt, 0);
|
||||
"FROM temp." BIND_PARAM_TABLE ";", -1, &pStmt, 0);
|
||||
while( sqlite3_step(pStmt)==SQLITE_ROW ){
|
||||
utf8_printf(p->out, "%-*s %s\n", len, sqlite3_column_text(pStmt,0),
|
||||
sqlite3_column_text(pStmt,1));
|
||||
@@ -7196,7 +7204,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
const char *zValue = azArg[3];
|
||||
bind_table_init(p);
|
||||
zSql = sqlite3_mprintf(
|
||||
"REPLACE INTO temp.[" BIND_PARAM_TABLE "](key,value)"
|
||||
"REPLACE INTO temp." BIND_PARAM_TABLE "(key,value)"
|
||||
"VALUES(%Q,%s);", zKey, zValue);
|
||||
if( zSql==0 ) shell_out_of_memory();
|
||||
pStmt = 0;
|
||||
@@ -7206,7 +7214,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
sqlite3_finalize(pStmt);
|
||||
pStmt = 0;
|
||||
zSql = sqlite3_mprintf(
|
||||
"REPLACE INTO temp.[" BIND_PARAM_TABLE "](key,value)"
|
||||
"REPLACE INTO temp." BIND_PARAM_TABLE "(key,value)"
|
||||
"VALUES(%Q,%Q);", zKey, zValue);
|
||||
if( zSql==0 ) shell_out_of_memory();
|
||||
rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
|
||||
@@ -7228,7 +7236,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
*/
|
||||
if( nArg==3 && strcmp(azArg[1],"unset")==0 ){
|
||||
char *zSql = sqlite3_mprintf(
|
||||
"DELETE FROM temp.[" BIND_PARAM_TABLE "] WHERE key=%Q", azArg[2]);
|
||||
"DELETE FROM temp." BIND_PARAM_TABLE " WHERE key=%Q", azArg[2]);
|
||||
if( zSql==0 ) shell_out_of_memory();
|
||||
sqlite3_exec(p->db, zSql, 0, 0, 0);
|
||||
sqlite3_free(zSql);
|
||||
|
@@ -2199,6 +2199,17 @@ struct sqlite3_mem_methods {
|
||||
** <li> Direct writes to [shadow tables].
|
||||
** </ul>
|
||||
** </dd>
|
||||
**
|
||||
** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt>
|
||||
** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the
|
||||
** "writable_schema" flag. This has the same effect and is logically equivalent
|
||||
** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF].
|
||||
** The first argument to this setting is an integer which is 0 to disable
|
||||
** the writable_schema, positive to enable writable_schema, or negative to
|
||||
** leave the setting unchanged. The second parameter is a pointer to an
|
||||
** integer into which is written 0 or 1 to indicate whether the writable_schema
|
||||
** is enabled or disabled following this call.
|
||||
** </dd>
|
||||
** </dl>
|
||||
*/
|
||||
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
|
||||
@@ -2212,7 +2223,8 @@ struct sqlite3_mem_methods {
|
||||
#define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */
|
||||
#define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */
|
||||
#define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */
|
||||
#define SQLITE_DBCONFIG_MAX 1010 /* Largest DBCONFIG */
|
||||
#define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */
|
||||
#define SQLITE_DBCONFIG_MAX 1011 /* Largest DBCONFIG */
|
||||
|
||||
/*
|
||||
** CAPI3REF: Enable Or Disable Extended Result Codes
|
||||
|
Reference in New Issue
Block a user