]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
ALTER TABLE uses double-quotes for quoting table names. (CVS 4781)
authordrh <drh@noemail.net>
Sat, 9 Feb 2008 14:30:29 +0000 (14:30 +0000)
committerdrh <drh@noemail.net>
Sat, 9 Feb 2008 14:30:29 +0000 (14:30 +0000)
FossilOrigin-Name: 607247c27b80520b8c25c489757288b8ea186f9e

manifest
manifest.uuid
src/alter.c
test/alter.test

index 8c848b286f03ff7c0b7849fc7ac1d4a0a8909188..2fb030f0288f852250a3ce52f5171d8677f2ce51 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Modify\sshared.test\sto\sdo\scase\sindependent\scomparison\sof\sfilenames.\sTo\saccount\sfor\sthe\sfact\sthat\s"c:/test.db"\sand\s"C:/test.db"\sare\sthe\ssame\sfile.\s(CVS\s4780)
-D 2008-02-08T18:25:48
+C ALTER\sTABLE\suses\sdouble-quotes\sfor\squoting\stable\snames.\s(CVS\s4781)
+D 2008-02-09T14:30:30
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in bc2b5df3e3d0d4b801b824b7ef6dec43812b049b
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -78,7 +78,7 @@ F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2
 F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
 F sqlite3.def a96c1d0d39362b763d2ddba220a32da41a15c4b4
 F sqlite3.pc.in abed4664817e1cd500f2276142c71958087c16bc
-F src/alter.c 8a34c900811eec29725ab08ad46cc9dcec714867
+F src/alter.c b494a50f239a760565ce6220ee316e96956ec054
 F src/analyze.c a78ac494668581fe7f54ee63700815bb0ea34261
 F src/attach.c 90665c7ef5145e066570f66d7f0f15cdd0a4d14b
 F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
@@ -183,7 +183,7 @@ F src/where.c 7ff0ca021cc77086e367ed3b6308fbc6bc9e1a31
 F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/all.test d12210212bada2bde6d5aeb90969b86c1aa977d2
-F test/alter.test 345648dcd1801cc0287cd996076db512d1dcdabe
+F test/alter.test 1426bb4c8609731622a9bf9dd48c39f5931c4d7d
 F test/alter2.test 9d9850064b5c572991ea744a88ea650045f4ac6a
 F test/alter3.test 8ce6b9c5605b3cfe7b901f454ecaf174c4f93e31
 F test/altermalloc.test 29d4a8400277efb4ba8ffe90804c6dc2fdfbf063
@@ -616,7 +616,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P f37e8637d234e50436760497f8001c33975510ce
-R 625c28c9a32cbf3ec6251a314e035925
-U danielk1977
-Z 8ca2b45ed3bcd38aecc15ea7fe4278e2
+P 63915b54cfb41c2361c387636aa904145b166411
+R 4cb42b2925ae8f45e9151c56cf51f1f9
+U drh
+Z 3b52650fd58593f0d3eb3e17a3cd9c37
index d0cc3b615559870587a98fe2a52abe498a7c7082..f933e51e672aa567599e6812ddc2af8476b16759 100644 (file)
@@ -1 +1 @@
-63915b54cfb41c2361c387636aa904145b166411
\ No newline at end of file
+607247c27b80520b8c25c489757288b8ea186f9e
\ No newline at end of file
index 63b0bd7d0a309816f04444ee97356e5efbc46239..1a43370d567f125206ea50c2851afe3c65553317 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that used to generate VDBE code
 ** that implements the ALTER TABLE command.
 **
-** $Id: alter.c,v 1.41 2008/01/25 15:04:48 drh Exp $
+** $Id: alter.c,v 1.42 2008/02/09 14:30:30 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -78,7 +78,7 @@ static void renameTableFunc(
       assert( len>0 );
     } while( token!=TK_LP && token!=TK_USING );
 
