]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
In the CLI, code the "sqlite_parameters" name directly rather than using a
authordrh <drh@noemail.net>
Mon, 25 Mar 2019 21:56:26 +0000 (21:56 +0000)
committerdrh <drh@noemail.net>
Mon, 25 Mar 2019 21:56:26 +0000 (21:56 +0000)
macro, for clarity of presentation for users who are reading the code for
the purpose of seeing how the CLI implements parameter binding.

FossilOrigin-Name: e775ef002dd33e6bcbeec8d4b6ad7f59749e35548c7a59c9fa3bcfdc5cc50730

manifest
manifest.uuid
src/shell.c.in

index 1425817b7b89880ac0cea390a54706270d2f220d..1fd9eabdbbbf293b70536a3148b098d4f0fe6916 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sa\stest\sfrom\sthe\sindex\sbuild\slogic\swhich\sis\sno\slonger\sneeded\sand\sis\nin\sfact\sunreachable.
-D 2019-03-25T21:55:44.004
+C In\sthe\sCLI,\scode\sthe\s"sqlite_parameters"\sname\sdirectly\srather\sthan\susing\sa\nmacro,\sfor\sclarity\sof\spresentation\sfor\susers\swho\sare\sreading\sthe\scode\sfor\nthe\spurpose\sof\sseeing\show\sthe\sCLI\simplements\sparameter\sbinding.
+D 2019-03-25T21:56:26.925
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -517,7 +517,7 @@ 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 35d0257ce46802f5ff2d45348bd98dd29049d9c73f22a92b8d42e36782c40cde
+F src/shell.c.in 3e95f0e257b9a207bac47e0ff912d6e50e182620865138f6d9f712e74372e908
 F src/sqlite.h.in 633ca2147938402fe43118db929a7949dde3e2a08c138e40bbdec12a0e696129
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 960f1b86c3610fa23cb6a267572a97dcf286e77aa0dd3b9b23292ffaa1ea8683
@@ -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 24ef3844692debc2db7b1d427f5dcf4050481a8c7f71c3b516766b819ecab587
-R 75db24fb7326935aad62d0550ceb9756
+P 9b20ee10ff86c1f79706180310e02b6f78863e02b179062d8966573ae33a252f
+R fc08f90b52312e7678ef093fd93bc971
 U drh
-Z 5b47104ca3efed6ea8072ae7494788c8
+Z 90e0f30b43ce42e42738324291f51f22
index e3c0b349aa73466a8b11b7bb679da4b6c6d989f7..91e1ddd35e0014b3c755ca93ec406e1f9f21b749 100644 (file)
@@ -1 +1 @@
-9b20ee10ff86c1f79706180310e02b6f78863e02b179062d8966573ae33a252f
\ No newline at end of file
+e775ef002dd33e6bcbeec8d4b6ad7f59749e35548c7a59c9fa3bcfdc5cc50730
\ No newline at end of file
index c086e4b3cc9e348ebcfa9aaca9568950953be7a9..2d28550d183965283a141831b61531a88e42180a 100644 (file)
@@ -2747,16 +2747,13 @@ static void restore_debug_trace_modes(void){
 #endif
 }
 
-/* Name of the TEMP table that holds bind parameter values */
-#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.sqlite_parameters(\n"
     "  key TEXT PRIMARY KEY,\n"
     "  value ANY\n"
     ") WITHOUT ROWID;",
@@ -2784,12 +2781,12 @@ static void bind_prepared_stmt(ShellState *pArg, sqlite3_stmt *pStmt){
 
   nVar = sqlite3_bind_parameter_count(pStmt);
   if( nVar==0 ) return;  /* Nothing to do */
-  if( sqlite3_table_column_metadata(pArg->db, "TEMP", BIND_PARAM_TABLE,
+  if( sqlite3_table_column_metadata(pArg->db, "TEMP", "sqlite_parameters",
                                     "key", 0, 0, 0, 0, 0)!=SQLITE_OK ){
     return; /* Parameter table does not exist */
   }
   rc = sqlite3_prepare_v2(pArg->db,
-          "SELECT value FROM temp." BIND_PARAM_TABLE
+          "SELECT value FROM temp.sqlite_parameters"
           " WHERE key=?1", -1, &pQ, 0);
   if( rc || pQ==0 ) return;
   for(i=1; i<=nVar; i++){
@@ -7149,7 +7146,7 @@ static int do_meta_command(char *zLine, 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, "DROP TABLE IF EXISTS temp." BIND_PARAM_TABLE ";",
+      sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp.sqlite_parameters;",
                    0, 0, 0);
       sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0);
     }else
@@ -7163,7 +7160,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.sqlite_parameters;", -1, &pStmt, 0);
       if( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
         len = sqlite3_column_int(pStmt, 0);
         if( len>40 ) len = 40;
@@ -7173,7 +7170,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.sqlite_parameters;", -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));
@@ -7204,7 +7201,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.sqlite_parameters(key,value)"
                   "VALUES(%Q,%s);", zKey, zValue);
       if( zSql==0 ) shell_out_of_memory();
       pStmt = 0;
@@ -7214,7 +7211,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.sqlite_parameters(key,value)"
                    "VALUES(%Q,%Q);", zKey, zValue);
         if( zSql==0 ) shell_out_of_memory();
         rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
@@ -7236,7 +7233,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.sqlite_parameters WHERE key=%Q", azArg[2]);
       if( zSql==0 ) shell_out_of_memory();
       sqlite3_exec(p->db, zSql, 0, 0, 0);
       sqlite3_free(zSql);