mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Changes to insure that lookaside memory allocations are never used to hold
schema content. Ticket #3743. (CVS 6377) FossilOrigin-Name: ea74d8dc62f5784089aa8ef098e97c505a79b176
This commit is contained in:
46
manifest
46
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Add\sa\scomment\sto\sprepare.c\sexplaining\swhy\sthe\slookaside\sbuffer\sis\sdisabled\sbefore\ssqlite3_exec()\sis\scalled\sto\sparse\sa\sschema\sstatement.\sNo\scode\schanges.\s(CVS\s6376)
|
C Changes\sto\sinsure\sthat\slookaside\smemory\sallocations\sare\snever\sused\sto\shold\r\nschema\scontent.\r\nTicket\s#3743.\s(CVS\s6377)
|
||||||
D 2009-03-24T04:46:08
|
D 2009-03-24T15:08:10
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
|
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -96,7 +96,7 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
|
|||||||
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
|
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
|
||||||
F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
|
F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
|
||||||
F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad
|
F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad
|
||||||
F src/alter.c b95815ccc92477b1b5874fb0fe20f65c867e9cc8
|
F src/alter.c 472c0a4733de40f1d997ff4fd746042b707faf7b
|
||||||
F src/analyze.c 3585d1a4c480ee85b65cf0a676e05d2c29eb6bdb
|
F src/analyze.c 3585d1a4c480ee85b65cf0a676e05d2c29eb6bdb
|
||||||
F src/attach.c d34589d5c85d81e755e4a8fc946d313915a6fa6d
|
F src/attach.c d34589d5c85d81e755e4a8fc946d313915a6fa6d
|
||||||
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
|
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
|
||||||
@@ -106,12 +106,12 @@ F src/btmutex.c 341502bc496dc0840dcb00cde65680fb0e85c3ab
|
|||||||
F src/btree.c 1a709b6aac17e520de49b6cbad5cc14000910d8b
|
F src/btree.c 1a709b6aac17e520de49b6cbad5cc14000910d8b
|
||||||
F src/btree.h e302c5747494067cd4f5763000fbe7bca767d816
|
F src/btree.h e302c5747494067cd4f5763000fbe7bca767d816
|
||||||
F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5
|
F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5
|
||||||
F src/build.c f217f9ce2528c5b968f77a11998948466ea81bc9
|
F src/build.c be2bdaf2a3f6b24ef08dc14b9fd33aa84c689908
|
||||||
F src/callback.c 09c6fedc77a45db99ba25a75d61382830314b357
|
F src/callback.c 73016376d6848ba987709e8c9048d4f0e0776036
|
||||||
F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
|
F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
|
||||||
F src/date.c 0d804df3bbda46329946a01ff5c75c3f4f135218
|
F src/date.c 0d804df3bbda46329946a01ff5c75c3f4f135218
|
||||||
F src/delete.c eb1066b2f35489fee46ad765d2b66386fc7d8adf
|
F src/delete.c eb1066b2f35489fee46ad765d2b66386fc7d8adf
|
||||||
F src/expr.c ca5d176acc69497401cc5c376a91f785159b83a4
|
F src/expr.c 614a60615fd4bd186459c0c1fa87fdefedb76c26
|
||||||
F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff
|
F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff
|
||||||
F src/func.c de2eed7d96365210faecda877c5a12cf440bdf42
|
F src/func.c de2eed7d96365210faecda877c5a12cf440bdf42
|
||||||
F src/global.c 448419c44ce0701104c2121b0e06919b44514c0c
|
F src/global.c 448419c44ce0701104c2121b0e06919b44514c0c
|
||||||
@@ -123,7 +123,7 @@ F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0
|
|||||||
F src/legacy.c 2ad5b52df322d0f132f66817095e0e79c8942611
|
F src/legacy.c 2ad5b52df322d0f132f66817095e0e79c8942611
|
||||||
F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc
|
F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc
|
||||||
F src/main.c 95e13cd23b7a88e33c1acfe233c748fd9dd7e467
|
F src/main.c 95e13cd23b7a88e33c1acfe233c748fd9dd7e467
|
||||||
F src/malloc.c 1d862da7eb382d4b79b55436b04278fedec288e7
|
F src/malloc.c a1f0f8ae110abb8eb546e259ab0eaea7e0f9b588
|
||||||
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
|
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
|
||||||
F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
|
F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
|
||||||
F src/mem2.c d02bd6a5b34f2d59012a852615621939d9c09548
|
F src/mem2.c d02bd6a5b34f2d59012a852615621939d9c09548
|
||||||
@@ -145,25 +145,25 @@ F src/os_unix.c a20fe61c025117452c003ae4cafd05c3e610b616
|
|||||||
F src/os_win.c 40636702058ed4dcd35d68151bfab56d4997cdc1
|
F src/os_win.c 40636702058ed4dcd35d68151bfab56d4997cdc1
|
||||||
F src/pager.c da7ffd068347cdc88b477875585d53dcf2bdc4a7
|
F src/pager.c da7ffd068347cdc88b477875585d53dcf2bdc4a7
|
||||||
F src/pager.h 0c9f3520c00d8a3b8e792ca56c9a11b6b02b4b0f
|
F src/pager.h 0c9f3520c00d8a3b8e792ca56c9a11b6b02b4b0f
|
||||||
F src/parse.y 30ae25cd9ce8002527fca3011052a7fba0aff349
|
F src/parse.y b9ba0946a13e9f32a96044e64a3e8780269b08b0
|
||||||
F src/pcache.c fcf7738c83c4d3e9d45836b2334c8a368cc41274
|
F src/pcache.c fcf7738c83c4d3e9d45836b2334c8a368cc41274
|
||||||
F src/pcache.h 9b927ccc5a538e31b4c3bc7eec4f976db42a1324
|
F src/pcache.h 9b927ccc5a538e31b4c3bc7eec4f976db42a1324
|
||||||
F src/pcache1.c f587565f4ba0fd1772067eaa96814dce761b7a4c
|
F src/pcache1.c f587565f4ba0fd1772067eaa96814dce761b7a4c
|
||||||
F src/pragma.c 22ed04836aab8ce134c53be1ca896f3ad20fabdb
|
F src/pragma.c 22ed04836aab8ce134c53be1ca896f3ad20fabdb
|
||||||
F src/prepare.c 662b7d30574558822ca6f0621cbb7aef7e87cee3
|
F src/prepare.c 157a7528ba686964ab0e0687749ca30adb9ab614
|
||||||
F src/printf.c 9866a9a9c4a90f6d4147407f373df3fd5d5f9b6f
|
F src/printf.c 9866a9a9c4a90f6d4147407f373df3fd5d5f9b6f
|
||||||
F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628
|
F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628
|
||||||
F src/resolve.c 094e44450371fb27869eb8bf679aacbe51fdc56d
|
F src/resolve.c 094e44450371fb27869eb8bf679aacbe51fdc56d
|
||||||
F src/rowset.c ba9375f37053d422dd76965a9c370a13b6e1aac4
|
F src/rowset.c ba9375f37053d422dd76965a9c370a13b6e1aac4
|
||||||
F src/select.c 4d0b77fd76ff80f09a798ee98953e344c9de8fbb
|
F src/select.c 607e5b2d3be379781e5be3ac0854f5c237152d26
|
||||||
F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7
|
F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7
|
||||||
F src/sqlite.h.in 0db1e59d89aeacb8fe64a19fd14c13a796060ccb
|
F src/sqlite.h.in 0db1e59d89aeacb8fe64a19fd14c13a796060ccb
|
||||||
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
|
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
|
||||||
F src/sqliteInt.h b6858d742b30d556886cca16437fb0a4aad2e065
|
F src/sqliteInt.h ddaadadd35b07e468b0a07a5575c796a71e89dc1
|
||||||
F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d
|
F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d
|
||||||
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
|
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
|
||||||
F src/table.c 332ab0ea691e63862e2a8bdfe2c0617ee61062a3
|
F src/table.c 332ab0ea691e63862e2a8bdfe2c0617ee61062a3
|
||||||
F src/tclsqlite.c 8a472804b901d4559213eeda538c2eadb2ad7f2a
|
F src/tclsqlite.c 3d64c59fa441c4b6d550cb97b03c91693b87bbd1
|
||||||
F src/test1.c 17300af44640eea439778f5b5e03e0d68a6f00a2
|
F src/test1.c 17300af44640eea439778f5b5e03e0d68a6f00a2
|
||||||
F src/test2.c 71c22e2974f8094fe0fd1eba8f27872dde9b2a39
|
F src/test2.c 71c22e2974f8094fe0fd1eba8f27872dde9b2a39
|
||||||
F src/test3.c d3115b301c6ee761b102f315fe24125f3d6c3a4d
|
F src/test3.c d3115b301c6ee761b102f315fe24125f3d6c3a4d
|
||||||
@@ -194,7 +194,7 @@ F src/test_server.c f0a403b5f699c09bd2b1236b6f69830fd6221f6b
|
|||||||
F src/test_tclvar.c 9e42fa59d3d2f064b7ab8628e7ab2dc8a9fe93d4
|
F src/test_tclvar.c 9e42fa59d3d2f064b7ab8628e7ab2dc8a9fe93d4
|
||||||
F src/test_thread.c 1c7a895dbc469d87d22c1b36f269a6f799fc47a8
|
F src/test_thread.c 1c7a895dbc469d87d22c1b36f269a6f799fc47a8
|
||||||
F src/test_wsd.c 3ae5101de6cbfda2720152ab659ea84079719241
|
F src/test_wsd.c 3ae5101de6cbfda2720152ab659ea84079719241
|
||||||
F src/tokenize.c 6987fb7f0d6a87ac53499aee568cabb05eb4bea8
|
F src/tokenize.c fff72a9bc0af326583e5966daecebeb5ed9b9614
|
||||||
F src/trigger.c 21f39db410cdc32166a94900ac1b3df98ea560e6
|
F src/trigger.c 21f39db410cdc32166a94900ac1b3df98ea560e6
|
||||||
F src/update.c 8ededddcde6f7b6da981dd0429a5d34518a475b7
|
F src/update.c 8ededddcde6f7b6da981dd0429a5d34518a475b7
|
||||||
F src/utf.c 1da9c832dba0fa8f865b5b902d93f420a1ee4245
|
F src/utf.c 1da9c832dba0fa8f865b5b902d93f420a1ee4245
|
||||||
@@ -205,15 +205,15 @@ F src/vdbe.h d70a68bee196ab228914a3902c79dbd24342a0f2
|
|||||||
F src/vdbeInt.h 53a2f4696871712646c77351904576cca6ad9752
|
F src/vdbeInt.h 53a2f4696871712646c77351904576cca6ad9752
|
||||||
F src/vdbeapi.c 025d83f51f5e0a6e0fb55d603103d24825577967
|
F src/vdbeapi.c 025d83f51f5e0a6e0fb55d603103d24825577967
|
||||||
F src/vdbeaux.c be958dfe3a476ccb58dbc0d5786d58717f40f4b0
|
F src/vdbeaux.c be958dfe3a476ccb58dbc0d5786d58717f40f4b0
|
||||||
F src/vdbeblob.c 3408f5e1ab62627300b9c9c3168cff1de65e1658
|
F src/vdbeblob.c e67757450ae8581a8b354d9d7e467e41502dfe38
|
||||||
F src/vdbemem.c 38615b5d4b1b3b5a1221a5623578e5e3864e4888
|
F src/vdbemem.c 38615b5d4b1b3b5a1221a5623578e5e3864e4888
|
||||||
F src/vtab.c 18d671f0a45d0159088070bc6b219a3105034c87
|
F src/vtab.c f1aba5a6dc1f83b97a39fbbc58ff8cbc76311347
|
||||||
F src/walker.c 42bd3f00ca2ef5ae842304ec0d59903ef051412d
|
F src/walker.c 42bd3f00ca2ef5ae842304ec0d59903ef051412d
|
||||||
F src/where.c 55b13048fd0f82b330511e37766208b96fd764df
|
F src/where.c 55b13048fd0f82b330511e37766208b96fd764df
|
||||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||||
F test/alias.test 597662c5d777a122f9a3df0047ea5c5bd383a911
|
F test/alias.test 597662c5d777a122f9a3df0047ea5c5bd383a911
|
||||||
F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
|
F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
|
||||||
F test/alter.test 958b36b7e9752e8a4ed03ba34690b06e48b0e3e0
|
F test/alter.test 645b2e8d23c9936f9494af9d2fa7f8351a248c6e
|
||||||
F test/alter2.test dd55146e812622c8fc51fd2216bcd8dca8880752
|
F test/alter2.test dd55146e812622c8fc51fd2216bcd8dca8880752
|
||||||
F test/alter3.test 25b95a136708f22b87184fa6a4309eea03d65153
|
F test/alter3.test 25b95a136708f22b87184fa6a4309eea03d65153
|
||||||
F test/alter4.test 9386ffd1e9c7245f43eca412b2058d747509cc1f
|
F test/alter4.test 9386ffd1e9c7245f43eca412b2058d747509cc1f
|
||||||
@@ -261,7 +261,7 @@ F test/capi3b.test 664eb55318132f292f2c436f90906f578cad6b97
|
|||||||
F test/capi3c.test ce0fcbbaccfc9703fb247ea9ac5ada96dc9ca047
|
F test/capi3c.test ce0fcbbaccfc9703fb247ea9ac5ada96dc9ca047
|
||||||
F test/capi3d.test 57d83b690d7364bde02cddbf8339a4b50d80ce23
|
F test/capi3d.test 57d83b690d7364bde02cddbf8339a4b50d80ce23
|
||||||
F test/cast.test 166951664a0b0a2e0f8fb5997a152490c6363932
|
F test/cast.test 166951664a0b0a2e0f8fb5997a152490c6363932
|
||||||
F test/check.test 024ed399600b799160378cf9d9f436bdf5dfd184
|
F test/check.test 4f245970b4583555a349dceacdae7976222d834a
|
||||||
F test/collate1.test e3eaa48c21e150814be1a7b852d2a8af24458d04
|
F test/collate1.test e3eaa48c21e150814be1a7b852d2a8af24458d04
|
||||||
F test/collate2.test 04cebe4a033be319d6ddbb3bbc69464e01700b49
|
F test/collate2.test 04cebe4a033be319d6ddbb3bbc69464e01700b49
|
||||||
F test/collate3.test d28d2cfab2c3a3d4628ae4b2b7afc9965daa3b4c
|
F test/collate3.test d28d2cfab2c3a3d4628ae4b2b7afc9965daa3b4c
|
||||||
@@ -435,7 +435,7 @@ F test/lock3.test 8adfbf438b96316267611214d494ebc1311b8cda
|
|||||||
F test/lock4.test 991b57669a868bbfd39fe0c0df0d493985829105
|
F test/lock4.test 991b57669a868bbfd39fe0c0df0d493985829105
|
||||||
F test/lock5.test 6b1f78f09ad1522843dad571b76b321e6f439bf7
|
F test/lock5.test 6b1f78f09ad1522843dad571b76b321e6f439bf7
|
||||||
F test/lock6.test 862aa71e97b288d6b3f92ba3313f51bd0b003776
|
F test/lock6.test 862aa71e97b288d6b3f92ba3313f51bd0b003776
|
||||||
F test/lookaside.test e69f822f13745f1d5c445c6e30e30f059f30c8e5
|
F test/lookaside.test b3e928efeb9a31147bb72350462831e104ec2c1e
|
||||||
F test/main.test 187a9a1b5248ed74a83838c581c15ec6023b555b
|
F test/main.test 187a9a1b5248ed74a83838c581c15ec6023b555b
|
||||||
F test/make-where7.tcl 40bb740b37eead343eaf57b74ab72d2a5a304745
|
F test/make-where7.tcl 40bb740b37eead343eaf57b74ab72d2a5a304745
|
||||||
F test/malloc.test 7388109bccc42888ad4e2cb01b2169eb98d4d283
|
F test/malloc.test 7388109bccc42888ad4e2cb01b2169eb98d4d283
|
||||||
@@ -475,7 +475,7 @@ F test/misc5.test 6a5c1e3217a95b0db05ff9a0f1ecb5ce9043ffef
|
|||||||
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
|
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
|
||||||
F test/misc7.test debcd7dbfd847ae97b16ceb7fec6f567902874a6
|
F test/misc7.test debcd7dbfd847ae97b16ceb7fec6f567902874a6
|
||||||
F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33
|
F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33
|
||||||
F test/mutex1.test ace3ba551ef0cd864df2b820b5dbe18d28b4db6c
|
F test/mutex1.test ebd54720401fafe854799dc86b7bf60b75631935
|
||||||
F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
|
F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
|
||||||
F test/nan.test c627d79b3d36ea892563fd67584b3e8a18f0618a
|
F test/nan.test c627d79b3d36ea892563fd67584b3e8a18f0618a
|
||||||
F test/notify1.test 9a985a94f34de1b24daf25fd86b6d5033ba532d0
|
F test/notify1.test 9a985a94f34de1b24daf25fd86b6d5033ba532d0
|
||||||
@@ -709,7 +709,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
|||||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
P 7c2df04b52a40d5d1b744ad1097f7c12143d8c2c
|
P 8ca6a665650c9683a202f3ced17b14f7c85624bf
|
||||||
R 703f5e83ff72a6ceec997ed32c6b6e4e
|
R 8c93b31b69e1e1ff0ee86ef0261f4c0c
|
||||||
U danielk1977
|
U drh
|
||||||
Z 3f57c912d20fa971468a1ff4756c679d
|
Z 226c5008143d3b67d9a3ebdf1903227a
|
||||||
|
@@ -1 +1 @@
|
|||||||
8ca6a665650c9683a202f3ced17b14f7c85624bf
|
ea74d8dc62f5784089aa8ef098e97c505a79b176
|
@@ -12,7 +12,7 @@
|
|||||||
** This file contains C code routines that used to generate VDBE code
|
** This file contains C code routines that used to generate VDBE code
|
||||||
** that implements the ALTER TABLE command.
|
** that implements the ALTER TABLE command.
|
||||||
**
|
**
|
||||||
** $Id: alter.c,v 1.54 2009/02/28 10:47:42 danielk1977 Exp $
|
** $Id: alter.c,v 1.55 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){
|
|||||||
if( !pNew ) goto exit_begin_add_column;
|
if( !pNew ) goto exit_begin_add_column;
|
||||||
pParse->pNewTable = pNew;
|
pParse->pNewTable = pNew;
|
||||||
pNew->nRef = 1;
|
pNew->nRef = 1;
|
||||||
pNew->db = db;
|
pNew->dbMem = pTab->dbMem;
|
||||||
pNew->nCol = pTab->nCol;
|
pNew->nCol = pTab->nCol;
|
||||||
assert( pNew->nCol>0 );
|
assert( pNew->nCol>0 );
|
||||||
nAlloc = (((pNew->nCol-1)/8)*8)+8;
|
nAlloc = (((pNew->nCol-1)/8)*8)+8;
|
||||||
|
13
src/build.c
13
src/build.c
@@ -22,7 +22,7 @@
|
|||||||
** COMMIT
|
** COMMIT
|
||||||
** ROLLBACK
|
** ROLLBACK
|
||||||
**
|
**
|
||||||
** $Id: build.c,v 1.525 2009/03/21 16:19:26 drh Exp $
|
** $Id: build.c,v 1.526 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -339,7 +339,7 @@ Index *sqlite3FindIndex(sqlite3 *db, const char *zName, const char *zDb){
|
|||||||
** Reclaim the memory used by an index
|
** Reclaim the memory used by an index
|
||||||
*/
|
*/
|
||||||
static void freeIndex(Index *p){
|
static void freeIndex(Index *p){
|
||||||
sqlite3 *db = p->pTable->db;
|
sqlite3 *db = p->pTable->dbMem;
|
||||||
sqlite3DbFree(db, p->zColAff);
|
sqlite3DbFree(db, p->zColAff);
|
||||||
sqlite3DbFree(db, p);
|
sqlite3DbFree(db, p);
|
||||||
}
|
}
|
||||||
@@ -467,7 +467,7 @@ void sqlite3CommitInternalChanges(sqlite3 *db){
|
|||||||
static void sqliteResetColumnNames(Table *pTable){
|
static void sqliteResetColumnNames(Table *pTable){
|
||||||
int i;
|
int i;
|
||||||
Column *pCol;
|
Column *pCol;
|
||||||
sqlite3 *db = pTable->db;
|
sqlite3 *db = pTable->dbMem;
|
||||||
assert( pTable!=0 );
|
assert( pTable!=0 );
|
||||||
if( (pCol = pTable->aCol)!=0 ){
|
if( (pCol = pTable->aCol)!=0 ){
|
||||||
for(i=0; i<pTable->nCol; i++, pCol++){
|
for(i=0; i<pTable->nCol; i++, pCol++){
|
||||||
@@ -498,7 +498,7 @@ void sqlite3DeleteTable(Table *pTable){
|
|||||||
sqlite3 *db;
|
sqlite3 *db;
|
||||||
|
|
||||||
if( pTable==0 ) return;
|
if( pTable==0 ) return;
|
||||||
db = pTable->db;
|
db = pTable->dbMem;
|
||||||
|
|
||||||
/* Do not delete the table until the reference count reaches zero. */
|
/* Do not delete the table until the reference count reaches zero. */
|
||||||
pTable->nRef--;
|
pTable->nRef--;
|
||||||
@@ -836,7 +836,7 @@ void sqlite3StartTable(
|
|||||||
pTable->iPKey = -1;
|
pTable->iPKey = -1;
|
||||||
pTable->pSchema = db->aDb[iDb].pSchema;
|
pTable->pSchema = db->aDb[iDb].pSchema;
|
||||||
pTable->nRef = 1;
|
pTable->nRef = 1;
|
||||||
pTable->db = db;
|
pTable->dbMem = db->lookaside.bEnabled ? db : 0;
|
||||||
if( pParse->pNewTable ) sqlite3DeleteTable(pParse->pNewTable);
|
if( pParse->pNewTable ) sqlite3DeleteTable(pParse->pNewTable);
|
||||||
pParse->pNewTable = pTable;
|
pParse->pNewTable = pTable;
|
||||||
|
|
||||||
@@ -1855,9 +1855,11 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
|
|||||||
assert( pTable->pSelect );
|
assert( pTable->pSelect );
|
||||||
pSel = sqlite3SelectDup(db, pTable->pSelect, 0);
|
pSel = sqlite3SelectDup(db, pTable->pSelect, 0);
|
||||||
if( pSel ){
|
if( pSel ){
|
||||||
|
int enableLookaside = db->lookaside.bEnabled;
|
||||||
n = pParse->nTab;
|
n = pParse->nTab;
|
||||||
sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
|
sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
|
||||||
pTable->nCol = -1;
|
pTable->nCol = -1;
|
||||||
|
db->lookaside.bEnabled = 0;
|
||||||
#ifndef SQLITE_OMIT_AUTHORIZATION
|
#ifndef SQLITE_OMIT_AUTHORIZATION
|
||||||
xAuth = db->xAuth;
|
xAuth = db->xAuth;
|
||||||
db->xAuth = 0;
|
db->xAuth = 0;
|
||||||
@@ -1866,6 +1868,7 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
|
|||||||
#else
|
#else
|
||||||
pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
|
pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
|
||||||
#endif
|
#endif
|
||||||
|
db->lookaside.bEnabled = enableLookaside;
|
||||||
pParse->nTab = n;
|
pParse->nTab = n;
|
||||||
if( pSelTab ){
|
if( pSelTab ){
|
||||||
assert( pTable->aCol==0 );
|
assert( pTable->aCol==0 );
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
** This file contains functions used to access the internal hash tables
|
** This file contains functions used to access the internal hash tables
|
||||||
** of user defined functions and collation sequences.
|
** of user defined functions and collation sequences.
|
||||||
**
|
**
|
||||||
** $Id: callback.c,v 1.36 2009/03/05 04:20:32 shane Exp $
|
** $Id: callback.c,v 1.37 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
@@ -423,6 +423,7 @@ void sqlite3SchemaFree(void *p){
|
|||||||
sqlite3HashInit(&pSchema->tblHash, 0);
|
sqlite3HashInit(&pSchema->tblHash, 0);
|
||||||
for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){
|
for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){
|
||||||
Table *pTab = sqliteHashData(pElem);
|
Table *pTab = sqliteHashData(pElem);
|
||||||
|
assert( pTab->dbMem==0 );
|
||||||
sqlite3DeleteTable(pTab);
|
sqlite3DeleteTable(pTab);
|
||||||
}
|
}
|
||||||
sqlite3HashClear(&temp1);
|
sqlite3HashClear(&temp1);
|
||||||
|
50
src/expr.c
50
src/expr.c
@@ -12,7 +12,7 @@
|
|||||||
** This file contains routines used for analyzing expressions and
|
** This file contains routines used for analyzing expressions and
|
||||||
** for generating VDBE code that evaluates expressions in SQLite.
|
** for generating VDBE code that evaluates expressions in SQLite.
|
||||||
**
|
**
|
||||||
** $Id: expr.c,v 1.421 2009/03/23 04:33:32 danielk1977 Exp $
|
** $Id: expr.c,v 1.422 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -404,8 +404,22 @@ Expr *sqlite3Expr(
|
|||||||
pNew->iAgg = -1;
|
pNew->iAgg = -1;
|
||||||
pNew->span.z = (u8*)"";
|
pNew->span.z = (u8*)"";
|
||||||
if( pToken ){
|
if( pToken ){
|
||||||
|
int c;
|
||||||
assert( pToken->dyn==0 );
|
assert( pToken->dyn==0 );
|
||||||
pNew->span = pNew->token = *pToken;
|
pNew->span = *pToken;
|
||||||
|
|
||||||
|
/* The pToken->z value is constant and must not change. But
|
||||||
|
** this expression might be passed to sqlite3DequoteExpr() which
|
||||||
|
** will attempt to modify pNew->token.z. Hence, if the token
|
||||||
|
** is quoted, make a copy now so that DequoteExpr() will change
|
||||||
|
** the copy rather than the original (read-only) text.
|
||||||
|
*/
|
||||||
|
if( pToken->n>=2
|
||||||
|
&& ((c = pToken->z[0])=='\'' || c=='"' || c=='[' || c=='`') ){
|
||||||
|
sqlite3TokenCopy(db, &pNew->token, pToken);
|
||||||
|
}else{
|
||||||
|
pNew->token = *pToken;
|
||||||
|
}
|
||||||
}else if( pLeft ){
|
}else if( pLeft ){
|
||||||
if( pRight ){
|
if( pRight ){
|
||||||
if( pRight->span.dyn==0 && pLeft->span.dyn==0 ){
|
if( pRight->span.dyn==0 && pLeft->span.dyn==0 ){
|
||||||
@@ -511,16 +525,15 @@ Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){
|
|||||||
assert( pToken );
|
assert( pToken );
|
||||||
pNew = sqlite3DbMallocZero(db, sizeof(Expr) );
|
pNew = sqlite3DbMallocZero(db, sizeof(Expr) );
|
||||||
if( pNew==0 ){
|
if( pNew==0 ){
|
||||||
sqlite3ExprListDelete(db, pList); /* Avoid leaking memory when malloc fails */
|
sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pNew->op = TK_FUNCTION;
|
pNew->op = TK_FUNCTION;
|
||||||
pNew->x.pList = pList;
|
pNew->x.pList = pList;
|
||||||
assert( !ExprHasProperty(pNew, EP_xIsSelect) );
|
assert( !ExprHasProperty(pNew, EP_xIsSelect) );
|
||||||
assert( pToken->dyn==0 );
|
assert( pToken->dyn==0 );
|
||||||
pNew->token = *pToken;
|
pNew->span = *pToken;
|
||||||
pNew->span = pNew->token;
|
sqlite3TokenCopy(db, &pNew->token, pToken);
|
||||||
|
|
||||||
sqlite3ExprSetHeight(pParse, pNew);
|
sqlite3ExprSetHeight(pParse, pNew);
|
||||||
return pNew;
|
return pNew;
|
||||||
}
|
}
|
||||||
@@ -645,27 +658,10 @@ void sqlite3ExprDelete(sqlite3 *db, Expr *p){
|
|||||||
** If so, remove the quotation marks.
|
** If so, remove the quotation marks.
|
||||||
*/
|
*/
|
||||||
void sqlite3DequoteExpr(sqlite3 *db, Expr *p){
|
void sqlite3DequoteExpr(sqlite3 *db, Expr *p){
|
||||||
if( ExprHasAnyProperty(p, EP_Dequoted) ){
|
if( !ExprHasAnyProperty(p, EP_Dequoted) ){
|
||||||
return;
|
ExprSetProperty(p, EP_Dequoted);
|
||||||
|
sqlite3Dequote((char*)p->token.z);
|
||||||
}
|
}
|
||||||
ExprSetProperty(p, EP_Dequoted);
|
|
||||||
|
|
||||||
/* If p->token.dyn==0 and none of EP_Reduced, EP_TokenOnly, or
|
|
||||||
** EP_SpanOnly are set, that means that the p->token.z string points
|
|
||||||
** back to the original SQL statement text. In that case, we need
|
|
||||||
** to make a copy before modifying the string, otherwise we would
|
|
||||||
** corrupt the original SQL statement text.
|
|
||||||
*/
|
|
||||||
testcase( p->token.dyn==0 && ExprHasProperty(p, EP_Reduced) );
|
|
||||||
testcase( p->token.dyn==0 && ExprHasProperty(p, EP_TokenOnly) );
|
|
||||||
testcase( p->token.dyn==0 && ExprHasProperty(p, EP_SpanOnly) );
|
|
||||||
if( p->token.dyn==0
|
|
||||||
&& !ExprHasAnyProperty(p, EP_Reduced|EP_TokenOnly|EP_SpanOnly)
|
|
||||||
){
|
|
||||||
sqlite3TokenCopy(db, &p->token, &p->token);
|
|
||||||
}
|
|
||||||
|
|
||||||
sqlite3Dequote((char*)p->token.z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -876,7 +872,7 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int flags, u8 **pzBuffer){
|
|||||||
Expr *sqlite3ExprDup(sqlite3 *db, Expr *p, int flags){
|
Expr *sqlite3ExprDup(sqlite3 *db, Expr *p, int flags){
|
||||||
return exprDup(db, p, flags, 0);
|
return exprDup(db, p, flags, 0);
|
||||||
}
|
}
|
||||||
void sqlite3TokenCopy(sqlite3 *db, Token *pTo, Token *pFrom){
|
void sqlite3TokenCopy(sqlite3 *db, Token *pTo, const Token *pFrom){
|
||||||
if( pTo->dyn ) sqlite3DbFree(db, (char*)pTo->z);
|
if( pTo->dyn ) sqlite3DbFree(db, (char*)pTo->z);
|
||||||
if( pFrom->z ){
|
if( pFrom->z ){
|
||||||
pTo->n = pFrom->n;
|
pTo->n = pFrom->n;
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
**
|
**
|
||||||
** Memory allocation functions used throughout sqlite.
|
** Memory allocation functions used throughout sqlite.
|
||||||
**
|
**
|
||||||
** $Id: malloc.c,v 1.60 2009/03/23 17:49:15 drh Exp $
|
** $Id: malloc.c,v 1.61 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -565,10 +565,10 @@ void *sqlite3DbMallocZero(sqlite3 *db, int n){
|
|||||||
*/
|
*/
|
||||||
void *sqlite3DbMallocRaw(sqlite3 *db, int n){
|
void *sqlite3DbMallocRaw(sqlite3 *db, int n){
|
||||||
void *p;
|
void *p;
|
||||||
|
assert( db==0 || sqlite3_mutex_held(db->mutex) );
|
||||||
#ifndef SQLITE_OMIT_LOOKASIDE
|
#ifndef SQLITE_OMIT_LOOKASIDE
|
||||||
if( db ){
|
if( db ){
|
||||||
LookasideSlot *pBuf;
|
LookasideSlot *pBuf;
|
||||||
assert( sqlite3_mutex_held(db->mutex) );
|
|
||||||
if( db->mallocFailed ){
|
if( db->mallocFailed ){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -600,6 +600,7 @@ void *sqlite3DbMallocRaw(sqlite3 *db, int n){
|
|||||||
*/
|
*/
|
||||||
void *sqlite3DbRealloc(sqlite3 *db, void *p, int n){
|
void *sqlite3DbRealloc(sqlite3 *db, void *p, int n){
|
||||||
void *pNew = 0;
|
void *pNew = 0;
|
||||||
|
assert( db!=0 );
|
||||||
assert( sqlite3_mutex_held(db->mutex) );
|
assert( sqlite3_mutex_held(db->mutex) );
|
||||||
if( db->mallocFailed==0 ){
|
if( db->mallocFailed==0 ){
|
||||||
if( p==0 ){
|
if( p==0 ){
|
||||||
|
17
src/parse.y
17
src/parse.y
@@ -14,7 +14,7 @@
|
|||||||
** the parser. Lemon will also generate a header file containing
|
** the parser. Lemon will also generate a header file containing
|
||||||
** numeric codes for all of the tokens.
|
** numeric codes for all of the tokens.
|
||||||
**
|
**
|
||||||
** @(#) $Id: parse.y,v 1.271 2009/03/22 20:36:19 drh Exp $
|
** @(#) $Id: parse.y,v 1.272 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// All token codes are small integers with #defines that begin with "TK_"
|
// All token codes are small integers with #defines that begin with "TK_"
|
||||||
@@ -133,9 +133,13 @@ cmd ::= ROLLBACK trans_opt TO savepoint_opt nm(X). {
|
|||||||
///////////////////// The CREATE TABLE statement ////////////////////////////
|
///////////////////// The CREATE TABLE statement ////////////////////////////
|
||||||
//
|
//
|
||||||
cmd ::= create_table create_table_args.
|
cmd ::= create_table create_table_args.
|
||||||
create_table ::= CREATE temp(T) TABLE ifnotexists(E) nm(Y) dbnm(Z). {
|
create_table ::= createkw temp(T) TABLE ifnotexists(E) nm(Y) dbnm(Z). {
|
||||||
sqlite3StartTable(pParse,&Y,&Z,T,0,0,E);
|
sqlite3StartTable(pParse,&Y,&Z,T,0,0,E);
|
||||||
}
|
}
|
||||||
|
createkw(A) ::= CREATE(X). {
|
||||||
|
pParse->db->lookaside.bEnabled = 0;
|
||||||
|
A = X;
|
||||||
|
}
|
||||||
%type ifnotexists {int}
|
%type ifnotexists {int}
|
||||||
ifnotexists(A) ::= . {A = 0;}
|
ifnotexists(A) ::= . {A = 0;}
|
||||||
ifnotexists(A) ::= IF NOT EXISTS. {A = 1;}
|
ifnotexists(A) ::= IF NOT EXISTS. {A = 1;}
|
||||||
@@ -365,7 +369,7 @@ ifexists(A) ::= . {A = 0;}
|
|||||||
///////////////////// The CREATE VIEW statement /////////////////////////////
|
///////////////////// The CREATE VIEW statement /////////////////////////////
|
||||||
//
|
//
|
||||||
%ifndef SQLITE_OMIT_VIEW
|
%ifndef SQLITE_OMIT_VIEW
|
||||||
cmd ::= CREATE(X) temp(T) VIEW ifnotexists(E) nm(Y) dbnm(Z) AS select(S). {
|
cmd ::= createkw(X) temp(T) VIEW ifnotexists(E) nm(Y) dbnm(Z) AS select(S). {
|
||||||
sqlite3CreateView(pParse, &X, &Y, &Z, S, T, E);
|
sqlite3CreateView(pParse, &X, &Y, &Z, S, T, E);
|
||||||
}
|
}
|
||||||
cmd ::= DROP VIEW ifexists(E) fullname(X). {
|
cmd ::= DROP VIEW ifexists(E) fullname(X). {
|
||||||
@@ -941,7 +945,7 @@ nexprlist(A) ::= expr(Y).
|
|||||||
|
|
||||||
///////////////////////////// The CREATE INDEX command ///////////////////////
|
///////////////////////////// The CREATE INDEX command ///////////////////////
|
||||||
//
|
//
|
||||||
cmd ::= CREATE(S) uniqueflag(U) INDEX ifnotexists(NE) nm(X) dbnm(D)
|
cmd ::= createkw(S) uniqueflag(U) INDEX ifnotexists(NE) nm(X) dbnm(D)
|
||||||
ON nm(Y) LP idxlist(Z) RP(E). {
|
ON nm(Y) LP idxlist(Z) RP(E). {
|
||||||
sqlite3CreateIndex(pParse, &X, &D,
|
sqlite3CreateIndex(pParse, &X, &D,
|
||||||
sqlite3SrcListAppend(pParse->db,0,&Y,0), Z, U,
|
sqlite3SrcListAppend(pParse->db,0,&Y,0), Z, U,
|
||||||
@@ -1024,7 +1028,7 @@ plus_opt ::= .
|
|||||||
|
|
||||||
%ifndef SQLITE_OMIT_TRIGGER
|
%ifndef SQLITE_OMIT_TRIGGER
|
||||||
|
|
||||||
cmd ::= CREATE trigger_decl(A) BEGIN trigger_cmd_list(S) END(Z). {
|
cmd ::= createkw trigger_decl(A) BEGIN trigger_cmd_list(S) END(Z). {
|
||||||
Token all;
|
Token all;
|
||||||
all.z = A.z;
|
all.z = A.z;
|
||||||
all.n = (int)(Z.z - A.z) + Z.n;
|
all.n = (int)(Z.z - A.z) + Z.n;
|
||||||
@@ -1170,6 +1174,7 @@ cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column(Y). {
|
|||||||
sqlite3AlterFinishAddColumn(pParse, &Y);
|
sqlite3AlterFinishAddColumn(pParse, &Y);
|
||||||
}
|
}
|
||||||
add_column_fullname ::= fullname(X). {
|
add_column_fullname ::= fullname(X). {
|
||||||
|
pParse->db->lookaside.bEnabled = 0;
|
||||||
sqlite3AlterBeginAddColumn(pParse, X);
|
sqlite3AlterBeginAddColumn(pParse, X);
|
||||||
}
|
}
|
||||||
kwcolumn_opt ::= .
|
kwcolumn_opt ::= .
|
||||||
@@ -1180,7 +1185,7 @@ kwcolumn_opt ::= COLUMNKW.
|
|||||||
%ifndef SQLITE_OMIT_VIRTUALTABLE
|
%ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||||
cmd ::= create_vtab. {sqlite3VtabFinishParse(pParse,0);}
|
cmd ::= create_vtab. {sqlite3VtabFinishParse(pParse,0);}
|
||||||
cmd ::= create_vtab LP vtabarglist RP(X). {sqlite3VtabFinishParse(pParse,&X);}
|
cmd ::= create_vtab LP vtabarglist RP(X). {sqlite3VtabFinishParse(pParse,&X);}
|
||||||
create_vtab ::= CREATE VIRTUAL TABLE nm(X) dbnm(Y) USING nm(Z). {
|
create_vtab ::= createkw VIRTUAL TABLE nm(X) dbnm(Y) USING nm(Z). {
|
||||||
sqlite3VtabBeginParse(pParse, &X, &Y, &Z);
|
sqlite3VtabBeginParse(pParse, &X, &Y, &Z);
|
||||||
}
|
}
|
||||||
vtabarglist ::= vtabarg.
|
vtabarglist ::= vtabarg.
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
** interface, and routines that contribute to loading the database schema
|
** interface, and routines that contribute to loading the database schema
|
||||||
** from disk.
|
** from disk.
|
||||||
**
|
**
|
||||||
** $Id: prepare.c,v 1.113 2009/03/24 04:46:08 danielk1977 Exp $
|
** $Id: prepare.c,v 1.114 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -74,33 +74,14 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
|
|||||||
** But because db->init.busy is set to 1, no VDBE code is generated
|
** But because db->init.busy is set to 1, no VDBE code is generated
|
||||||
** or executed. All the parser does is build the internal data
|
** or executed. All the parser does is build the internal data
|
||||||
** structures that describe the table, index, or view.
|
** structures that describe the table, index, or view.
|
||||||
**
|
|
||||||
** While the CREATE XXX statement is being processed, the lookaside
|
|
||||||
** buffer is disabled. One reason for this is that when running in
|
|
||||||
** shared cache mode, the objects allocated for the in-memory schema
|
|
||||||
** might be freed from within a call made on a different database
|
|
||||||
** connection to db (e.g. if the second connection executes a DROP
|
|
||||||
** TABLE statement). If the objects that make up the Table structure
|
|
||||||
** are allocated from within db's lookaside buffer, then db->mutex
|
|
||||||
** would have to be obtained before they could be freed. This would
|
|
||||||
** open the door to deadlock in a multi-threaded application.
|
|
||||||
**
|
|
||||||
** Another reason to disable the lookaside buffer is that lookaside
|
|
||||||
** gives the greatest performance boost when it is used to allocate
|
|
||||||
** and free small transient objects. The schema objects, which tend
|
|
||||||
** to have long lifetimes, are better allocated from the heap.
|
|
||||||
*/
|
*/
|
||||||
char *zErr;
|
char *zErr;
|
||||||
int rc;
|
int rc;
|
||||||
u8 lookasideEnabled;
|
|
||||||
assert( db->init.busy );
|
assert( db->init.busy );
|
||||||
db->init.iDb = iDb;
|
db->init.iDb = iDb;
|
||||||
db->init.newTnum = atoi(argv[1]);
|
db->init.newTnum = atoi(argv[1]);
|
||||||
lookasideEnabled = db->lookaside.bEnabled;
|
|
||||||
db->lookaside.bEnabled = 0;
|
|
||||||
rc = sqlite3_exec(db, argv[2], 0, 0, &zErr);
|
rc = sqlite3_exec(db, argv[2], 0, 0, &zErr);
|
||||||
db->init.iDb = 0;
|
db->init.iDb = 0;
|
||||||
db->lookaside.bEnabled = lookasideEnabled;
|
|
||||||
assert( rc!=SQLITE_OK || zErr==0 );
|
assert( rc!=SQLITE_OK || zErr==0 );
|
||||||
if( SQLITE_OK!=rc ){
|
if( SQLITE_OK!=rc ){
|
||||||
pData->rc = rc;
|
pData->rc = rc;
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
** This file contains C code routines that are called by the parser
|
** This file contains C code routines that are called by the parser
|
||||||
** to handle SELECT statements in SQLite.
|
** to handle SELECT statements in SQLite.
|
||||||
**
|
**
|
||||||
** $Id: select.c,v 1.504 2009/02/25 08:56:47 danielk1977 Exp $
|
** $Id: select.c,v 1.505 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -1284,7 +1284,7 @@ Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect){
|
|||||||
if( pTab==0 ){
|
if( pTab==0 ){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pTab->db = db;
|
pTab->dbMem = db->lookaside.bEnabled ? db : 0;
|
||||||
pTab->nRef = 1;
|
pTab->nRef = 1;
|
||||||
pTab->zName = 0;
|
pTab->zName = 0;
|
||||||
selectColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);
|
selectColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);
|
||||||
@@ -3080,7 +3080,7 @@ static int selectExpander(Walker *pWalker, Select *p){
|
|||||||
sqlite3WalkSelect(pWalker, pSel);
|
sqlite3WalkSelect(pWalker, pSel);
|
||||||
pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));
|
pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));
|
||||||
if( pTab==0 ) return WRC_Abort;
|
if( pTab==0 ) return WRC_Abort;
|
||||||
pTab->db = db;
|
pTab->dbMem = db->lookaside.bEnabled ? db : 0;
|
||||||
pTab->nRef = 1;
|
pTab->nRef = 1;
|
||||||
pTab->zName = sqlite3MPrintf(db, "sqlite_subquery_%p_", (void*)pTab);
|
pTab->zName = sqlite3MPrintf(db, "sqlite_subquery_%p_", (void*)pTab);
|
||||||
while( pSel->pPrior ){ pSel = pSel->pPrior; }
|
while( pSel->pPrior ){ pSel = pSel->pPrior; }
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** Internal interface definitions for SQLite.
|
** Internal interface definitions for SQLite.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqliteInt.h,v 1.845 2009/03/23 04:33:33 danielk1977 Exp $
|
** @(#) $Id: sqliteInt.h,v 1.846 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITEINT_H_
|
#ifndef _SQLITEINT_H_
|
||||||
#define _SQLITEINT_H_
|
#define _SQLITEINT_H_
|
||||||
@@ -686,10 +686,17 @@ struct Schema {
|
|||||||
** lookaside malloc subsystem. Each available memory allocation in
|
** lookaside malloc subsystem. Each available memory allocation in
|
||||||
** the lookaside subsystem is stored on a linked list of LookasideSlot
|
** the lookaside subsystem is stored on a linked list of LookasideSlot
|
||||||
** objects.
|
** objects.
|
||||||
|
**
|
||||||
|
** Lookaside allocations are only allowed for objects that are associated
|
||||||
|
** with a particular database connection. Hence, schema information cannot
|
||||||
|
** be stored in lookaside because in shared cache mode the schema information
|
||||||
|
** is shared by multiple database connections. Therefore, while parsing
|
||||||
|
** schema information, the Lookaside.bEnabled flag is cleared so that
|
||||||
|
** lookaside allocations are not used to construct the schema objects.
|
||||||
*/
|
*/
|
||||||
struct Lookaside {
|
struct Lookaside {
|
||||||
u16 sz; /* Size of each buffer in bytes */
|
u16 sz; /* Size of each buffer in bytes */
|
||||||
u8 bEnabled; /* True if use lookaside. False to ignore it */
|
u8 bEnabled; /* False to disable new lookaside allocations */
|
||||||
u8 bMalloced; /* True if pStart obtained from sqlite3_malloc() */
|
u8 bMalloced; /* True if pStart obtained from sqlite3_malloc() */
|
||||||
int nOut; /* Number of buffers currently checked out */
|
int nOut; /* Number of buffers currently checked out */
|
||||||
int mxOut; /* Highwater mark for nOut */
|
int mxOut; /* Highwater mark for nOut */
|
||||||
@@ -1105,7 +1112,7 @@ struct CollSeq {
|
|||||||
** of a SELECT statement.
|
** of a SELECT statement.
|
||||||
*/
|
*/
|
||||||
struct Table {
|
struct Table {
|
||||||
sqlite3 *db; /* Associated database connection. Might be NULL. */
|
sqlite3 *dbMem; /* DB connection used for lookaside allocations. */
|
||||||
char *zName; /* Name of the table or view */
|
char *zName; /* Name of the table or view */
|
||||||
int iPKey; /* If not negative, use aCol[iPKey] as the primary key */
|
int iPKey; /* If not negative, use aCol[iPKey] as the primary key */
|
||||||
int nCol; /* Number of columns in this table */
|
int nCol; /* Number of columns in this table */
|
||||||
@@ -2466,7 +2473,7 @@ void sqlite3CompleteInsertion(Parse*, Table*, int, int, int*, int, int, int);
|
|||||||
int sqlite3OpenTableAndIndices(Parse*, Table*, int, int);
|
int sqlite3OpenTableAndIndices(Parse*, Table*, int, int);
|
||||||
void sqlite3BeginWriteOperation(Parse*, int, int);
|
void sqlite3BeginWriteOperation(Parse*, int, int);
|
||||||
Expr *sqlite3ExprDup(sqlite3*,Expr*,int);
|
Expr *sqlite3ExprDup(sqlite3*,Expr*,int);
|
||||||
void sqlite3TokenCopy(sqlite3*,Token*, Token*);
|
void sqlite3TokenCopy(sqlite3*,Token*,const Token*);
|
||||||
ExprList *sqlite3ExprListDup(sqlite3*,ExprList*,int);
|
ExprList *sqlite3ExprListDup(sqlite3*,ExprList*,int);
|
||||||
SrcList *sqlite3SrcListDup(sqlite3*,SrcList*,int);
|
SrcList *sqlite3SrcListDup(sqlite3*,SrcList*,int);
|
||||||
IdList *sqlite3IdListDup(sqlite3*,IdList*);
|
IdList *sqlite3IdListDup(sqlite3*,IdList*);
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
** A TCL Interface to SQLite. Append this file to sqlite3.c and
|
** A TCL Interface to SQLite. Append this file to sqlite3.c and
|
||||||
** compile the whole thing to build a TCL-enabled version of SQLite.
|
** compile the whole thing to build a TCL-enabled version of SQLite.
|
||||||
**
|
**
|
||||||
** $Id: tclsqlite.c,v 1.238 2009/03/16 13:19:36 danielk1977 Exp $
|
** $Id: tclsqlite.c,v 1.239 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "tcl.h"
|
#include "tcl.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -2593,8 +2593,21 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
|
|||||||
int i;
|
int i;
|
||||||
const char *zFile;
|
const char *zFile;
|
||||||
const char *zVfs = 0;
|
const char *zVfs = 0;
|
||||||
int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX;
|
int flags;
|
||||||
Tcl_DString translatedFilename;
|
Tcl_DString translatedFilename;
|
||||||
|
|
||||||
|
/* In normal use, each TCL interpreter runs in a single thread. So
|
||||||
|
** by default, we can turn of mutexing on SQLite database connections.
|
||||||
|
** However, for testing purposes it is useful to have mutexes turned
|
||||||
|
** on. So, by default, mutexes default off. But if compiled with
|
||||||
|
** SQLITE_TCL_DEFAULT_FULLMUTEX then mutexes default on.
|
||||||
|
*/
|
||||||
|
#ifdef SQLITE_TCL_DEFAULT_FULLMUTEX
|
||||||
|
flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX;
|
||||||
|
#else
|
||||||
|
flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX;
|
||||||
|
#endif
|
||||||
|
|
||||||
if( objc==2 ){
|
if( objc==2 ){
|
||||||
zArg = Tcl_GetStringFromObj(objv[1], 0);
|
zArg = Tcl_GetStringFromObj(objv[1], 0);
|
||||||
if( strcmp(zArg,"-version")==0 ){
|
if( strcmp(zArg,"-version")==0 ){
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
** individual tokens and sends those tokens one-by-one over to the
|
** individual tokens and sends those tokens one-by-one over to the
|
||||||
** parser for analysis.
|
** parser for analysis.
|
||||||
**
|
**
|
||||||
** $Id: tokenize.c,v 1.153 2009/01/20 16:53:41 danielk1977 Exp $
|
** $Id: tokenize.c,v 1.154 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -381,14 +381,17 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
|||||||
** error message.
|
** error message.
|
||||||
*/
|
*/
|
||||||
int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
|
int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
|
||||||
int nErr = 0;
|
int nErr = 0; /* Number of errors encountered */
|
||||||
int i;
|
int i; /* Loop counter */
|
||||||
void *pEngine;
|
void *pEngine; /* The LEMON-generated LALR(1) parser */
|
||||||
int tokenType;
|
int tokenType; /* type of the next token */
|
||||||
int lastTokenParsed = -1;
|
int lastTokenParsed = -1; /* type of the previous token */
|
||||||
sqlite3 *db = pParse->db;
|
int enableLookaside; /* Saved value of db->lookaside.bEnabled */
|
||||||
int mxSqlLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];
|
sqlite3 *db = pParse->db; /* The database connection */
|
||||||
|
int mxSqlLen; /* Max length of an SQL string */
|
||||||
|
|
||||||
|
|
||||||
|
mxSqlLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];
|
||||||
if( db->activeVdbeCnt==0 ){
|
if( db->activeVdbeCnt==0 ){
|
||||||
db->u1.isInterrupted = 0;
|
db->u1.isInterrupted = 0;
|
||||||
}
|
}
|
||||||
@@ -408,6 +411,8 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
|
|||||||
assert( pParse->nVarExpr==0 );
|
assert( pParse->nVarExpr==0 );
|
||||||
assert( pParse->nVarExprAlloc==0 );
|
assert( pParse->nVarExprAlloc==0 );
|
||||||
assert( pParse->apVarExpr==0 );
|
assert( pParse->apVarExpr==0 );
|
||||||
|
enableLookaside = db->lookaside.bEnabled;
|
||||||
|
if( db->lookaside.pStart ) db->lookaside.bEnabled = 1;
|
||||||
while( !db->mallocFailed && zSql[i]!=0 ){
|
while( !db->mallocFailed && zSql[i]!=0 ){
|
||||||
assert( i>=0 );
|
assert( i>=0 );
|
||||||
pParse->sLastToken.z = (u8*)&zSql[i];
|
pParse->sLastToken.z = (u8*)&zSql[i];
|
||||||
@@ -462,6 +467,7 @@ abort_parse:
|
|||||||
);
|
);
|
||||||
#endif /* YYDEBUG */
|
#endif /* YYDEBUG */
|
||||||
sqlite3ParserFree(pEngine, sqlite3_free);
|
sqlite3ParserFree(pEngine, sqlite3_free);
|
||||||
|
db->lookaside.bEnabled = enableLookaside;
|
||||||
if( db->mallocFailed ){
|
if( db->mallocFailed ){
|
||||||
pParse->rc = SQLITE_NOMEM;
|
pParse->rc = SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
**
|
**
|
||||||
** This file contains code used to implement incremental BLOB I/O.
|
** This file contains code used to implement incremental BLOB I/O.
|
||||||
**
|
**
|
||||||
** $Id: vdbeblob.c,v 1.30 2009/03/19 18:51:07 danielk1977 Exp $
|
** $Id: vdbeblob.c,v 1.31 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
@@ -264,9 +264,13 @@ blob_open_out:
|
|||||||
int sqlite3_blob_close(sqlite3_blob *pBlob){
|
int sqlite3_blob_close(sqlite3_blob *pBlob){
|
||||||
Incrblob *p = (Incrblob *)pBlob;
|
Incrblob *p = (Incrblob *)pBlob;
|
||||||
int rc;
|
int rc;
|
||||||
|
sqlite3 *db;
|
||||||
|
|
||||||
|
db = p->db;
|
||||||
|
sqlite3_mutex_enter(db->mutex);
|
||||||
rc = sqlite3_finalize(p->pStmt);
|
rc = sqlite3_finalize(p->pStmt);
|
||||||
sqlite3DbFree(p->db, p);
|
sqlite3DbFree(db, p);
|
||||||
|
sqlite3_mutex_leave(db->mutex);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** This file contains code used to help implement virtual tables.
|
** This file contains code used to help implement virtual tables.
|
||||||
**
|
**
|
||||||
** $Id: vtab.c,v 1.83 2009/03/19 18:51:07 danielk1977 Exp $
|
** $Id: vtab.c,v 1.84 2009/03/24 15:08:10 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
@@ -118,7 +118,8 @@ void sqlite3VtabUnlock(sqlite3 *db, sqlite3_vtab *pVtab){
|
|||||||
*/
|
*/
|
||||||
void sqlite3VtabClear(Table *p){
|
void sqlite3VtabClear(Table *p){
|
||||||
sqlite3_vtab *pVtab = p->pVtab;
|
sqlite3_vtab *pVtab = p->pVtab;
|
||||||
sqlite3 *db = p->db;
|
Schema *pSchema = p->pSchema;
|
||||||
|
sqlite3 *db = pSchema ? pSchema->db : 0;
|
||||||
if( pVtab ){
|
if( pVtab ){
|
||||||
assert( p->pMod && p->pMod->pModule );
|
assert( p->pMod && p->pMod->pModule );
|
||||||
sqlite3VtabUnlock(db, pVtab);
|
sqlite3VtabUnlock(db, pVtab);
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
# This file implements regression tests for SQLite library. The
|
# This file implements regression tests for SQLite library. The
|
||||||
# focus of this script is testing the ALTER TABLE statement.
|
# focus of this script is testing the ALTER TABLE statement.
|
||||||
#
|
#
|
||||||
# $Id: alter.test,v 1.31 2009/02/13 03:43:32 drh Exp $
|
# $Id: alter.test,v 1.32 2009/03/24 15:08:10 drh Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
@@ -677,7 +677,7 @@ do_test alter-9.2 {
|
|||||||
execsql {
|
execsql {
|
||||||
SELECT SQLITE_RENAME_TABLE(0,0);
|
SELECT SQLITE_RENAME_TABLE(0,0);
|
||||||
SELECT SQLITE_RENAME_TABLE(10,20);
|
SELECT SQLITE_RENAME_TABLE(10,20);
|
||||||
SELECT SQLITE_RENAME_TABLE("foo", "foo");
|
SELECT SQLITE_RENAME_TABLE('foo', 'foo');
|
||||||
}
|
}
|
||||||
} {{} {} {}}
|
} {{} {} {}}
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
# This file implements regression tests for SQLite library. The
|
# This file implements regression tests for SQLite library. The
|
||||||
# focus of this file is testing CHECK constraints
|
# focus of this file is testing CHECK constraints
|
||||||
#
|
#
|
||||||
# $Id: check.test,v 1.11 2007/07/23 19:39:47 drh Exp $
|
# $Id: check.test,v 1.12 2009/03/24 15:08:10 drh Exp $
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -115,11 +115,12 @@ do_test check-1.17 {
|
|||||||
} {4 11.0}
|
} {4 11.0}
|
||||||
|
|
||||||
do_test check-2.1 {
|
do_test check-2.1 {
|
||||||
|
breakpoint
|
||||||
execsql {
|
execsql {
|
||||||
CREATE TABLE t2(
|
CREATE TABLE t2(
|
||||||
x INTEGER CHECK( typeof(coalesce(x,0))=="integer" ),
|
x INTEGER CHECK( typeof(coalesce(x,0))=="integer" ),
|
||||||
y REAL CHECK( typeof(coalesce(y,0.1))=="real" ),
|
y REAL CHECK( typeof(coalesce(y,0.1))=='real' ),
|
||||||
z TEXT CHECK( typeof(coalesce(z,''))=="text" )
|
z TEXT CHECK( typeof(coalesce(z,''))=='text' )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} {}
|
} {}
|
||||||
@@ -129,6 +130,8 @@ do_test check-2.2 {
|
|||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
}
|
}
|
||||||
} {1 2.2 three}
|
} {1 2.2 three}
|
||||||
|
db close
|
||||||
|
sqlite3 db test.db
|
||||||
do_test check-2.3 {
|
do_test check-2.3 {
|
||||||
execsql {
|
execsql {
|
||||||
INSERT INTO t2 VALUES(NULL, NULL, NULL);
|
INSERT INTO t2 VALUES(NULL, NULL, NULL);
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# Tests for the lookaside memory allocator.
|
# Tests for the lookaside memory allocator.
|
||||||
#
|
#
|
||||||
# $Id: lookaside.test,v 1.8 2008/10/11 17:06:04 drh Exp $
|
# $Id: lookaside.test,v 1.9 2009/03/24 15:08:10 drh Exp $
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -43,11 +43,11 @@ do_test lookaside-1.4 {
|
|||||||
db eval {CREATE TABLE t1(w,x,y,z);}
|
db eval {CREATE TABLE t1(w,x,y,z);}
|
||||||
foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break
|
foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break
|
||||||
expr {$x==0 && $y<$z && $z==18}
|
expr {$x==0 && $y<$z && $z==18}
|
||||||
} {1}
|
} {0}
|
||||||
do_test lookaside-1.5 {
|
do_test lookaside-1.5 {
|
||||||
foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 1] break
|
foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 1] break
|
||||||
expr {$x==0 && $y<$z && $z==18}
|
expr {$x==0 && $y<$z && $z==18}
|
||||||
} {1}
|
} {0}
|
||||||
do_test lookaside-1.6 {
|
do_test lookaside-1.6 {
|
||||||
foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break
|
foreach {x y z} [sqlite3_db_status db SQLITE_DBSTATUS_LOOKASIDE_USED 0] break
|
||||||
expr {$x==0 && $y==$z && $y<18}
|
expr {$x==0 && $y==$z && $y<18}
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
#
|
#
|
||||||
# $Id: mutex1.test,v 1.18 2009/03/20 13:15:31 drh Exp $
|
# $Id: mutex1.test,v 1.19 2009/03/24 15:08:10 drh Exp $
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -114,7 +114,7 @@ ifcapable threadsafe {
|
|||||||
do_test mutex1.2.$mode.2 {
|
do_test mutex1.2.$mode.2 {
|
||||||
sqlite3_initialize
|
sqlite3_initialize
|
||||||
clear_mutex_counters
|
clear_mutex_counters
|
||||||
sqlite3 db test.db -nomutex 0
|
sqlite3 db test.db -nomutex 0 -fullmutex 0
|
||||||
catchsql { CREATE TABLE abc(a, b, c) }
|
catchsql { CREATE TABLE abc(a, b, c) }
|
||||||
db eval {
|
db eval {
|
||||||
INSERT INTO abc VALUES(1, 2, 3);
|
INSERT INTO abc VALUES(1, 2, 3);
|
||||||
|
Reference in New Issue
Block a user