From 30629571f60eb84af3b69932976b6fb2d4571782 Mon Sep 17 00:00:00 2001 From: danielk1977 Date: Mon, 13 Oct 2008 10:56:48 +0000 Subject: [PATCH] Use one less temporary table in genfkey.c. The retired table was being used to workaround the bug fixed by (5812). (CVS 5813) FossilOrigin-Name: 73efca985a05930df761b42886a3ba1c5199f32a --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/genfkey.c | 13 ++++++------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index b8b371cdda..b670766873 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C If\ssqlite3_column_value()\sis\scalled\sto\sobtain\sa\svalue\swith\sthe\sMEM_Static\sflag\sset,\sclear\sit\sand\sset\sthe\sMEM_Ephem\sflag\sbefore\sreturning.\sOtherwise,\sif\sthe\svalue\sis\spassed\sto\ssqlite3_bind_value()\sor\ssqlite3_result_value(),\ssqlite\smay\sattempt\sto\suse\sthe\sbuffer\safter\sthe\sstatement\shas\sbeen\sfinalized.\sThis\sis\snot\salways\svalid,\sas\sMEM_Static\sonly\sguarantees\sthat\sa\sMEM.z\sbuffer\swill\sbe\svalid\sfor\sthe\slifetime\sof\sthe\sowner\sstatement,\snot\sthat\sit\sis\sactually\sa\sstatic\sbuffer.\s(CVS\s5812) -D 2008-10-13T10:37:50 +C Use\sone\sless\stemporary\stable\sin\sgenfkey.c.\sThe\sretired\stable\swas\sbeing\sused\sto\sworkaround\sthe\sbug\sfixed\sby\s(5812).\s(CVS\s5813) +D 2008-10-13T10:56:48 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 2014e5a4010ad5ebbcaedff98240b3d14ee83838 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -623,7 +623,7 @@ F test/zeroblob.test 792124852ec61458a2eb527b5091791215e0be95 F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439 F tool/genfkey.README d94b4423eef29e662898948f04a7dbe210c35e7a -F tool/genfkey.c 021979c7d2a58a230508b976095260a98c509cae +F tool/genfkey.c e1b9c93da828db10c1109c7b4fa611aec8adc407 F tool/genfkey.test 182829596fb15785b94b2493c5f735b847d91076 F tool/lemon.c 6cb39632ef3bfec2cea8f81b4d7f63c09fe12802 F tool/lempar.c 770dc64b74429daf9611676f43bfbd7c1bed0152 @@ -648,7 +648,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 500c50561fba88948aad21d1aef1e1e96ab8c3aa -R c4ea9493401c6b826e996873ceae56db +P b055bfc4e5268d8a66d6a4f5e8aec1285fe4b8e7 +R a7f9557fc9b70a138a1706f314cf9726 U danielk1977 -Z e0758c74c431a8022c7792359e9dbeb0 +Z 55e2fccdb1a78cce9b6aee3d77c5f37e diff --git a/manifest.uuid b/manifest.uuid index e6f3d3ea3d..8eb3704337 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b055bfc4e5268d8a66d6a4f5e8aec1285fe4b8e7 \ No newline at end of file +73efca985a05930df761b42886a3ba1c5199f32a \ No newline at end of file diff --git a/tool/genfkey.c b/tool/genfkey.c index 952c5b8c02..2cc047b2a8 100644 --- a/tool/genfkey.c +++ b/tool/genfkey.c @@ -12,7 +12,7 @@ ** This file contains C code for 'genfkey', a program to generate trigger ** definitions that emulate foreign keys. See genfkey.README for details. ** -** $Id: genfkey.c,v 1.1 2008/10/10 17:58:27 danielk1977 Exp $ +** $Id: genfkey.c,v 1.2 2008/10/13 10:56:48 danielk1977 Exp $ */ #include "sqlite3.h" @@ -585,8 +585,6 @@ static int populateTempTable(sqlite3 *db, char **pzErr, int *pHasErrors){ "CREATE TABLE temp.fkey AS " "SELECT from_tbl, to_tbl, fkid, from_col, to_col, on_update, on_delete " "FROM temp.v_fkey WHERE database = 'main';" - "CREATE TABLE temp.col AS " - "SELECT * FROM temp.v_col WHERE database = 'main';" , 0, 0, pzErr ); @@ -596,7 +594,7 @@ static int populateTempTable(sqlite3 *db, char **pzErr, int *pHasErrors){ "SELECT fkid, from_tbl " "FROM temp.fkey " "WHERE to_col IS NOT NULL AND NOT EXISTS (SELECT 1 " - "FROM temp.col WHERE tablename=to_tbl AND name==to_col" + "FROM temp.v_col WHERE tablename=to_tbl AND name==to_col" ")", pHasErrors ); if( rc!=SQLITE_OK ) return rc; @@ -629,7 +627,7 @@ static int populateTempTable(sqlite3 *db, char **pzErr, int *pHasErrors){ "SELECT fkid, from_tbl " "FROM temp.fkey " "WHERE to_col IS NULL AND NOT EXISTS " - "(SELECT 1 FROM temp.col WHERE pk AND tablename = temp.fkey.to_tbl)" + "(SELECT 1 FROM temp.v_col WHERE pk AND tablename = temp.fkey.to_tbl)" , pHasErrors ); if( rc!=SQLITE_OK ) return rc; @@ -637,7 +635,7 @@ static int populateTempTable(sqlite3 *db, char **pzErr, int *pHasErrors){ /* Fix all the implicit primary key mappings in the temp.fkey table. */ rc = sqlite3_exec(db, "UPDATE temp.fkey SET to_col = " - "(SELECT name FROM temp.col WHERE pk AND tablename=temp.fkey.to_tbl)" + "(SELECT name FROM temp.v_col WHERE pk AND tablename=temp.fkey.to_tbl)" " WHERE to_col IS NULL;" , 0, 0, pzErr ); @@ -653,7 +651,8 @@ static int populateTempTable(sqlite3 *db, char **pzErr, int *pHasErrors){ "ii.name AS col " "FROM temp.v_idxlist AS il, temp.v_idxinfo AS ii " "WHERE il.isunique AND il.database='main' AND ii.indexname = il.name;" - "INSERT INTO temp.idx2 SELECT tablename, 'pk', name FROM temp.col WHERE pk;" + "INSERT INTO temp.idx2 " + "SELECT tablename, 'pk', name FROM temp.v_col WHERE pk;" "CREATE TABLE temp.idx AS SELECT " "tablename, indexname, sj(dq(col),',') AS cols " -- 2.47.2