-    zRet = sqlite3MPrintf(db, "%.*s%Q%s", tname.z - zSql, zSql, 
+    zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", tname.z - zSql, zSql, 
        zTableName, tname.z+tname.n);
     sqlite3_result_text(context, zRet, -1, sqlite3_free);
   }
@@ -153,7 +153,7 @@ static void renameTriggerFunc(
     /* Variable tname now contains the token that is the old table-name
     ** in the CREATE TRIGGER statement.
     */
-    zRet = sqlite3MPrintf(db, "%.*s%Q%s", tname.z - zSql, zSql, 
+    zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", tname.z - zSql, zSql, 
        zTableName, tname.z+tname.n);
     sqlite3_result_text(context, zRet, -1, sqlite3_free);
   }
@@ -403,7 +403,7 @@ void sqlite3AlterRenameTable(
   */
   if( sqlite3FindTable(db, "sqlite_sequence", zDb) ){
     sqlite3NestedParse(pParse,
-        "UPDATE %Q.sqlite_sequence set name = %Q WHERE name = %Q",
+        "UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q",
         zDb, zName, pTab->zName);
   }
 #endif
@@ -522,7 +522,7 @@ void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){
       *zEnd-- = '\0';
     }
     sqlite3NestedParse(pParse, 
-        "UPDATE %Q.%s SET "
+        "UPDATE \"%w\".%s SET "
           "sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) "
         "WHERE type = 'table' AND name = %Q", 
       zDb, SCHEMA_TABLE(iDb), pNew->addColOffset, zCol, pNew->addColOffset+1,
index 60ce6050abce7802655a28071255ba1e5326bb11..d838503e272b7b73c7fe476e6a32db86931e6645 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this script is testing the ALTER TABLE statement.
 #
-# $Id: alter.test,v 1.28 2007/12/13 08:15:31 danielk1977 Exp $
+# $Id: alter.test,v 1.29 2008/02/09 14:30:30 drh Exp $
 #
 
 set testdir [file dirname $argv0]
@@ -596,7 +596,7 @@ do_test alter-6.3 {
   execsql "
     SELECT sql FROM sqlite_master WHERE oid = $::oid
   "
-} "{CREATE TABLE '${::tbl_name2}'(a, b, c)}"
+} "{CREATE TABLE \"${::tbl_name2}\"(a, b, c)}"
 do_test alter-6.4 {
   execsql "
     ALTER TABLE $::tbl_name2 RENAME TO $::tbl_name
@@ -604,7 +604,7 @@ do_test alter-6.4 {
   execsql "
     SELECT sql FROM sqlite_master WHERE oid = $::oid
   "
-} "{CREATE TABLE '${::tbl_name}'(a, b, c)}"
+} "{CREATE TABLE \"${::tbl_name}\"(a, b, c)}"
 set ::col_name ghi\1234\jkl
 do_test alter-6.5 {
   execsql "
@@ -613,7 +613,7 @@ do_test alter-6.5 {
   execsql "
     SELECT sql FROM sqlite_master WHERE oid = $::oid
   "
-} "{CREATE TABLE '${::tbl_name}'(a, b, c, $::col_name VARCHAR)}"
+} "{CREATE TABLE \"${::tbl_name}\"(a, b, c, $::col_name VARCHAR)}"
 set ::col_name2 B\3421\A
 do_test alter-6.6 {
   db close
@@ -624,7 +624,7 @@ do_test alter-6.6 {
   execsql "
     SELECT sql FROM sqlite_master WHERE oid = $::oid
   "
-} "{CREATE TABLE '${::tbl_name}'(a, b, c, $::col_name VARCHAR, $::col_name2)}"
+} "{CREATE TABLE \"${::tbl_name}\"(a, b, c, $::col_name VARCHAR, $::col_name2)}"
 do_test alter-6.7 {
   execsql "
     INSERT INTO ${::tbl_name} VALUES(1, 2, 3, 4, 5);