From bd26f925e08abeacd076c5d67c6ef7c01459f52d Mon Sep 17 00:00:00 2001 From: danielk1977 Date: Sat, 29 May 2004 10:43:06 +0000 Subject: [PATCH] Ensure vacuum handles table names with spaces in them. (CVS 1491) FossilOrigin-Name: 0a6689be843e695902fbfef863f128915545499e --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/vacuum.c | 6 +++--- test/vacuum.test | 30 +++++++++++++++++++++++++++++- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 2480b3a022..e0c7eec100 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\svacuum\sso\sthat\sit\sworks\swith\sblobs.\s(CVS\s1490) -D 2004-05-29T10:23:19 +C Ensure\svacuum\shandles\stable\snames\swith\sspaces\sin\sthem.\s(CVS\s1491) +D 2004-05-29T10:43:07 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -68,7 +68,7 @@ F src/trigger.c 6a0751fd7d3d723f414ac1f877f16b1c0ba4722b F src/update.c 96461bcf4e946697e83c09c77c7e61b545a2f66e F src/utf.c f8604999a54483533ac20a63879074f01b0df384 F src/util.c 4df9d9b0d930d81ec581bcb68748e7c48bdc8c7d -F src/vacuum.c 53539c1d1f25b329c5f3c880f7b4427bef73183d +F src/vacuum.c 82ce1fc8ecc2e1aa284c13fe38446709f9936c63 F src/vdbe.c ea010d63dfdf84b7d23781144fe2cd11add2c1bd F src/vdbe.h e73f890e0f2a6c42b183d7d6937947930fe4fdeb F src/vdbeInt.h c2bcd6e5a6e6a3753e4c5a368629c3a625719bfc @@ -159,7 +159,7 @@ F test/types.test 6c49e574970866558365a025b44c9fd8a162ef0d F test/types2.test 5d725fcb68dbd032c6d4950d568d75fa33872687 F test/unique.test 0e38d4cc7affeef2527720d1dafd1f6870f02f2b F test/update.test b29bd9061a1150426dab6959806fcc73a41b1217 -F test/vacuum.test d1f1e033307740bf2bc7c51b43d2ccffbfe3548c +F test/vacuum.test c11b73769bf1d6d607acf0227c3ce925dd20e41d F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 F test/version.test 2ba212ba06380e65e476bdf2fcd390e8b05af5a0 F test/view.test 1ee12c6f8f4791a2c0655120d5562a49400cfe53 @@ -204,7 +204,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 3d68703e2e4e793012cb3c13a6744e915475e006 -R f8accc05ba8c9231b807adb94db50997 +P 4feb4b9a71ce7a92924d2358a7ccecb4cca19223 +R 1c8a97ac5a9accf91dcf49ffc08fac99 U danielk1977 -Z ed82235366e6cbf4a32cc9a53171200e +Z a1f2191b7711706a5263dea1c2c73086 diff --git a/manifest.uuid b/manifest.uuid index 288ffc76db..4fbca860fd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4feb4b9a71ce7a92924d2358a7ccecb4cca19223 \ No newline at end of file +0a6689be843e695902fbfef863f128915545499e \ No newline at end of file diff --git a/src/vacuum.c b/src/vacuum.c index fcbfface7e..be47ee9381 100644 --- a/src/vacuum.c +++ b/src/vacuum.c @@ -14,7 +14,7 @@ ** Most of the code in this file may be omitted by defining the ** SQLITE_OMIT_VACUUM macro. ** -** $Id: vacuum.c,v 1.17 2004/05/29 10:23:20 danielk1977 Exp $ +** $Id: vacuum.c,v 1.18 2004/05/29 10:43:07 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -160,8 +160,8 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite *db){ ** the contents to the temporary database. */ rc = execExecSql(db, - "SELECT 'INSERT INTO vacuum_db.' || name " - "|| ' SELECT * FROM ' || name || ';'" + "SELECT 'INSERT INTO vacuum_db.' || quote(name) " + "|| ' SELECT * FROM ' || quote(name) || ';'" "FROM sqlite_master " "WHERE type = 'table';" ); diff --git a/test/vacuum.test b/test/vacuum.test index 8f70303f54..b3877c2caf 100644 --- a/test/vacuum.test +++ b/test/vacuum.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the VACUUM statement. # -# $Id: vacuum.test,v 1.19 2004/05/29 10:23:20 danielk1977 Exp $ +# $Id: vacuum.test,v 1.20 2004/05/29 10:43:07 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -172,4 +172,32 @@ do_test vacuum-5.2 { } } {0 {}} +# Ensure vacuum works with complicated tables names. +do_test vacuum-6.1 { + execsql { + CREATE TABLE "abc abc"(a, b, c); + INSERT INTO "abc abc" VALUES(1, 2, 3); + VACUUM; + } +} {} +do_test vacuum-6.2 { + execsql { + select * from "abc abc"; + } +} {1 2 3} + +# Also ensure that blobs survive a vacuum. +do_test vacuum-6.3 { + execsql { + DELETE FROM "abc abc"; + INSERT INTO "abc abc" VALUES(X'00112233', NULL, NULL); + VACUUM; + } +} {} +do_test vacuum-6.4 { + execsql { + select count(*) from "abc abc" WHERE a = X'00112233'; + } +} {1} + # finish_test