Compare commits

...

440 Commits

Author SHA1 Message Date
drh 300c18a1b5 Fix a comment typo. This check-in is 3.7.0 release candidate 2.
FossilOrigin-Name: b36b105eab6fd3195f4bfba6cb5cda0f063b7460
2010-07-21 16:16:28 +00:00
shaneh d5a724000b Added fix for race conditions from os_unix.c; added saving of errno in two places.
FossilOrigin-Name: 13ed106c8c279422a6159e28c6887d13a88b7b8b
2010-07-20 20:23:38 +00:00
dan 0668f5916e Fix a race condition in os_unix.c that may occur when one thread is opening a connection to a shared-memory block and another is either closing or locking the same shared-memory.
FossilOrigin-Name: 3b7330c19a5327322068e9460018fe0152b8ac87
2010-07-20 18:59:00 +00:00
drh 74bec6b93f Update the CLI test scripts for version 3.7.0.
FossilOrigin-Name: 92fe70dadde2eb551518d69ac2eaa6a0151d7dfe
2010-07-19 15:01:43 +00:00
dan d3f6b81a76 Use exit(255) instead of abort() in the tcl [sqlite_abort] test command. This stops testfixture from creating dozens of core files each time tests are run.
FossilOrigin-Name: aec9e13148671e612d4ba674e74c12116573434f
2010-07-19 12:44:14 +00:00
dan 2d07f26078 Changes to stat.test so that it works with file-format 4.
FossilOrigin-Name: f87bb283615847764d24943695990564f02b939e
2010-07-19 12:05:33 +00:00
dan a69f7d5aa5 Re-introduce the prefix-search optimization of [feef1b15d6], which was lost in a reorganization of FTS3 code.
FossilOrigin-Name: d692434b4935e8e7858230af1c126b0be8203077
2010-07-19 11:16:36 +00:00
dan bd0c001405 Enable previously failing tests in e_expr.test that pass following [3e5975aa3b].
FossilOrigin-Name: 3d59c54a39c4c3149bf01063a91c3db35ec84b31
2010-07-19 05:27:17 +00:00
drh 1dca1458cc Fix a parser bug that was causing the relative precedence of LIKE and <
operators to be incorrect.

FossilOrigin-Name: 3e5975aa3bb9df9e1f954bcce99384e0f13cb453
2010-07-19 02:30:33 +00:00
drh dd7e9dba97 Improvements to the formatting of parse.out file from Lemon. Add the -r option
to Lemon to disable the state sorting, making debugging easier.

FossilOrigin-Name: a2eaf8294f6d3fb39548987d632e934bb5d71cc9
2010-07-19 01:52:07 +00:00
drh f5c4e0f12a Add the -p option to lemon to cause conflicts resolved by precedence rules
to appear in the parse.out file.

FossilOrigin-Name: fb6a59b0a905ddea071948f9a527483a1b1b219f
2010-07-18 11:35:53 +00:00
dan 784141ea5c Add new test file e_expr.test.
FossilOrigin-Name: cbcf8abbb2cb3e603cc3da45075f6b076e5cad56
2010-07-17 18:44:49 +00:00
dan 3757556873 Do not run journal3.test with the inmemory_journal permutation.
FossilOrigin-Name: e1d228e992fe8da1fc5aef95d9bc8be62c6b46c7
2010-07-17 09:27:31 +00:00
dan 250ea1ad3e Fix a problem with wal4.test caused by changes in the previous checkin.
FossilOrigin-Name: 1218d3703ad23d01ce0d7cbcabdc9e0d864f8717
2010-07-16 11:10:25 +00:00
dan 304feffc3f Fix a test script bug uncovered by [a121cd80c5] that was causing shared_err.test to fail.
FossilOrigin-Name: d7b63a4c9fdd2acdb5829224b6189e7f2f6bedb9
2010-07-16 10:39:54 +00:00
drh 8ab58665bc Previous check-in [534aab837e] accidently reverted some
changes from [a121cd80c5].  This check-in restores those changes.

FossilOrigin-Name: abff795f38e33d778c8dd494a601bc029237da9e
2010-07-15 18:38:39 +00:00
drh a4ced195db Optionally support shared-memory in /dev/shm or other tmpfs directory
using an unsupported compile-time option.

FossilOrigin-Name: 534aab837e5a34fd58963ab2b505bfbb9da2e8ee
2010-07-15 18:32:40 +00:00
dan 1e5de5a13d Changes to wal.c so that SQLite can read even if the WAL file is opened read-only, provided the wal-index (shm file) is opened read/write.
FossilOrigin-Name: 932d19da73c9673cdd4cc01289b17761c23d23cb
2010-07-15 18:20:53 +00:00
dan 7d4514a4e1 Handle the case where xShmMap returns SQLITE_BUSY.
FossilOrigin-Name: 75f5354876c4300a8e53fe551dc837dd383d1e38
2010-07-15 17:54:14 +00:00
dan c74e4ef4c7 When creating a journal file on unix, attempt to create it with the same permissions as the associated database file.
FossilOrigin-Name: a121cd80c5ac94e5977bc3164d2500e0ea132fed
2010-07-15 14:59:37 +00:00
dan 473c1bf241 Change a comment inside a block of code in parse.y from C++ to C style.
FossilOrigin-Name: dea7d33b2d7d25280a31a2b9c1573f4292b81187
2010-07-15 11:14:21 +00:00
drh f65bc9119c Fix a typo in a comment in os_unix.c.
FossilOrigin-Name: e1e7312580a8b19825b0c52fa8af6c9382f99f22
2010-07-14 20:51:34 +00:00
drh a7d2db175b The expression list on the RHS of an IN operator can no longer be empty
because an empty expression list is now optimized out by changes in
check-in [c288ac644d0bf].  Therefore add ALWAYS() macros around tests
for the expression list being non-empty.

FossilOrigin-Name: fd130ae56c0e23f2d5b4a82f1a09e89ed7ae1e85
2010-07-14 20:23:52 +00:00
drh ef5d9ec166 Additional test cases and evidence marks for the empty RHS bug on the IN
operator - ticket [80e031a00f45dca877]

FossilOrigin-Name: 6851c517ac7f80538aa5f3a1994fa1921c0ec3f4
2010-07-14 19:31:07 +00:00
drh 094430eb71 Make the result of an IN or NOT IN expression with an empty set on the
right-hand side always either false or true, respectively, even if the
left-hand side is NULL.  Ticket [80e031a00f45dc]

FossilOrigin-Name: c288ac644d0bfda2b9bc204dc86df8e74d4f6843
2010-07-14 18:24:06 +00:00
dan e84322e503 Fix an assert() failure in wal2.test caused by messing with the contents of shared memory.
FossilOrigin-Name: 9f452514d96ab8d424eadc55c283c53fe831476d
2010-07-14 18:10:02 +00:00
dan 50833e32c1 Test the libaries response to read-only or unreadable database, WAL and wal-index files. If a WAL file cannot be opened in read/write mode, return SQLITE_CANTOPEN to the caller.
FossilOrigin-Name: 45bb84c6283d803fc29077fdc2d06fa50ec06a59
2010-07-14 16:37:17 +00:00
dan ddb0ac4b9f On unix, try to create the *-wal and *-shm files with the same permissions as the associated database file.
FossilOrigin-Name: e5d180eed245437b61bfb257ee01e2571c93afe7
2010-07-14 14:48:58 +00:00
dan 9d08d640ac Add tests to pagerfault.test.
FossilOrigin-Name: b092f2a74bdc77c1f90ad3b4448cb68a891ecf63
2010-07-14 08:20:35 +00:00
dan c385793495 Test that a corrupted WAL hash-table does not put the library into an infinite loop.
FossilOrigin-Name: c73886ed7497c0daf798c3b02ca6f5a1c2addde3
2010-07-14 07:06:47 +00:00
dan b31a6afad0 Fix a typo in the IS_BIG_INT macro used by coverage test instrumentation.
FossilOrigin-Name: 5314ca3928dab1c76fa4ec5dbe110e3212c95e9f
2010-07-14 06:20:26 +00:00
drh 5d4feffe7d Fix the unix driver to return an I/O error if unlink fails for any reason
other than the file not existing in the first place.

FossilOrigin-Name: 90d73c66bfa880cdeb688b3016c8b1c58bfcf35f
2010-07-14 01:45:22 +00:00
drh 54e0536275 Remove the xShmOpen method from the VFS. Shared-memory is opened automatically
by a call to xShmMap.  Rename the xShmClose method to xShmUnmap.

FossilOrigin-Name: 2b68e50268412599576c86ae70b830d0388cb35c
2010-07-14 00:22:36 +00:00
drh e11fedc589 Change the name of the xShmClose VFS method to xShmUnmap, everywhere.
FossilOrigin-Name: c2d27cf51d33e6f38bab37008d39074051f75274
2010-07-14 00:14:30 +00:00
drh 6e1f482824 Tweaks to the new shared-memory interface design - mostly comment changes.
FossilOrigin-Name: 6336de7aa96a6e1e68cc123e5d5f485d790d95a2
2010-07-13 23:41:40 +00:00
dan 0c1736026a Fix a typo in a comment in sqlite.h.in.
FossilOrigin-Name: 4a6c4b6605ddce59e586ab17024de5269191a823
2010-07-13 18:45:10 +00:00
dan da9fe0c327 Changes so that the xShmOpen VFS method is no longer required. Its job can be done by the first call to xShmMap. Rename xShmClose to xShmUnmap.
FossilOrigin-Name: f4780bde62c6c19146d2723c101540b8db898d38
2010-07-13 18:44:03 +00:00
drh 2103245e75 Improved documentation for the SQLITE_ACCESS_* constants that are used
with the xAccess() method of the VFS.

FossilOrigin-Name: 3d4bb65f10ed0297f38e732ce57e5440cba8deef
2010-07-13 14:48:27 +00:00
dan af6ea4e9f9 Add proposed interface change to sqlite.h.in. This commit breaks the build.
FossilOrigin-Name: 52577bb5e723d8de4fc609286666b581f8d9c746
2010-07-13 14:33:48 +00:00
dan 2acd4c6375 Fixes to the pcache10 and pcache90 permutations.
FossilOrigin-Name: 597d40fa529073123a50ae6afc762c59404f8f5f
2010-07-13 14:22:39 +00:00
dan 0cf408ff11 Fix problems with running the async.test script.
FossilOrigin-Name: 05ac2548652f3c9aa358289700b0b4c7fc22486d
2010-07-13 07:38:51 +00:00
shaneh 1f3e27b29e Updates to comments and code organization to reflect changes in os_unix.c;
Updated winShmLock() with logic changes from unixShmLock(); 
Modified IO error returns in winShmMap() to match those in unixShmMap();

FossilOrigin-Name: b73fe2754b68af4c76a1788aa18b93359720d1f1
2010-07-12 20:46:33 +00:00
dan 6d3eb82bc7 Fix test_stat.c so that it does not cause compilation errors if SQLITE_OMIT_VIRTUALTABLE is defined.
FossilOrigin-Name: bf4fc0888705108aab997e1cb491fc7f9c64c443
2010-07-12 18:12:41 +00:00
drh 3a0f13ff83 Fix makefiles so that they build sqlite3_analyzer again. Tweaks to comments
in test_stat.c.  Fix tclsqlite.c to build the sqlite3_analyzer again.

FossilOrigin-Name: e6cd15451d8c47bfc86d07565655920134b494fe
2010-07-12 16:47:48 +00:00
dan d846c5e047 In the async-IO module, do not increment the open file-counter until after an "open file" event has been added to the event queue. Otherwise, an OOM may cause the system to increment the counter even though no file was successfully opened.
FossilOrigin-Name: 15a190dc5769beb53b89254543e744a964cd86ed
2010-07-12 12:22:29 +00:00
dan 599e9d21bb Changes so that the space-analyzer script works with 3.7.0.
FossilOrigin-Name: 86159cb3f00a380dc55be3affb01c433618f0683
2010-07-12 08:39:37 +00:00
shaneh c3b84830bd Exclude a few more FTS modules from the "in memory" permutation test suite.
FossilOrigin-Name: 4e9d69cd5ac3cc4d12ccea3028cba73e3c3f2965
2010-07-09 19:32:28 +00:00
shaneh decd09cbe5 Exclude fts3cov.test from the "in memory" permutation test suite to avoid a false positive.
FossilOrigin-Name: 6af6794cac5516f8cbc425cb8c73468ca371a1ad
2010-07-09 18:43:40 +00:00
shaneh 55897967cc Fix warning under MSVC.
FossilOrigin-Name: 0c32c4bbdd74297767dcf4ec4295f9cc72875af0
2010-07-09 12:57:53 +00:00
drh 519426aaf8 Reformat WAL code for clearer presentation. Update comments for correctness.
Add checks to ensure that corruption in shared-memory does not result in
an infinite loop.

FossilOrigin-Name: 40eaada7ec45e70bdf64d060051f24c5c5e3faf3
2010-07-09 03:19:07 +00:00
drh a485cccd0a Add a test case to cover code that was left untested by the journal_mode
simplification.

FossilOrigin-Name: bcdddba4f011cf008d29918bcac59131007a8138
2010-07-08 19:19:51 +00:00
shaneh afdc5fa5cc Fix test case numbering in backup_malloc.test and issue when running under Windows.
FossilOrigin-Name: aef26438523bccf1ea2c19205cd05799e4c69a1f
2010-07-08 18:32:18 +00:00
drh c6b2a0ff99 Change the journal_mode pragma to remove the "default journal mode" concept.
The journal_mode pragma only effects currently attached databases and does 
not change the behavior of future attachments.

FossilOrigin-Name: e396184cd3bdb96e29ac33af5d1f631cac553341
2010-07-08 17:40:37 +00:00
shaneh 4677ddff7e Merged experimental crashsql() into trunk.
FossilOrigin-Name: 01b575ff1aa512f34be78f9d67b6caaf825e5820
2010-07-08 16:50:08 +00:00
shaneh f2c0882baa Changes to get crashsql() working on Windows.
FossilOrigin-Name: 8a5811ea80e8415f9ba6b1d9390ed723840402c3
2010-07-08 16:30:44 +00:00
shaneh ebffe41eaf Fix warning in test fixture code.
FossilOrigin-Name: 0bfcf3bcd77acab48344dde87cecb01e877f1a19
2010-07-08 16:22:51 +00:00
shaneh 504b2514c2 Fix test case number issue in walcrash.test.
FossilOrigin-Name: 6a46e64168705a31d86d29a60025f138a42c5b79
2010-07-08 16:22:05 +00:00
dan f0ab1f15de Fix to lock5.test so that it runs with the inmemory_journal permutation on osx.
FossilOrigin-Name: 948bb54568b5eb26644db78e8cd62381bdc22bac
2010-07-08 14:59:01 +00:00
shaneh caace9261a Fixed a few tests in pagerfault.test so they work correctly on Windows.
FossilOrigin-Name: ffbdd954a05c003a213069e39ad0655e77983666
2010-07-08 13:33:47 +00:00
dan cb35460330 Changes to test scripts so that the "inmemory_journal" permutation works with [ef126e775a].
FossilOrigin-Name: f553c8ed04b4b2df8ff4929e0754e3ffd1d01ba4
2010-07-08 09:44:42 +00:00
dan 8700b1e52d Add tests to walmode.test.
FossilOrigin-Name: 5aa2bdb502d70ccbc249a6b38b8a07b91c4ccd26
2010-07-08 06:22:25 +00:00
shaneh e2ad93173d Changes to os_win.c to have it simulate IO errors like os_unix.c.
FossilOrigin-Name: 0d53da9451fe016adc57c7c077fdbbbdb1c8d6ee
2010-07-08 03:13:33 +00:00
drh 2327f5a454 Make the initial salt values in the WAL header random values, not zero.
FossilOrigin-Name: baa5eddd0539342945c14a2793c2579efb7e3b26
2010-07-07 21:06:48 +00:00
drh 12c7e1aba3 Add the write-ahead log viewer/debugger tool to the tools/ folder.
FossilOrigin-Name: 0e4bd44682a252fb8af0df20f011b2b2364644b5
2010-07-07 20:38:26 +00:00
shaneh aa9ecebc2d Fix issue in mallocI test script where db handle not released.
FossilOrigin-Name: dd59cea6c860ad11f1794f3689a60ca6dbfffea5
2010-07-07 20:00:04 +00:00
dan 9f4127d50a Add further test cases to savepoint.test.
FossilOrigin-Name: f825205dbf3ebbfba0add86aa41f477281a13b0e
2010-07-07 18:38:35 +00:00
dan ab7e8d85a9 When rolling back a savepoint, reset the changeCountDone flag.
FossilOrigin-Name: fb62f4e3a7ceaa60ff6af2196ccf35b48759307e
2010-07-07 17:53:51 +00:00
shaneh 2ceced15ce When using MSVC to build test code, suppress the popup dialog when abort is called from the sqlite_abort() test function.
FossilOrigin-Name: 55d3d39f1c653627fc4c048e12fdd8c4444b6de7
2010-07-07 16:51:36 +00:00
shaneh b638a3d3eb Fix some MSVC compiler warnings in the ASYNC extension.
FossilOrigin-Name: b951c8675df3e719c30a1dd94200b7c04252a3ea
2010-07-07 16:49:46 +00:00
dan 8fb66141ed Merge together another accidental fork.
FossilOrigin-Name: c41f04edb20c0c8fc8c49a53d42cc0b8a0ff7fe3
2010-07-07 16:23:36 +00:00
shaneh 100efa3f73 Fix test numbering issue in nan.test.
FossilOrigin-Name: 5bb1330fef559d47dc854089dedba45bf05db192
2010-07-07 16:20:38 +00:00
dan 7fb574ecf7 Do not make the SQLITE_FCNTL_SIZE_HINT call if an error has already occurred during transaction commit.
FossilOrigin-Name: e92de834a39be07da5f0848d7ec5f1f6dff902a5
2010-07-07 16:18:45 +00:00
shaneh 538fa0b716 Close the file handle before returning. TCL test script issue only.
FossilOrigin-Name: f4076d8567243174c023b7aa7ae9ca7f8f73e33b
2010-07-07 15:41:55 +00:00
shaneh cce1b689f4 Fixed a new error introduced by last check-in of os_win.c. Updated xAccess() to support SimulateIOError().
FossilOrigin-Name: 8eefc287265443ec043bdab629597e79c9d22006
2010-07-07 14:45:40 +00:00
drh e9187b4371 Remove two more testcase() macros that require 4GiB WAL files to hit.
FossilOrigin-Name: 16e18f2706e67210eae62edfb748758fd27f23d7
2010-07-07 14:39:59 +00:00
drh 09b5dbc519 Remove a testcase() macro that would require a 4GiB WAL to reach.
FossilOrigin-Name: 15f9c2713bdfd3d6c8d8d4298f101d128e39b99a
2010-07-07 14:35:58 +00:00
drh f77e2ac27d Fix a compiler warning in PRAGMA journal_mode.
FossilOrigin-Name: d94269e60dbcb50b8a35f142c64ed013cc0045ac
2010-07-07 14:33:09 +00:00
drh 146151cd23 Avoid the need for a NEVER() from pager_write_pagelist() by passing in
pPager as an extra parameter.

FossilOrigin-Name: b3179379437dbcb1d8e7f1f8f631a3e7df1a5c9a
2010-07-07 14:19:13 +00:00
drh 51538e9d90 Merge together the accident fork.
FossilOrigin-Name: cdcf08cb18b1e290a4093454bebbd3e7094d6804
2010-07-07 14:00:17 +00:00
shaneh 7ea7259176 Fix minor issue in xAccess() method for Windows.
FossilOrigin-Name: 4bfd46f1db41009a1b925d61c6f074b933caa4ec
2010-07-07 13:58:11 +00:00
dan f6c614715c Make sure the schema is loaded before preparing a "PRAGMA journal_mode" command. This helps it return meaningful results when it is the first command executed by a new database connection.
FossilOrigin-Name: ef126e775a02d69a9cab53028513e8799e1b6044
2010-07-07 13:54:28 +00:00
drh 3e8e7ecbc4 Add testcase macros to ensure that large-file cases are tested in WAL.
FossilOrigin-Name: 8156b57ac33161ae6dd8a9413127ecce3c9eae83
2010-07-07 13:43:19 +00:00
dan 60f9da7561 Run some fts3 tests as part of the "wal" permutation.
FossilOrigin-Name: 8657455a11d20dbf78247559670943a72541a09d
2010-07-07 11:42:59 +00:00
dan 78f1e53840 Change the async-IO extension to return SQLITE_IOERR_SHORT_READ when appropriate. This prevents a valgrind warning in the test suite.
FossilOrigin-Name: d9e3287900ae4aa7722ad0132bb8d6cd2755d3a6
2010-07-07 11:05:21 +00:00
dan bd0e9070e5 Fix a problem with writing to databases larger than 2^32 bytes with WAL mode.
FossilOrigin-Name: b956ddca75d64ba662fa0b03b643822d836b6501
2010-07-07 09:48:44 +00:00
drh 4d9a7bf990 Remote the SQLITE_OMIT_GLOBALRECOVER macro - it is subsumed by
SQLITE_OMIT_DEPRECATED.  Add support to sqlite3_compileoption_used()
for SQLITE_OMIT_WAL.

FossilOrigin-Name: 21a2db908b9eeb7477fc9d8b2b54482db93cd76f
2010-07-07 01:52:31 +00:00
shaneh 186070588c Minor changes to Makefile.in to bring it more inline with main.mk.
FossilOrigin-Name: 5621862b0e2fc945ded51f5926a6b4c9f07d0ab7
2010-07-06 20:37:09 +00:00
shaneh 33d85c9cd7 Changes to pager1.test to support Windows.
FossilOrigin-Name: fce689ebe6165276598539779958407856e2f84f
2010-07-06 20:34:37 +00:00
shaneh 133ce560c6 Modified the xWrite() method on Windows to differentiate between IO and disk full error returns.
FossilOrigin-Name: ca4b7ffbd44937a02ae62d606f9e1eb767075c22
2010-07-06 20:33:47 +00:00
dan ea5542d126 Do not do the *-closeallfiles test for notify2.test. It uses multiple threads.
FossilOrigin-Name: fb09152db879211986a7161a96a61da1425f79ef
2010-07-06 11:26:15 +00:00
dan e1a2a990b8 Before calling Tcl_ExitThread() in a multi-threaded test, call Tcl_DoOneEvent() as many times as necessary to handle any queued events.
FossilOrigin-Name: b3399b40785d13754979203f15d71c95fec50282
2010-07-06 10:55:44 +00:00
drh 9e55d47d33 Reorder variable declarations in the previous check-in to avoid putting code
before declarations when not testing.

FossilOrigin-Name: d1fe8ab4a176180053d35300ad0540a27c6cd76d
2010-07-06 09:29:01 +00:00
dan 9859c427a2 Ensure the correct error code is returned if an attempt to parse a database schema made by an ATTACH statement fails.
FossilOrigin-Name: c272196115ab3926e56b6f4183ec127e3f98ef9c
2010-07-06 07:36:18 +00:00
drh 722a7e9ab3 Modify the VFS xAccess() method on winNT so that it returns false for
an exists test of a zero-length file.  This makes the windows VFS work
the same as the unix VFS.

FossilOrigin-Name: ec35f25403744f7441ac5ae1486b84d8ebc13e98
2010-07-05 21:00:43 +00:00
dan db10f08282 Simplify the previous commit by removing the pagerCheckForOrDeleteWAL() wrapper.
FossilOrigin-Name: a1324d125e2dd7004eaf8680f5f832ef17285087
2010-07-05 19:13:26 +00:00
dan 3e875ef3b5 Allocate a buffer containing the full path-name to the associated WAL file when a pager is created. This saves having to construct a new buffer each time a new read-transaction is opened and SQLite checks for the existance of a WAL file.
FossilOrigin-Name: 3053a4ad15343a56efa430503797b77bb6d1e770
2010-07-05 19:03:35 +00:00
drh 8220da7b8b When rolling back page 1 from a journal, restore the "nReserve" setting
in case it has been corrupted by a prior crash.

FossilOrigin-Name: c0d124da88e84e68679c2f3f4b2b35c03aecc916
2010-07-05 17:43:32 +00:00
dan 92d516a221 Do not report an error if the open-file-count is not as it should be after running a multi-threaded test. The counter instrumentation is not thread-safe.
FossilOrigin-Name: ea80b21c881fabaec1da788588c35c6c9782dcbd
2010-07-05 14:54:48 +00:00
dan 3374f8aee4 Call Tcl_ExitThread() from within threads created using Tcl_CreateThread(). Not doing so causes notifier related errors on OSX.
FossilOrigin-Name: 684eae6623ef1d0336b7a734b17ed307c720b6f4
2010-07-05 12:54:08 +00:00
dan 6310990d54 Add any files specified as part of the QUICKTEST_INCLUDE environment variable to the set of test files run as part of "make test". Release testing uses this trick.
FossilOrigin-Name: a40a6e7df191ca10bc3aa504d374b9f5bfa33cbc
2010-07-05 05:54:55 +00:00
dan eace527b8c Fix typos in permutations.test.
FossilOrigin-Name: b6600ecb4ee8e4d0fe5e8399450ef25b15071a91
2010-07-05 05:31:48 +00:00
dan d53850e579 Do not run the memsubsys1.test script under the memsubsys1 permutation.
FossilOrigin-Name: 3a1a8c77a5c7b57755f18d84234faed1f16c2103
2010-07-03 19:08:19 +00:00
drh 2667be5e3f Remove the unused xRename() method from the sqlite3_vfs object.
Add better documentation on the xCurrentTimeInt64() method.

FossilOrigin-Name: 51ec0e5432dd6849b83a3d969a018482eb3bb083
2010-07-03 17:13:31 +00:00
dan b3f4351f00 Further changes to test scripts so that the "inmemory_journal" permutation works.
FossilOrigin-Name: 50f2f7dfd64f610982525fd7a0dd7c1ade67bebb
2010-07-03 16:37:45 +00:00
dan d506de0208 Fix a bug in the permutations.test script.
FossilOrigin-Name: 3b20ad03be55613d922d81aec5313327bf4098b9
2010-07-03 13:59:01 +00:00
dan c844a0368a Fix an assert in pager.c. And various test cases that fail with the in-memory journal permutation.
FossilOrigin-Name: 622378dbe3941f06c717c1e272cd1190e4358428
2010-07-03 13:50:11 +00:00
dan 3f94b60961 Fix an assert in pager.c. And various test cases that fail with the in-memory journal permutation.
FossilOrigin-Name: 78fc35ff4b01d4a583009ec8b8bf876738ca7b92
2010-07-03 13:45:52 +00:00
drh b0ab011dc5 Cherry-pick the correct changes out of the recent "mistake" branch while
omitting the bogus changes.

FossilOrigin-Name: 48bf309391c32e7860c293acd13f3dda14212d39
2010-07-03 12:31:34 +00:00
drh 40e459e041 Remove code accidently appended to pager.c.
FossilOrigin-Name: 7cbe175a69738499f9218ec56f1a39f040aea9dc
2010-07-03 12:26:33 +00:00
drh bb810a9a7b Print the SQLite source_id() string when running speed tests.
FossilOrigin-Name: 6d7640edcd69a932556f86500aedbf14e75ba7de
2010-07-03 12:00:53 +00:00
dan f43d7fce61 Fix an assert() in pager.c added by the previous commit. And various problems with test scripts in autovacuum and in-memory journal mode.
FossilOrigin-Name: 62a10101776b41236ff7bd08c8aa85765a43df7c
2010-07-03 10:00:00 +00:00
dan fce218c5ad Do not attempt to open a WAL file for an in-memory or temporary database. Even if the database header suggests that it is a WAL database.
FossilOrigin-Name: 0fd809243652256d83ddcb58cf4890080654c667
2010-07-03 08:01:24 +00:00
dan 2411dea3ca Change code in OP_Rewind to avoid a valgrind warning following an error in the btree layer. This change does not fix any bug, just a warning.
FossilOrigin-Name: 4f62dbcfc96855f69e71d163bfc051d9db08cca9
2010-07-03 05:56:09 +00:00
drh 0eb77d0568 Fix a buffer overrun in the where.c. Problem detected by valgrind.
FossilOrigin-Name: 15bb62330681a5b2aad95a1d1fc9ab8f6f1bd6b9
2010-07-03 01:44:27 +00:00
shaneh fd28639f12 Changes to os_win.c to have it return same error code as os_unix.c.
FossilOrigin-Name: 33b6f069d8059903312282962181839ff983e5c4
2010-07-02 19:49:38 +00:00
drh cac29a67e9 Omit the OP_JournalMode opcode from the VDBE when SQLITE_OMIT_PRAGMA is
defined.

FossilOrigin-Name: 565ff65c61c85c9b2122b31bd9792692aa1e9cda
2010-07-02 19:36:52 +00:00
dan 5257af7dba Fix a bug in test_vfs.c causing an assert to fail. Changes to test code only.
FossilOrigin-Name: 336ce7d29767f76c4a92aa4bbc46d21e19871667
2010-07-02 19:04:59 +00:00
dan 84b9618231 Do not run the tests in notify3.test unless the unlock-notify API is available.
FossilOrigin-Name: 0d7fd6fe9deeddbec8dff1393beed126ae44c0ee
2010-07-02 18:58:01 +00:00
drh a0b75da197 Take out the incomplete initializer on the constant "dummy" in
sqlite3VdbeGetOp().  Add a comment that the MSVC warning there should
be ignored.

FossilOrigin-Name: 452ccaa9080e42657b5f0908bf40dbd834cd39f6
2010-07-02 18:44:37 +00:00
shaneh 8a300f8095 Fix a couple more compiler warnings under MSVC.
FossilOrigin-Name: 26bc27e3f4c8a666f3358f73fc21eccdec3508f6
2010-07-02 18:15:31 +00:00
drh 0ab216a6b4 Fix compiler warnings in the proxy locking code.
FossilOrigin-Name: 26c7689cfedf03e65bcd51df68d128101ed2c1ec
2010-07-02 17:10:40 +00:00
drh 56c77ef853 Remove a couple of C++ style comments from pager.c.
FossilOrigin-Name: 4f12e8ebdea0451cb32188a4bb812ca702c63275
2010-07-02 17:07:42 +00:00
shaneh 5eba1f60fe Fix some warnings when compiling under MSVC.
FossilOrigin-Name: 708338773919fa024abbba55180654beb60e6d84
2010-07-02 17:05:03 +00:00
dan 230fd98dd3 Add initializers for the xShmXXX() members to an sqlite3_io_methods structure in journal.c. This doesn't fix any real problem, just prevents a compiler warning.
FossilOrigin-Name: dafb3577a2d5fbeebb17c8176af837f0aebf6ee5
2010-07-02 16:36:18 +00:00
drh 5fc4c689c3 Remove an unused call to sqlite3PageBegin() from pager_write(). Replace it
with an assert().

FossilOrigin-Name: 01c1278263fdd8454763be15bddd2558e720e6e0
2010-07-02 15:35:58 +00:00
dan f412ee2ea4 Run tkt-9d68c883.test along with the other pager.c coverage tests. Add a test case to pager1.test.
FossilOrigin-Name: c6714b0dbdc782e721662ec166d9f161bc05c6df
2010-07-02 13:49:09 +00:00
dan c396d4af58 Additional test cases to cover branches in pager.c.
FossilOrigin-Name: eddfb2b4062f8a8b907f0c7bc08a05c16692e900
2010-07-02 11:27:43 +00:00
drh b2961b00f3 Add a NEVER to sqlite3PagerCommitPhaseTwo() because it is now no longer
possible to invoke that function without holding a RESERVED lock.

FossilOrigin-Name: 6ae7617298c70f8e03dd0ed73b8153d4871fb023
2010-07-02 01:18:12 +00:00
drh 32f2964390 If you delete a database file but not its *-wal file, then open the database
(thus creating a new empty database file) the *-wal file is automatically
deleted.

FossilOrigin-Name: 95c69dfbddaf4367cd699dfe8fcf8e06030c1f53
2010-07-01 19:45:34 +00:00
dan d0b0d4dc23 Add tests to pager1.test and pagerfault.test.
FossilOrigin-Name: c6e75950928954fbb1590f952e3cdbcb0753b745
2010-07-01 19:01:56 +00:00
dan 89ccf4481b Add pager test cases. Change a condition in pager.c to NEVER().
FossilOrigin-Name: a8f6341d3b12d64ef56ed05226e3b4f183b8957d
2010-07-01 15:09:47 +00:00
dan 6b63ab47d7 Add further test cases. Fix an assert() in pager.c.
FossilOrigin-Name: 8e65c0e3dac400f6a0ec3b7494fba62c14ed6182
2010-06-30 10:36:18 +00:00
dan 3ad5fd2502 Do not call pager_open_journal() from within PagerBegin() if the connection is in exclusive-access mode. It will be called from within PagerWrite() just as it is for non-exclusive mode anyway.
FossilOrigin-Name: cdf2c5c2dd2e4404ffb85a680d31307afea266eb
2010-06-30 04:36:03 +00:00
dan ba3cbf3d4b Add coverage test cases. Have sqlite3_backup_step() transform SQLITE_IOERR_NOMEM to SQLITE_NOMEM before returning.
FossilOrigin-Name: 5e19bc360e098ec06a72f4a86254d8e62e93ea57
2010-06-30 04:29:03 +00:00
dan c8ce39723d Add tests to pager1.test and pagerfault.test.
FossilOrigin-Name: 008513ee6115f8d6f4b4e1428c1c638282b971a3
2010-06-29 10:30:23 +00:00
dan d353331aba Add extra pager tests.
FossilOrigin-Name: 6b7e419ddc241f457dd69878f09f5c51c70aa379
2010-06-28 19:04:02 +00:00
dan 38e1a279c9 Fix some errors when compiling with SQLITE_OMIT_WAL.
FossilOrigin-Name: 3b68cb9c656db8c5c481199919a98f5764f7ebfa
2010-06-28 11:23:09 +00:00
dan 9c788140f7 Remove debugging code from test script.
FossilOrigin-Name: a85ae33246226801f88c1e377725c192711797cc
2010-06-28 11:06:53 +00:00
dan 1db95106ee Currently, if SQLite cannot find a table or index referred to by a query, it reloads the database schema from disk to see if the table or index has been added since the schema was cached in memory. Extend this behaviour to columns (which may have been added using ALTER TABLE) and fix some obscure cases related to tables and indexes (INDEXED BY, DROP TABLE etc.).
FossilOrigin-Name: 4932f22848b3d15a2b6dc5fa2cd69ce19182e2a4
2010-06-28 10:15:19 +00:00
drh 7750ab48f5 Make walIndexTryHdr() a private function. Fix an issue with SQLITE_MUTEX_NOOP.
FossilOrigin-Name: ec65bbd06bdd3bf16a742c5bb1fab0dce756c01a
2010-06-26 22:16:02 +00:00
drh ff82894faa Suppress various compiler warnings.
FossilOrigin-Name: e82d008eaffb5522080cad6c69c1b194b78eadbd
2010-06-26 21:34:06 +00:00
drh 37f9918758 Fix two asserts on the scratch allocator to allow for up to two outstanding
scratch allocations per thread.

FossilOrigin-Name: f149b498b6ada3fc9f71ee104c351554c80c7f8a
2010-06-26 20:25:30 +00:00
drh 7d113eb0ab Suppress a couple uninitialized variable warnings.
FossilOrigin-Name: 29571e228cc85f7768c3ad57d0c7af96b5a54983
2010-06-26 20:00:54 +00:00
dan 4013130485 Add test file tkt-d11f09d36e.test.
FossilOrigin-Name: 6e469b63fab3cd63b23110aaceccfed0587c6a87
2010-06-26 19:03:30 +00:00
drh afb15027e8 Remove a NEVER() in pager that can in fact be reached in obscure failure
cases.

FossilOrigin-Name: 42b8bd1c70d8dbbc4a59e2fdee8654c4fe84f979
2010-06-26 19:02:33 +00:00
dan 6ce60746c1 Fix a case where the doNotSyncSpill flag may remain permanently set following aIO error.
FossilOrigin-Name: 56c7d111bf7013be95a4c2a657a4861eee91db91
2010-06-26 17:15:07 +00:00
dan 273f3f0d1a When synchronous=NORMAL, use the same journal file format as with synchronous=FULL (i.e. multiple journal headers within the one journal). Fix for [d11f09d36e].
FossilOrigin-Name: 2eaf5ee0d9338de8a77fb3e06ad2f2b0daa6fcbe
2010-06-26 15:42:33 +00:00
dan f9b4419d39 Further test cases for pager1.test and pagerfault.test.
FossilOrigin-Name: bfd563c4714d86805fa09ce9f4f807e5d502a99b
2010-06-25 19:09:48 +00:00
dan 52d6fc0eda Reduce the average (but not maximum) size of the allocations made as part of a checkpoint.
FossilOrigin-Name: 4a7fd91b7ab2c5d21fbac7f6f123820c8f4ec7f6
2010-06-25 16:34:32 +00:00
dan bdf1e2437e Reduce the size of the large allocation (approx 8KB for every 4000 frames in the log) that occurs during checkpoint. Use the 'scratch' memory for this allocation instead of the general purpose allocation.
FossilOrigin-Name: 29887487ed549f97c3c9b37f852bae179b6ea9a9
2010-06-25 15:16:25 +00:00
drh 4a466d3ef3 Fix up a branch in sqlite3ValueFromExpr() so that we can achieve full
branch test coverage regardless of whether or not SQLITE_ENABLE_STAT2 is
used.

FossilOrigin-Name: af471ed79f539ff495f6d4cb3b69188c8af7ae3d
2010-06-25 14:17:58 +00:00
drh d36f660d5b Change the name of the shared-memory file on windows from *-wal-index to
*-shm, for consistency with unix.

FossilOrigin-Name: 5995cb15080cfb707ddda501f975673f658106f7
2010-06-25 12:52:47 +00:00
dan f544b4c4b8 Modify the merge-sort in wal.c so that it does not use recursion.
FossilOrigin-Name: daea6c054cee3564d8460d876b78a325ebc382dd
2010-06-25 11:35:52 +00:00
dan ec6ffc1a6a Add test cases to pager1.test and pagerfault.test.
FossilOrigin-Name: 4941e437d2638f36ac8510d4a5b4c780afc798bb
2010-06-24 19:16:06 +00:00
drh 314f30db22 Revert to allowing a cache spill during writes of multiple pages within a
single sector as long as the spill does not require a journal sync and a
new journal header.

FossilOrigin-Name: 7d83fbae9802a56b2121d0775de54fccd743d971
2010-06-24 18:36:33 +00:00
dan cfa800cb36 Modify ctime.test to work with SQLITE_THREADSAFE=2.
FossilOrigin-Name: c6db3b303182202a8b03512e448607bce71de914
2010-06-24 17:37:57 +00:00
drh 7cf4c7adf0 Disable memory-pressure induced cache spill during savepoint rollback.
FossilOrigin-Name: a55eb4c3e9fa4ea43b8f8182eb9e39138df03f52
2010-06-24 14:52:25 +00:00
dan 0a6052ec51 Add a coverage test to pagerfault.test.
FossilOrigin-Name: b58db67e972b5660e62a9b7daa2c1e87c3cf0a68
2010-06-24 13:24:26 +00:00
dan dca321aed4 Add coverage tests. Remove a NEVER macro from pager.c, as the condition can now be true in wal mode.
FossilOrigin-Name: 7aac9ad6dd14b1c56eb8e4750ac769c6197c30bd
2010-06-24 10:50:17 +00:00
drh a927e94e71 Make sure the wal-index reader detects an incorrect version number even if
it had to hold a lock in order to read the wal-index.  Also, expand and enhance
various comments in wal.c.

FossilOrigin-Name: 2e6a462cebc05bfd4648d26dd5ae70b68844aa5f
2010-06-24 02:46:48 +00:00
drh cd28508e58 Fix and/or improve comments in wal.c. No code changes.
FossilOrigin-Name: ee9991be082202c6637adb47affc777e7917be04
2010-06-23 22:00:35 +00:00
dan 346e426753 Add test case for SQLITE_FULL errors to pagerfault.test. Remove a NEVER macro in pager.c that this hits.
FossilOrigin-Name: 3e9680c4c18140d083b24e05a21ea6792aef2487
2010-06-23 19:27:36 +00:00
drh 75e876be30 Include the SOURCE_ID value in the log messages output for corruption, misuse,
and CANTOPEN errors.

FossilOrigin-Name: 1727a81fed65bebfea43e0bda271584096d82785
2010-06-23 17:59:51 +00:00
drh bd9676c19e Adjust the shared-memory locking range to account for the new version number
values in the wal-index header.

FossilOrigin-Name: a6dc0df304876b51cef5402b0e21330f10aabccf
2010-06-23 17:58:38 +00:00
dan 10f5a50e57 Add a version number to the wal-index header. If SQLite encounters a version number in either the wal or wal-index files that it does not understand, the operation is abandoned and SQLITE_CANTOPEN returned.
FossilOrigin-Name: 8d0f8a7f70d6fb42369411a934b30f8c8ca8322f
2010-06-23 15:55:43 +00:00
drh b316cb22de Fix the xCurrentTimeInt64 interface on windows. It was off by a factor of 10.
FossilOrigin-Name: 51ef43b9f7db8fabf73d9c8a76dae6c275e50d58
2010-06-23 15:18:11 +00:00
drh a64febe1d2 Simplifications to the pager_delmaster() implementation.
FossilOrigin-Name: 8bfbdec647d29f0eb103ba7deb9116c44193f2e1
2010-06-23 15:04:27 +00:00
drh a715211820 Disable code used only by the codec when the codec is not deployed.
FossilOrigin-Name: 2c90276e340aa19d78d2e33c9f759f8eda0b82a3
2010-06-22 21:15:49 +00:00
dan 47ee386f06 Add codec support to wal mode.
FossilOrigin-Name: 393741eba353d5d242b8e3c96db3ea2b92228036
2010-06-22 15:18:44 +00:00
drh 242c4f7702 When trying to transition from journal_mode MEMORY to WAL, use OFF as an
intermediate journal mode.

FossilOrigin-Name: 4775b8f9a9d9b66fcd5abf3af111fcad249e662e
2010-06-22 14:49:39 +00:00
dan 68928b6c3e Some changes to test scripts related to codec enabled versions of sqlite.
FossilOrigin-Name: 85dd51a75c75b2a123744f646e04538e4e5d89b3
2010-06-22 13:46:43 +00:00
dan 3c3dd7b927 i
Fix problem with handling of -vfs option in tcl interface.

FossilOrigin-Name: 8f98e8b5a557db5759747f3aae5ea01fb0d1f455
2010-06-22 11:10:40 +00:00
drh 39cf51097f Minor tweaks to get the pager working for corner cases when the
SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN flag is set.

FossilOrigin-Name: 82b38fca1aea345ade954517661145f1859e701c
2010-06-21 21:45:37 +00:00
drh de3c301d63 Fix comment inside the pager_unlock() routine. Always close the master
journal file before trying to delete it.

FossilOrigin-Name: f820b815c9bff368eb1ccb850966a812151e610e
2010-06-21 20:19:25 +00:00
dan 0e986f51a4 Add test cases to pager1.test and pager2.test.
FossilOrigin-Name: cc9ddae6d72b214f52b8949e644b91f4ab340a28
2010-06-21 18:29:40 +00:00
drh 24f0f7716a Merge the experimental UNDELETABLE_WHEN_OPEN optimization into the trunk.
FossilOrigin-Name: ee0acef1faffd480fd2136f81fb2b6f6a17b5388
2010-06-21 12:47:41 +00:00
dan e08341c664 Change things so that journal2.test works with ENABLE_ATOMIC_WRITE.
FossilOrigin-Name: a64d96db09ef2b7651fa4e98d3c7bf3ae5d3fe96
2010-06-21 12:34:29 +00:00
dan 153eda0aa4 Add further pager tests.
FossilOrigin-Name: 4104b175a8c3560a7680f3d2b54416821bb2e19d
2010-06-21 07:45:47 +00:00
dan 248af428ea Merge latest trunk change.
FossilOrigin-Name: f6d26e07b70965e332b1589804ca938593a5f432
2010-06-21 06:00:15 +00:00
dan 672b41beaa Fix jrnlmode2.test so that it works on systems where UNDELETABLE_WHEN_OPEN is defined.
FossilOrigin-Name: 59be370e52ec814c45efa6cbac45b6df94661b54
2010-06-21 05:40:49 +00:00
drh 19515c8da1 Fix an uninitialized variable in os_unix.c.
FossilOrigin-Name: 822a0283c6bc1c75001f3d1c528a4ff89c6b039c
2010-06-19 23:53:11 +00:00
dan c548b78310 Fix an assert() failure that could occur if compiling with OMIT_SHARED_CACHE.
FossilOrigin-Name: 3e76a9f2c041a6d36614f540bb89588703d85925
2010-06-19 19:06:33 +00:00
dan 8ce49d6ac0 Change the name of IOCAP_SAFE_DELETE to IOCAP_UNDELETABLE_WHEN_OPEN. Have the xDeviceCharacteristics() method of the win32 VFS return this flag.
FossilOrigin-Name: 5a5ff4e3e4c707464f227907d0aefb8ef42180dd
2010-06-19 18:12:02 +00:00
dan 146ed78b78 Add tests to pager1.test and pagerfault.test.
FossilOrigin-Name: f5df83fd875073eee8e2269e87e2a8c9c7abc981
2010-06-19 17:26:37 +00:00
drh 7234c6d6f6 Change the unix VFS to always allocate shared-memory using a file in the
same directory as the database.  Otherwise, a chroot might cause different
processes to use different shared memory files resulting in database
corruption.

FossilOrigin-Name: 2241788bc85fbc48e9cfecb95fe0a858338e37cb
2010-06-19 15:10:09 +00:00
dan de4996e2ee Add tests to pager1.test and pagerfault.test.
FossilOrigin-Name: 58c0b5bfed8c67cc3f2f4a6784d08c14e652c265
2010-06-19 11:30:41 +00:00
dan 1f4cb65a9e Add tests to pager1.test.
FossilOrigin-Name: 582fca89195af54e9668af249691654cfea63d04
2010-06-18 18:59:49 +00:00
dan d956efebea Rearrange some code in OP_JournalMode to avoid incorrect returns from subsequent invocations of "PRAGMA journal_mode" following an IO error.
FossilOrigin-Name: ce0a4a9b5f981d066822a9ae63740c91b35bfc60
2010-06-18 16:13:45 +00:00
dan 83acd423a1 Change the implementation of the unix implementation of xAccess() so that it returns 0 (does not exist) to an SQLITE_ACCESS_EXISTS query on a file that exists but is zero bytes in size.
FossilOrigin-Name: 077b0e5bcd849130c8df373fc2134c4b44351882
2010-06-18 11:10:06 +00:00
dan be5c10477c Apply [b9b11855e8] (the alternate fix to [fc62af4523]) to the trunk.
FossilOrigin-Name: 9a949a3a5c32b8bfbb94e10e18d050ec80a25553
2010-06-17 17:05:53 +00:00
dan cd27cffa97 Merge trunk change [7c3a86b9c7].
FossilOrigin-Name: bd7bc4e0e28bc749034ff1a9290a69330c5d8ca4
2010-06-17 16:44:52 +00:00
dan 731bf5bcf8 A different fix to [fc62af4523]. When changing from journal_mode=PERSIST or TRINCATE to some other rollback mode, delete the journal file only if a RESERVED lock can be obtained on the database file first.
FossilOrigin-Name: b9b11855e8a9522309dd30e5256bb67d67e1353a
2010-06-17 16:44:21 +00:00
drh 0cf68fa4c6 Fix the tkt-fc62af4523.test to work around non-randomness of the
randomblob() function when in testing mode.

FossilOrigin-Name: 7c3a86b9c7e2a35ce755c32b38e911e79d843fad
2010-06-17 16:08:53 +00:00
dan b70f82a7a5 Fix bug in journal2.test.
FossilOrigin-Name: c1e04f1d4e8575ebc41b5b4403dbfe3f60d578dc
2010-06-17 11:36:28 +00:00
dan 24827d0c0f Merge trunk updates with experimental branch.
FossilOrigin-Name: 9f6ea1de5abab0ca28688e257ddf03c66413cf6e
2010-06-17 10:52:07 +00:00
dan 7c6d618615 Do not delete the journal file in "PRAGMA journal_mode" commands. This fixes [fc62af4523].
FossilOrigin-Name: 1ec74591a93e8b27ad3ac739914a48a91972e82c
2010-06-17 10:42:06 +00:00
dan cb0a7a7267 Add test case for [fc62af4523].
FossilOrigin-Name: cccd32c692057beb08a994102c6a10126ddeb937
2010-06-17 10:24:27 +00:00
dan c002518074 Merge fix [f80c3f922a] with experimental changes.
FossilOrigin-Name: 20133e9ca98f5e6c42051ed3d65e4eb71d5366a5
2010-06-17 06:19:53 +00:00
drh b28e59bbbb Bug fix: Only trust the database size number at offset 28 if the change
counter at offset 24 matches the version number counter at offset 92.
This prevents corruption in the case of two applications writing to the
database where one is an older version of SQLite and the other is a newer
version.

FossilOrigin-Name: f80c3f922a114e738613955a939db46cf0847038
2010-06-17 02:13:39 +00:00
dan 2a321c7547 Experimental change: On systems where it is not possible to unlink a file while one or more processes has it open (i.e. not unix), avoid closing the journal file each time the database is unlocked and reopening it at the start of each transaction.
FossilOrigin-Name: bede8c8a148fb9be5ffbf38df7fa733e35cc68c3
2010-06-16 19:04:23 +00:00
dan 53f04f3b3f Add extra test cases to pager1.test.
FossilOrigin-Name: ad3209572d0e6afe5c8b52313e334509661045e2
2010-06-16 12:30:10 +00:00
dan b0ac3e3a17 Fix a memory leak that can occur in os_unix.c if an IO error occurs within the xUnlock method.
FossilOrigin-Name: 6c5c04eea1f0e8d61883ee8675c249fbf895dc01
2010-06-16 10:55:42 +00:00
dan a4a9095ec0 Rationalize a common pattern in tcl test cases into proc do_multiclient_test.
FossilOrigin-Name: efe44564983f115017658dd8a130226366d42bab
2010-06-15 19:07:42 +00:00
dan 2fce9ab3f8 Fix a problem introduced into lock2.test by the previous commit.
FossilOrigin-Name: c1c9f6fa9d75df740e577dbc5e6a24b91ad2bdd0
2010-06-15 18:00:06 +00:00
dan e91a54e1be Add test file pager1.test, containing tests of inter-process locking in non-wal mode.
FossilOrigin-Name: 6e43eed9310bae9ca5e91f8fd9eafc45a16b7019
2010-06-15 17:44:47 +00:00
dan 3a3803b61a Run extra iterations in wal3.test to ensure test coverage.
FossilOrigin-Name: ea80cbe51e33d6a3f15a4ad56f360fc5323866de
2010-06-15 14:21:17 +00:00
dan 422309c447 Merge in [2c5e48a485].
Merge in [2c5e48a485].
Merge in [2c5e48a485].

FossilOrigin-Name: 03c0f4fd9cbb655477b63ebbb6af7822715644aa
2010-06-15 14:06:06 +00:00
drh cc3af5156e Minor tweaks to the interface documentation - adding hyperlinks.
FossilOrigin-Name: 07b2fdd1cebbdbde5098a662eea65a0c9e8b5442
2010-06-15 12:09:06 +00:00
drh ffca43014b Updates to comments and testcase() macros in wal.c.
FossilOrigin-Name: 4d90cc0bc07e791b2838fc384866bd5c2282f681
2010-06-15 11:21:54 +00:00
dan 0626dfc3dc Changes to the way tcl test scripts work. No changes to production code.
FossilOrigin-Name: 2c5e48a4855e2ec4572697c8fcfe4433e302ef33
2010-06-15 06:56:37 +00:00
drh f886b4f851 Fix an error in the walfault.test script introduced by the previous check-in.
FossilOrigin-Name: a2b9374fc6f0aba2d465d432e1124bd957aab548
2010-06-14 18:06:20 +00:00
drh 6b017cc6d4 Move the xShmMap method to in between xShmLock and xShmBarrier, since it seems
to fit in there logically.

FossilOrigin-Name: 58dfd83d8b7905391e2a06bb918ffa209c6de6b5
2010-06-14 18:01:46 +00:00
drh 6f72beb20c Merge the experimental shared-memory mmap-by-chunk changes into the trunk.
FossilOrigin-Name: f295e7ed5f04f6b8bffdaff8b565be3836ce4e80
2010-06-14 17:09:53 +00:00
dan 9785fc9510 Add the new xShmMap (formerly xShmPage) to os_win.c.
FossilOrigin-Name: 13e7a8242206bca4b5bf356ef074e66474d39609
2010-06-14 16:16:33 +00:00
dan 188019153d Remove xShmGet/Size/Release from the sqlite3_vfs structure. Change the name of xShmPage to xShmMap. Remove some code that is now unused from os_unix.c and some of the test VFS implementations.
FossilOrigin-Name: fc0cabc15c97dde6a852b4f07df6d30f1d2c04bc
2010-06-14 14:07:50 +00:00
dan ad3cadd8b2 Update some comments in wal.c. No code changes.
FossilOrigin-Name: 1ce9c92bffa5d7f8431c005b29d698b0f5b95875
2010-06-14 11:49:26 +00:00
dan d60bf11036 Change the interface to internal function walGetHash() to make it easier to follow.
FossilOrigin-Name: 5e8e2e978ea48ce4ad93a936c838934f33d665df
2010-06-14 11:18:50 +00:00
dan 067f3165d8 Add the xShmPage method to the "crash" vfs in test6.c.
FossilOrigin-Name: 1008f536440840da7d56c01ec147a25295fd1fd4
2010-06-14 10:30:12 +00:00
dan 5d656852f7 Add some fault-injection tests to improve coverage.
FossilOrigin-Name: 37b26d125f4b1d8e75bb38800fefd145611f94aa
2010-06-14 07:53:26 +00:00
dan 4280eb3004 Fix some problems with handling IO errors on the experimental branch.
FossilOrigin-Name: eade8bc238df580412f5cf1b91a91532ae671e46
2010-06-12 12:02:35 +00:00
dan 13a3cb82ce Experimental change to the xShmXXX parts of the VFS interface.
FossilOrigin-Name: ca68472db01c14a899892007d1cbaff5e86ae193
2010-06-11 19:04:21 +00:00
drh 0b9b4301b8 Refactor and simplify the logic used to change journalmode.
FossilOrigin-Name: 95cc3f6fdec5494560c3cd4439d06870d1c62506
2010-06-11 17:01:24 +00:00
drh 5130c31b0c Adding original art for the new SQLite logo.
FossilOrigin-Name: af353bd89e5ec89f113d217225cc59cbc8373d64
2010-06-10 16:25:55 +00:00
drh 23e35723a7 Add the SQLITE_TESTCTRL_PGHDRSZ verb for sqlite3_test_control() used to get
the size of pcache headers for testing purposes.

FossilOrigin-Name: 5d694f04fecf47ca325e108d463c24f42def55d5
2010-06-10 14:07:40 +00:00
drh 007d6c3a36 Update the test VFS in test_journal.c so that it implements the
xCurrentTimeInt64 method.

FossilOrigin-Name: ec3b4a7e5d3d7bd737d356b8a09ce94f8f0f8ce0
2010-06-10 10:51:27 +00:00
dan 026e598d0f Store the MemPage structure in memory following, instead of preceding, the page data for cached pages. This reduces the likelihood of a corrupt database page image causing SQLite to read past the end of a buffer.
FossilOrigin-Name: 0ce42e76654d9ba52dac74c940d38b17866016ba
2010-06-10 06:53:26 +00:00
drh 0350c7fa26 Remove a condition that must always be true. Replace it with an assert().
FossilOrigin-Name: 7abcd54ec09e8025193d1e0ea57775051d823801
2010-06-10 01:07:42 +00:00
dan 3ccd20a7a9 Fix test script problems causing errors in the "inmemory_journal" permutations.
FossilOrigin-Name: ea05b7f929e4696175dbc3ded36dba8ed2a6b575
2010-06-09 19:01:02 +00:00
dan 199100e2cd When restarting (wrapping) a log file, set all unused aReadMark[] slots to READMARK_NOT_USED instead of 0. Setting them to 0 does not cause a problem, but may cause SQLite to obtain and release a few more file locks than would otherwise be necessary.
FossilOrigin-Name: 0797b10c0cc08ae38e26685d1f8331e37d428781
2010-06-09 16:58:49 +00:00
dan 6ac4339439 Fix for ticket [f973c7ac31].
FossilOrigin-Name: 6eb058dda8d5f87b02378d8efd821fe64a525dcc
2010-06-09 15:47:11 +00:00
drh db7f647e41 Shift the meaning of aReadMark[] back so that +1 offset from mxFrame is
removed.  Add the new READMARK_NOT_USED value (0xffffffff) instead of
zero to signal an aReadMark[] that is not in use.

FossilOrigin-Name: c576827d55c156572b76cf7063e9f253ca6e7403
2010-06-09 14:45:12 +00:00
dan 15651f61df Simpler fix for the race condition also fixed by [7c102c7b5f]
FossilOrigin-Name: 3c2de820034e01c2e939bd90a05a58159f60df50
2010-06-09 11:28:43 +00:00
dan e4bddc1fab Close database opened by tester.tcl when it is sourced in all.test. Because test scripts are now run in slave interpreters, this connection was not being closed by the first script run as it was previously.
FossilOrigin-Name: b072e9f69ad5ec68b8ec4c716556070001f885e0
2010-06-08 15:50:53 +00:00
dan c60f10a27f Changes to wal3.test to support small default cache size settings. And builds that create autovacuum databases by default.
FossilOrigin-Name: ac4cc2574bafce30390a34f13228380d017791cb
2010-06-08 15:16:10 +00:00
dan 7df6c2c04b In os_unix.c, call munmap() to unmap a shared-memory region prior to closing the associated file descriptor.
FossilOrigin-Name: 95cc976f1520bdaedd8f93b0e9fbef94e4e2c8cc
2010-06-07 19:26:54 +00:00
dan 430e74cd9b Change all.test, quick.test and permutations.test so that they use a separate interpreter for each test file.
FossilOrigin-Name: 7c33eb5a5add8fe76dd412ecab5b6ff8cd78a98d
2010-06-07 17:47:26 +00:00
dan c1a60c51dc Refactor some of the global variables and commands used by tester.tcl.
FossilOrigin-Name: c2edf8e17f874d0ca4e94b75575bf6e14eea1f05
2010-06-07 14:28:16 +00:00
dan 23f719207f Add a couple of extra coverage tests for wal.c.
FossilOrigin-Name: cfe60254df50f086014b115f1a2d9e31c85d67fd
2010-06-07 06:11:39 +00:00
dan 640aac48f3 Add further test cases for the logic in sqlite3WalBeginReadTransaction().
FossilOrigin-Name: a49713db39d0d6940b368206d4e669aa69aa1fe5
2010-06-05 19:18:59 +00:00
dan eb8cb3a851 Clarify the purpose of a test for a race-condition in walIndexReadHdr().
FossilOrigin-Name: c041c6a9786bc9ebb82527f7a2c96d255aec927f
2010-06-05 18:34:26 +00:00
dan 493cc590b6 Remove a condition from sqlite3WalRead() that is unreachable as of the changes to clear entries out of the wal-index hash tables on transaction or savepoint rollback.
FossilOrigin-Name: 394204735a842b04b677cca20485b1578e475d4c
2010-06-05 18:12:23 +00:00
dan 0626bd65fb Mark a condition in wal.c as ALWAYS().
FossilOrigin-Name: 3fe0cc784ac586358c08f87fba458dfbb5eec6f2
2010-06-05 14:42:57 +00:00
dan ef4ee8f274 Add extra coverage test cases for wal.c. No changes to production code.
FossilOrigin-Name: f9d4ae0e8cc5d32c52eb78799f7959dd236ea9de
2010-06-05 11:53:34 +00:00
dan 3cac5dc9bc Clarify an assert in sqlite3WalExclusiveMode().
FossilOrigin-Name: 255850699ddbf4aad8cc3223aefbada35daa0703
2010-06-04 18:37:59 +00:00
dan 0153a9bc04 Remove an unnecessary branch from wal.c.
FossilOrigin-Name: 8e54786c9a0c5c399f228f56c73271f84d75694b
2010-06-04 17:16:52 +00:00
dan 0dc7b74fbe Add an English language error message to corresponding to SQLITE_PROTOCOL. "locking protocol".
FossilOrigin-Name: ca327e32cfe1633f2c9d3f058e411f108aaa2b3c
2010-06-04 15:59:58 +00:00
dan 23dced35ea Add test for the code that detects an inconsistent pair of wal-index headers to wal2.test.
FossilOrigin-Name: 157feba10f7ac01eecf79715c44bb16c98958280
2010-06-04 12:22:35 +00:00
dan d764c7de25 If an attempt to sync the database file as part of a checkpoint fails, do not update the shared "nBackfill" variable. Otherwise, another process could wrap the log and overwrite content before it is synced into the database.
FossilOrigin-Name: b813233d7604a5fd91e1af91d5d812032eec700a
2010-06-04 11:56:22 +00:00
dan 83f42d1b38 Fix a problem where an SQLITE_BUSY in the checkpoint code was being treated as an IO error (abandoning, instead of just limiting, the checkpoint).
FossilOrigin-Name: 02c4040ce2b4c970b3dee09f7c9ad5a2a3a9aa49
2010-06-04 10:37:05 +00:00
dan d03f523d3b Fix another problem in test_vfs.c.
FossilOrigin-Name: df7d59899ceb2743764b0433cb68f4bc33f16344
2010-06-03 19:10:08 +00:00
dan 961ff45104 Have test_vfs.c simulate IO errors in xShmLock.
FossilOrigin-Name: fcbf7cf189506e43fc2f0820aedffb195038d3a9
2010-06-03 18:20:19 +00:00
drh 05cb5b244b Performance fix for winShmClose().
FossilOrigin-Name: ed7774de04978803e979580240148eba1de9166d
2010-06-03 18:02:48 +00:00
dan db9d981a8d Add extra tests for removing elements from wal-index hash tables as part of a rollback.
FossilOrigin-Name: af3e598ad9315a4642dd8fa098dfdbd727770aed
2010-06-03 16:58:46 +00:00
dan 459564f43f Delay opening the sub-journal until SQLite actually needs to write data to it.
FossilOrigin-Name: c43deb33ae5f191ea2e054181759beeeb9ea71bf
2010-06-03 12:35:28 +00:00
drh f83dc1ef3f Remove global variables when compiled with SQLITE_OMIT_WSD
FossilOrigin-Name: dd10a547f10364058025c48b28d8fd240bf46aff
2010-06-03 12:09:52 +00:00
dan 1f55e28d2a Enhancements to test_vfs.c and walfault.test.
FossilOrigin-Name: ac0de2f39e948f3b00e96eebf56ebee70472020d
2010-06-03 09:25:10 +00:00
dan 40ad9d2870 If an error (OOM or SQLITE_FULL error) occurs while executing an SQL statement and a statement-transaction is automatically rolled back as a result, if a second error occurs during the statement rollback do a full transaction rollback instead. Otherwise the client can be left with an inconsistent cache.
FossilOrigin-Name: eb80ddc665132c607c258b59131025a296269dad
2010-06-03 09:17:38 +00:00
dan 8e64db2b09 If a malloc fails while allocating a savepoint object at the pager level, do not try to roll that savepoint back later on.
FossilOrigin-Name: 91cb08ffb6332a142542c012b58aa49206ee5704
2010-06-03 09:01:11 +00:00
drh 2d37e1cfb9 When a lock fails due to an I/O error (not an SQLITE_BUSY) then the checkpoint
should fail.

FossilOrigin-Name: c6eb0a27270df69018576232d8f97c16d63d8f6e
2010-06-02 20:38:20 +00:00
dan 6e6bd5658f Fix a problem with rolling back to a savepoint opened before the writer decided to wrap the log file.
FossilOrigin-Name: 6b4aed6aae7dc9e92807d27375cbe1e83c15841b
2010-06-02 18:59:03 +00:00
dan 10ec894c3a If an error occurs while writing frames to the log to commit a transaction, do not mark the pages as clean in the cache. Otherwise, the subsequent rollback does not roll them back (leaving the client to continue with a cache that makes it appear that the transaction was committed - inconsistent with the database on disk).
FossilOrigin-Name: cb571c1b71a37b3a10d640987c77a6eec508235d
2010-06-02 17:15:24 +00:00
shaneh 2796d336d2 Added implementation of vfslog_time() for Windows testing.
FossilOrigin-Name: b3109f85bde0b24bfbcfe6c0f7bbe973be196c1d
2010-06-02 16:40:54 +00:00
shaneh a1a889ecb4 Updated wal2.test for windows testing.
FossilOrigin-Name: c3606f3985e4ab38479409c13f3a01d1be4f8189
2010-06-02 16:39:53 +00:00
drh c11895b808 Make sure the directory used by os_unix.c for shared-memory files is always
the same, regardless of individual client permissions and environment
variable settings.

FossilOrigin-Name: f97bd520f06a16c61ccdd9ebeda7e138896b9ac2
2010-06-02 15:59:05 +00:00
drh 38933f2c11 When walTryBeginRead() encounters an I/O error trying to set a lock
(as opposed to SQLITE_BUSY) be sure to propagate that error back up
the call stack.

FossilOrigin-Name: aa2c2b67a7f50c97a44cca1af5c437bf5410869c
2010-06-02 15:43:18 +00:00
drh aab4c02e47 Changes to make WAL more robust against SHM locking failures and OOM errors.
FossilOrigin-Name: ebf4041383c3cdddb5861960359abd209d4a1028
2010-06-02 14:45:51 +00:00
drh 048129dcb9 In the rowhash.test, make sure global variables are cleared prior to use.
FossilOrigin-Name: 28efe0a40405567f3eaf334b6603282d5adac792
2010-06-02 14:43:30 +00:00
drh 0af3723478 Undo one of the "const" markers from the previous check-in because the
value needs to be changable, even if it is not actually ever changed in
the current implementation.

FossilOrigin-Name: c24ac3563f46fc6bcf7e45ee171afd3ae7d2faa8
2010-06-02 12:58:22 +00:00
dan 558814f8c6 Add some 'const' markers to static data that is really constant.
FossilOrigin-Name: e7073e23b80e7cae0c76d42f014ee9b2d40a8f2f
2010-06-02 05:53:53 +00:00
drh 8b3cf82ddf The shared-memory used by WAL on linux now really is shared memory in /dev/shm.
On other unix flavors, the file is in a temporary directory rather than in the
same directory as the database.

FossilOrigin-Name: fc18c4aadb908c3b6f9b6481a2efca6a0daadc64
2010-06-01 21:02:51 +00:00
dan 0235ab9944 Changes to the way faults are injected into xShmXXX VFS calls.
FossilOrigin-Name: 716d99f3929b466c7a17190e0f18de8ab0e7f1fa
2010-06-01 19:15:18 +00:00
dan a4bc123f83 Change the OOM and IO error test cases in walfault.test so that each test case runs both types of error simulation.
FossilOrigin-Name: b627e1536822bb7e3ef91867661a53be0efc13ef
2010-06-01 17:46:38 +00:00
dan 9971e710e4 Delay the decision to restart the log file until data is actually ready to be written to the log file (instead of at the start of a write transaction).
FossilOrigin-Name: b1abfaaf5309cc0d0dda4fb2c237862c8cf83261
2010-06-01 15:44:57 +00:00
drh 964bf9c8bb The incremental checkpoint feature is not perfect yet, but it is working
well enough to merge it into the trunk.

FossilOrigin-Name: 1d3e569e59ba89cc167f0a48951ecd82f10322ba
2010-06-01 15:24:29 +00:00
dan 98fbfe703e Merge with [15abbc3416].
FossilOrigin-Name: f4b9003a2d3db88eaabb4b291e6cea8e8ea6ff51
2010-06-01 14:30:49 +00:00
dan f9b7671066 If an attempt to get a read-lock on the WAL fails with SQLITE_BUSY_RECOVER, call the busy-handler at the btree level.
FossilOrigin-Name: ce64496509a213c08c9dedae2a7a456b393d22e5
2010-06-01 14:12:45 +00:00
drh f77bbd9fc5 Fix a bug introduced by the previous check-in but only seen if
SQLITE_ENABLE_EXPENSIVE_ASSERTS is turned on.

FossilOrigin-Name: 9c9ec8994bf701249efce6c7bb911de4525808c8
2010-06-01 13:17:44 +00:00
drh 9c1564779e Fix an off-by-one boundary-value issue in walCleanupHash().
FossilOrigin-Name: f039552e6330b6a04281748f985b41937f534bd0
2010-06-01 12:58:41 +00:00
dan 72bcac9ca7 Do not hold the shared-memory mutex in os_unix.c if returning NULL.
FossilOrigin-Name: 9622dd468c8914262e9d8bd8dbca9e22ec6ee75c
2010-06-01 11:08:56 +00:00
dan e877296705 If the checkpoint fails to obtain an exclusive lock on one of the read-lock bytes, do not consider this an error.
FossilOrigin-Name: 9e95e35728cf69a0ae50e774d7f6c71a41b17d97
2010-06-01 10:44:28 +00:00
dan 5f3f3b2962 Fixes to the test cases in wal2.test.
FossilOrigin-Name: cd5fbcbce8b55f24c0bf349b179c26e333ff7172
2010-06-01 07:51:47 +00:00
drh 181e091ff3 Comment edits and cleanup in wal.c. No functional code changes.
FossilOrigin-Name: e8e666ab8273f5db5265f0773b39820f75b6df1a
2010-06-01 01:08:08 +00:00
drh ad24581e65 Attempt to get the filectrl.test script running.
FossilOrigin-Name: e46a8f2b752f86c4d8942ee125210516026ffdc2
2010-06-01 00:28:42 +00:00
drh b29ad8502e Fix os_unix.c so that it will compile and build on a Mac.
FossilOrigin-Name: bc707c83e5f9849d9d201d695d0d071ca9ed93cb
2010-06-01 00:03:57 +00:00
drh 61e4acecf4 Fix issues with locking_mode=EXCLUSIVE in WAL.
FossilOrigin-Name: 8deba0cebd135a18da68530fab9e7d19dc21ddcb
2010-05-31 20:28:37 +00:00
drh 4b82c387c9 Add an "isInit" field in the wal-index header that must be non-zero for
a valid header.  Use this to detect an uninitialized wal-index.

FossilOrigin-Name: a16fde190183d1ae252d1aa305b23fdb88c603dc
2010-05-31 18:24:19 +00:00
drh 15d6809222 Fix an inconsistent #ifdef in wal.c. Fix os_unix.c so that it does not allow
moving an SHM lock directly exclusive to shared without going through unlocked.

FossilOrigin-Name: 552658da2845c2323167b6c7db6e5c00090f280c
2010-05-31 16:56:14 +00:00
dan d0aa34277f Avoid dropping the checkpoint lock after a recovery run as a precursor to a checkpoint operation.
FossilOrigin-Name: cc25cfa04630a43c1de26f2dbdacbe46c110a2b5
2010-05-31 16:41:53 +00:00
dan 3dee6da994 Zero the checkpoint header as the last step of successful WAL recovery. Avoid an unnecessary lock/unlock in WalBeginReadTransaction.
FossilOrigin-Name: db3509c55dfe288650b803622e3a0828c6e59aea
2010-05-31 16:17:54 +00:00
drh 20e1f08e0b Get the new xShmLock interface design working on os_win.c.
FossilOrigin-Name: 149a7082e266edf0dc25c23823a9e240f5285215
2010-05-31 16:10:12 +00:00
drh 18b7f604aa Make sure WAL alway requests enough shared-memory space.
FossilOrigin-Name: 138f128317b6695530ca3fde7be4cdf22548cd22
2010-05-31 14:39:31 +00:00
drh 4222441dee Remove the tests that enable tracing based on the existance of the "vdbe_*"
files when in SQLITE_DEBUG mode.

FossilOrigin-Name: cdbb4e7ca7ec27e7e80dd66529d9d565f547887a
2010-05-31 14:28:25 +00:00
dan dcb1169fb7 Update another test case in wal.test.
FossilOrigin-Name: 99fde69e61d12cf95b47db70c4647c30be2d2f45
2010-05-31 14:18:45 +00:00
drh a2ac9df170 Change WAL test cases to account for the improved concurrency in the new
checkpoint logic.

FossilOrigin-Name: 2d6f2485053e6d2a67abda9a80693ca68f4556d2
2010-05-31 13:11:49 +00:00
drh 34116eaf6a Do not fail a checkpoint just because active readers prevent backfill.
FossilOrigin-Name: 9aa4243e0cedcc9204994d04af1b2b7a80c048bd
2010-05-31 12:30:52 +00:00
drh c74c333408 Add WALTRACE() macros to help with debugging and analysis.
FossilOrigin-Name: 765c33181a7b9d99b452ce750d69f217b3c81a5d
2010-05-31 12:15:19 +00:00
dan 1beb939db1 Another minor fix to checkpoint on the WAL branch.
FossilOrigin-Name: 853f1e3f7720af2723b552bdf086bb106e6e93fe
2010-05-31 12:02:30 +00:00
dan 0cc5b2b6c6 Fix a bug in checkpoint introduced by [181ceb32ea].
FossilOrigin-Name: b499dbc88a67b4200b5f527be88be4ac90f7043f
2010-05-31 11:39:53 +00:00
dan d54ff60bf4 Fix some asserts and other things in the new WAL branch.
FossilOrigin-Name: 181ceb32ead7f540a7c6437f53a5b0f3e78162db
2010-05-31 11:16:30 +00:00
dan 8521abfd48 Changes to the way one of the WAL/OOM tests works.
FossilOrigin-Name: 15abbc34168f7a5bd418254c2b16aac97029e6ea
2010-05-31 06:38:34 +00:00
drh c99597ca10 WAL runs but quickly deadlocks.
FossilOrigin-Name: ace58acbf1fad13d2be96cafebc3a22875098d03
2010-05-31 01:41:15 +00:00
drh 73b64e4d2e Initial code for incremental checkpoint in WAL mode. This check-in compiles
on unix and runs as long as you do not engage WAL mode.  WAL mode crashes and
burns.  Consider this check-in a baseline implementation for getting the new
capability up and running.

FossilOrigin-Name: ef3ba7a17ff90674d702e5694b9e792851ab6998
2010-05-30 19:55:15 +00:00
dan a7a0c615d7 Add tests to fkey2.test to check that ON CONFLICT clauses do not affect SQLite's behaviour when an FK constraint is violated.
FossilOrigin-Name: e9e5b1001986348ef0f88c19de87b94559a5451e
2010-05-29 08:40:37 +00:00
dan 94b7f76b96 i
i
Minor changes to checksum related test cases.

FossilOrigin-Name: 60c22bde52121993d4bea11eef38ab285c737e2c
2010-05-29 06:18:54 +00:00
dan 5f168a5d53 Add a test to walcksum.test to stress the checksum calculation.
FossilOrigin-Name: 778d0c1768f73057be912793631e0cf0575858fb
2010-05-28 04:16:28 +00:00
drh bab7b91e99 Make sure the wal-index mapping is always large enough to cover the entire
active area of the wal-index.

FossilOrigin-Name: 42705babba0e9d2ef078845854bebbd168f23366
2010-05-26 17:31:58 +00:00
drh 026ac28b28 Change the semantics of xShmGet() such that it will never increase the size
of shared memory.  xShmSize() must be used to grow the size of shared memory.
A shared memory segment size cannot be shrunk (except by dropping it).

FossilOrigin-Name: 72de00731245277b2209103ec0a76e3d4f56530e
2010-05-26 15:06:38 +00:00
drh 51b21b169a Updated header comments in wal.c. No functional code changes.
FossilOrigin-Name: 687632a6b3a0aeb006c1eda5c27d5489f08c230e
2010-05-25 15:53:31 +00:00
dan fa408ada0a Add a busy-handler to a test case in walthread.test to prevent errors.
FossilOrigin-Name: d3d348aa975c58c37088eb2830081880896b85e7
2010-05-25 15:23:51 +00:00
dan d77766edf7 Modify walcrash2.test so that it works with DEFAULT_AUTOVACUUM=1.
FossilOrigin-Name: 77438882dd53ac4d98b24e2846c87a2418b4e3d8
2010-05-25 13:49:09 +00:00
drh 1b78eaf0ba Update header comments in wal.c to correctly describe the WAL file format.
Update the locking region offsets in os_unix.c and os_win.c and add assert()
statement to verify that the locking region offsets are correct.

FossilOrigin-Name: 40030c0739f821ea8ee188c28c579507f10448bc
2010-05-25 13:40:03 +00:00
dan ca6b5baba4 If a writer exits unexpectedly in the middle of a transaction, have the following writer remove any wal-index hash-table entries left by the interrupted transaction.
FossilOrigin-Name: ed77556adcdf7011b95b9969b360269fb2ebe4e5
2010-05-25 10:50:56 +00:00
drh 82043b3077 Remove unreachable code associated with WAL from the pager.
FossilOrigin-Name: 54c1718e6d15a20414cae15895eb5e83217722e2
2010-05-25 02:24:01 +00:00
drh f53303573a OOM errors during an auto-checkpoint are benign.
FossilOrigin-Name: 3d252ce5d0d843e4e65beed672598e65c5745129
2010-05-24 20:27:44 +00:00
drh 0b9441354b Remove the walmode.test case from the inmemory_journal test of
permutations.test.

FossilOrigin-Name: 27ba9c21fb591190b73010ced394cc62c1edff54
2010-05-24 20:24:38 +00:00
drh c2857bf2a5 Fix the wal2.test script so that it works in auto_vacuum mode.
FossilOrigin-Name: 6a818afb93ca8383abb55e3835e14c74c3e3de23
2010-05-24 17:00:19 +00:00
dan 71d8991932 Change the checksum used in WAL files so that each frames checksum depends on the content of the WAL header and all frame headers and content up to and including the frame to which the checksum is attached.
FossilOrigin-Name: 8a53f12c83a107684b99f4a9de371b5ea3ca810a
2010-05-24 13:57:42 +00:00
drh c81791573a Make sure a WAL frame of all zeros is detected as an invalid frame.
FossilOrigin-Name: 02d99ad4b51065c67cc7689916130774be1c4c87
2010-05-24 13:28:36 +00:00
drh 00f699d57b Fix up test_osinst.c to work with SQLITE_OMIT_VIRTUALTABLE.
FossilOrigin-Name: 51fd38152b92db637d1d346fca35ec2d3e4d4f57
2010-05-24 12:34:14 +00:00
dan b8fd6c2fe6 Change the WAL file format to support two kinds of checksums - one that is fast to calculate on little-endian architectures and another that is fast on big-endian architectures. A flag in the wal-header indicates which the file uses.
FossilOrigin-Name: 65ba804dd1d31d1eef6ae3f40a3ade344a410b84
2010-05-24 10:39:36 +00:00
dan 9c0928dcb6 Add a couple of missing methods to test_osinst.c..
FossilOrigin-Name: 5c9e9c06ae350043e66f36087da4021a52e6ee17
2010-05-22 08:22:39 +00:00
drh 4fa95bfc39 Add several EXPENSIVE_ASSERT code blocks to validate the wal-index hash table.
Fix the bugs that these code blocks fine.  Rename walClearHash() to 
walCleanupHash() and simplify its interface.

FossilOrigin-Name: 7aade899e55f4565f02d301e1e83fb0bac2ea500
2010-05-22 00:55:39 +00:00
dan 3b1eca0ade Fix another bug in walClearHash().
FossilOrigin-Name: 40f80ffe70ca691dfa146f6d84956ed0784fc63d
2010-05-21 19:15:04 +00:00
drh c527669df5 Comment out the SQLITE_FCNTL_SIZE_HINT from os_unix.c since it does not
seem to provide any performance gain there.

FossilOrigin-Name: 7d01309da658d6b658c1b2e53bbdc5112fb0a4d9
2010-05-21 18:24:06 +00:00
dan 8067adbc3f Correct an off-by-one bug in the previous commit.
FossilOrigin-Name: 75a1130d86faf18e73cb46cda5d029f1e913e4e6
2010-05-21 16:23:43 +00:00
dan 6f1501481f Remove entries from wal-index hash tables when a rollback or savepoint rollback occurs.
FossilOrigin-Name: 36795c2b23a78978528cace193e386138adacd41
2010-05-21 15:31:56 +00:00
drh f0b20f8801 Fix the wal-index header read routine so that it correctly detects a zero
header as being malformed and in need of a wal-index rebuild.

FossilOrigin-Name: 1a4eb3a3efe86c7caff4d9a5894953bce378f841
2010-05-21 13:16:18 +00:00
drh 286a288493 Add a new xShmBarrier method to the VFS - a shared-memory fence operation.
Implement the same in both unix and win32.  Use it to make the WAL subsystem
more robust.

FossilOrigin-Name: 1bd011c9fed5ef29fb616b4d0a52df3b82221b1f
2010-05-20 23:51:06 +00:00
drh 7e263728f2 Make use of the extra information in the WAL header and frame header to
enhance robustness.

FossilOrigin-Name: 9580ecb7e3beb1949a71784a3dcd1823a88e4a9d
2010-05-20 21:21:09 +00:00
drh 23ea97b641 Convert the wal-header and frame-header to 24 bytes. Extra information in
both headers is designed to enhance robustness after crashes, though the
extra information is currently unused.  This is a snapshot of a work in
progress.

FossilOrigin-Name: 669706431f186f92fdc0856a6206419a1e843f46
2010-05-20 16:45:58 +00:00
shaneh 7c767e1113 Merge WIN32 WAL support into trunk. Still some issues with locking to resolve.
FossilOrigin-Name: 43377663fc3569c361867cdea19e8abaf91a163f
2010-05-19 23:41:55 +00:00
drh f5d6e478d3 Add the SQLITE_FCNTL_SIZE_HINT to the os_win.c VFS.
FossilOrigin-Name: 9894118d20c08951565c2096552d4a3d2413f7b0
2010-05-19 19:39:26 +00:00
drh 9ff27ecdb2 Add the SQLITE_FCNTL_SIZE_HINT operator to sqlite3_file_control() and use it
to give the VFS hints about the ultimate size of a database file when the
file is growing.

FossilOrigin-Name: 2b7e3b4a30d6a7c4a8a4b8e7dd2ed728b565c96d
2010-05-19 19:26:05 +00:00
drh 4c1cb6ab05 Fix a bug in the new checkpoint computation. Also update the checkpoint
algorithm in the test scripts to align with the new implementation.

FossilOrigin-Name: 8b6056f2ee596f31b157a792fac05d11f7cb63bb
2010-05-19 19:09:37 +00:00
drh 584c754d65 Revise the checksumming algorithm in wal.c. More variable refactoring.
FossilOrigin-Name: 542b90eba6440a0bccef329788fd17a2d3fbeee6
2010-05-19 18:08:10 +00:00
drh 6e81096fa2 Refactoring some variable names in wal.c.
FossilOrigin-Name: 1d201ff51f7c5ecdf71a91ed25204b7130894282
2010-05-19 17:49:50 +00:00
drh 027a128a78 Add a large comment to wal.c describing the WAL and wal-index file formats.
FossilOrigin-Name: a71a22b52f4570e934063553a81b39268127dc44
2010-05-19 01:53:53 +00:00
drh 29d4dbefaf Update the wal-index hash format so that hash-table space is reused following
a rollback, thus preventing hash table overflows.  Add assert()s to verify
that hash tables do not overfill.  Further refactoring of the wal-index code.

FossilOrigin-Name: ada9a8c7b69c5dd2d66bbf62b61181651e6d2142
2010-05-18 23:29:52 +00:00
drh a2a42013d2 Refactoring of the WalIterator implementation.
FossilOrigin-Name: b5b60fdcc5dcf41f2c79912075ac241f7ce220d6
2010-05-18 18:01:08 +00:00
drh 5939f44375 Mark the shared-memory in the WAL implementation as volatile.
FossilOrigin-Name: 0a6787908e989bd5e6af25acbdc59ebc8fa61d6d
2010-05-18 13:27:12 +00:00
drh e730fec883 Comment clarifications in wal.c.
FossilOrigin-Name: a029be10172e2e6a2ef4e3eb2ea1bd0ca85b16ed
2010-05-18 12:56:50 +00:00
drh 69c4696784 Remove an unreachable test from wal.c.
FossilOrigin-Name: 7162c45673d1068d1fda55a70207a3cd77575502
2010-05-17 20:16:50 +00:00
dan 982d4c0c72 Add a note to the documentation of sqlite3_wal_hook() to say not to return SQLITE_ROW or SQLITE_DONE. Or any other value that is not a valid SQLite error code.
FossilOrigin-Name: 2f0b6cbf7b4fa31242ff4f6163226c22ae4f8c9b
2010-05-15 10:24:46 +00:00
drh 89c3f2ff43 Silently ignore errors trying to set the default journal_mode while doing
an ATTACH.

FossilOrigin-Name: b9af4ad2efadfb2fb9e338dc081a6231f1536700
2010-05-15 01:09:38 +00:00
drh ff59a114bd Fix a typo that (by bad luck) was not a syntax error but which caused some
important lines of code to be skipped when SQLITE_DEBUG was not used.

FossilOrigin-Name: 9ef99d97d25aae81df971d40ad10c544b8f30053
2010-05-14 20:15:51 +00:00
drh 5c092e8a4f Make sure the value of an INTEGER PRIMARY KEY column supplied to triggers
and especially to FK constraints really contains the ROWID and not the
NULL that is stored in the column itself.  Ticket [dd08e5a988d00dec].

FossilOrigin-Name: 636f86095eb1f4bdcfb0c9ed846c4c6b3589c10b
2010-05-14 19:24:02 +00:00
drh 8323521440 Pull in all the latest changes from the trunk.
Update the win32 SHM methods to work with the new interface design.

FossilOrigin-Name: 4b69f2cd315b6b66d10e5190d235114788853258
2010-05-14 16:34:34 +00:00
drh d91c68f6cc Simplifications to the SHM implementation in os_unix.c, taking advantage
of the removal of the LinuxThreads mess.

FossilOrigin-Name: d1debe5def82a6bc72f11b8787176ac60259630f
2010-05-14 14:52:25 +00:00
drh 8af6c228f8 Simplify os_unix.c by removing support for LinuxThreads. Linux systems must
either use NPTL or else not share database connections across threads.

FossilOrigin-Name: e294b696ba91512b1ca5547774c51ea07b4cb5bc
2010-05-14 12:43:01 +00:00
drh 308c2a5c0f Change the OSTRACEn() macro to OSTRACE(()). Also rename some internal fields
and variables in os_unix.c to be more meaningful and searchable.

FossilOrigin-Name: 5fe529f239cddbf4b7ea57abb02d95cc0d94f5f5
2010-05-14 11:30:18 +00:00
dan a9f0fc8edc Fix test_osinst.c so that it does not depend on gettimeofday() unless SQLITE_OS_UNIX is defined and NO_GETTOD is not defined.
FossilOrigin-Name: 2a4014b79b852d8b62b4941495b826f154308d86
2010-05-14 10:43:28 +00:00
dan 14740f1cd5 Add xShmXXX methods to test_osinst.c.
FossilOrigin-Name: b8a9b37a3c8d1005a16185c1fc4c414ca11d736a
2010-05-14 08:39:48 +00:00
drh 72339a3e24 Make debugging elements of the sqlite3_mutex object volatile and make them
only appear when compiling with SQLITE_DEBUG.  Ticket [51914f6acd2cb462].

FossilOrigin-Name: e823c60ca4c3d515b8b12dada4631fe8f44975e9
2010-05-13 20:19:17 +00:00
drh 5cccc940cc Allow sqlite3WalCheckpoint() to be called even if the WAL is in the
SQLITE_SHM_READ state, as sometimes happens after an error.

FossilOrigin-Name: 175b296f9b9680f605537f52a8a53944deaa5391
2010-05-13 15:44:00 +00:00
dan 0bfad1171f Remerge mistaken test_osinst.c changes.
FossilOrigin-Name: e8c10d3cf601cc81a620f6c0ba5f195945a3f725
2010-05-13 09:40:30 +00:00
dan a49ba7c835 Fix mistake in test_osinst.c.
FossilOrigin-Name: 4c3e137803f86ec5a6c68bfaa29a2847ba48fd65
2010-05-13 09:32:30 +00:00
drh 5500a1f1e6 Make sure xShmGet is never called while already holding the shared-memory
segment.

FossilOrigin-Name: 92ebdbc5f64ac63796ff56c1e1aec3b95c6bdd20
2010-05-13 09:11:31 +00:00
drh 043c20e63e The refactored of VFS SHM primitives are now working so merge the
wal-refactor branch back into the trunk.

FossilOrigin-Name: bce21c18380715e894eac9c173c97315e0d69d93
2010-05-13 08:53:41 +00:00
drh a925fd256b Change the xShmSize() implementation in os_unix.c so that it will only
increase and never decrease the size of a shared-memory segment.

FossilOrigin-Name: 149d2ae4a6fe2f86822f286d2a7092c51bec7ebb
2010-05-13 08:33:35 +00:00
dan bd50ddeb42 Fix for a segfault that can follow a malloc failure.
FossilOrigin-Name: 3cab9022457ce50f82c5822d8ba6c04a3a85cb6a
2010-05-13 07:08:53 +00:00
dan 7fd555a634 Modify the VFS in test_vfs.c to match the refactoring of the xShmXXX methods.
FossilOrigin-Name: 25e72f81561575051c63e9bf5d2c8e76f9fcf5c6
2010-05-13 06:19:37 +00:00
dan fbefb894cc Change the vfs instrumentation code in test_osinst.c to make it easier to deploy. Add a vtab implementation for reading the binary log file format.
FossilOrigin-Name: ee13c8849d234931bb3be36e42383d228b3cbfcb
2010-05-12 19:02:35 +00:00
drh 365e2d255b Fix for the test_devsym.c test module for the VFS-SHM refactoring.
FossilOrigin-Name: 49d62933759d4e160ee3a4dd2aa316a2f5bbb4e6
2010-05-12 18:30:36 +00:00
drh 686138fe88 A couple simple fixes to get wal.test mostly working.
FossilOrigin-Name: c74458127468f30b16715594c8d68e9d3c05d292
2010-05-12 18:10:52 +00:00
drh d9e5c4f6ed Refactoring the VFS-SHM methods used by WAL. This version compiles and
runs non-WAL test cases but crashes and burns on wal.test.

FossilOrigin-Name: 2b00152c1ac0b3735aa6cfab61259ff04d81c701
2010-05-12 18:01:39 +00:00
shaneh 50f6455f41 Updates to WAL support in os_win.c: pulled in latest changes from src/os_unix.c; updated tracing; misc. improvements.
FossilOrigin-Name: 76504726a1ef7f6a0445ec800776462138b22d72
2010-05-12 17:14:59 +00:00
drh eaf52d883a Remove the OP_Variable optimization of check-in [48b77b04935d894] since it
can lead to malfunctions as described in ticket [26ff0c82d1e90].

FossilOrigin-Name: 7838163d087780a6fb403a17641b96f71baec088
2010-05-12 13:50:23 +00:00
dan ed36020daf Remove a branch made redundant by the earlier exclusive-mode changes.
FossilOrigin-Name: c501b2ede6aad123bef0aa7ce8b356a134eb6d26
2010-05-12 06:54:31 +00:00
dan 97c1f6c8f2 Have os_unix.c use the suffix "-wal-index" for wal-index files instead of "-wal-inde".
FossilOrigin-Name: 885e854e7cdc79ecc9d5772d563ddc0f61753ab6
2010-05-11 16:29:54 +00:00
drh be5481578a When an attempt to change journal_mode fails due to locks, be sure to
leave internal structures in a consistent state.

FossilOrigin-Name: cf3d1e0b8a739302cf2848ac3e6eaaae04e6a44c
2010-05-11 14:00:39 +00:00
dan 5543759b1b Changes so that WAL and exclusive-locking mode work together.
FossilOrigin-Name: 71e7b1cf9f4cd02a2a9bc8a3e58acd7a7e3c7e60
2010-05-11 12:19:26 +00:00
shaneh 04882a9e4a Initial port of WAL VFS support from os_unix.c to os_win.c.
FossilOrigin-Name: 111ad59f21d53d1ec63c084ca5f98f2aaf7cd070
2010-05-11 02:49:39 +00:00
shaneh a10069dd22 Updates for to WAL TCL test scripts to support running on Windows.
FossilOrigin-Name: 6a5630806c87b0f4e5632c37c357f98effd9608a
2010-05-11 02:46:16 +00:00
drh 09b1330026 Fix an off-by-one error while constructing the name of the mmap file for
the wal-index under os_unix.c.

FossilOrigin-Name: 6e3735f72cb7d2f4d16c8f9bc59ff159c75243e5
2010-05-10 19:51:32 +00:00
dan 7ddccd2aad Merge [96d6eaf4d2] and [40b0a6357b].
FossilOrigin-Name: c67756c404669141fa06a1ce3f1efadefa277bc6
2010-05-10 18:10:17 +00:00
drh 1c5bb4d69c Fix an uninitialized variable in OSX proxy locking.
FossilOrigin-Name: 96d6eaf4d2be453191b36875811d9556ad0763ed
2010-05-10 17:29:28 +00:00
dan bb23aff3df Modify the format of the wal-index to use a hash table to index log file segments.
FossilOrigin-Name: 40b0a6357b160e04326ab176955a68a1cf3f8b7c
2010-05-10 14:46:09 +00:00
drh acd0781892 If an ATTACH command files due to OP_JournalMode but still attaches the
database, make sure VACUUM still detaches it when done.

FossilOrigin-Name: 6ecdc7ba2b5e79e8b5862fb49cf6c2b99a40659a
2010-05-10 14:10:57 +00:00
drh ab9b74443c Enhance the OP_JournalMode opcode with an ignore-errors option and use that
option the ATTACH command.

FossilOrigin-Name: 0bdea4cfbd7832f2a00c01b93c92ba13d20139ef
2010-05-10 11:20:05 +00:00
drh 2905f053ef When running a checkpoint while in locking_mode=EXCLUSIVE, be sure to move
the wal-index lock to UNLOCK from READ prior to promoting to CHECKPOINT.

FossilOrigin-Name: be114bdf9bb98c7287f8cb54340c630b0c412e9d
2010-05-07 20:34:17 +00:00
drh e874d9ed79 Change the xShmOpen() method of the VFS to take the database file name as
its argument, not the WAL file name.  Also fix some unrelated compiler
warnings.

FossilOrigin-Name: a65c2939267ef6acec4e355a207f98f217e263d6
2010-05-07 20:02:23 +00:00
drh 6a2607a131 Additional tweaks to API documentation. No functional code changes.
FossilOrigin-Name: e1230782a371f09cd46dacc8ecbc6a0c5baab2d5
2010-05-07 18:23:24 +00:00
drh 005e19c4c1 Updates to documentation on the C interfaces supporting WAL. No functional
changes to code.

FossilOrigin-Name: 681ba20cf077e9a0fccd51ed50101ad0f2c67eb3
2010-05-07 13:57:11 +00:00
dan c6315a44b2 Fix a recently introduced problem in wal.test.
FossilOrigin-Name: 79b52d0ff7a7b717bde55b97ff05ad17418bc7d7
2010-05-07 13:52:42 +00:00
dan 65bddc1223 Change wal.test and walhook.test so that they work with DEFAULT_AUTOVACUUM=1 builds.
FossilOrigin-Name: 4cde92909c20982f7d4e6b550f55d786df398ccd
2010-05-07 12:49:22 +00:00
dan 65f2ac58b6 Test another IO error case in wal.c.
FossilOrigin-Name: 8b3b5ab8fa61ca4ef22c98abaab397707ee74ea3
2010-05-07 09:43:50 +00:00
dan 998ad21271 Fix a problem with checkpointing large log files created by an external process.
FossilOrigin-Name: 8f94bde568be52ecc5a976b7a09776ea7b4bb511
2010-05-07 06:59:08 +00:00
dan 846705021d Since walIndexTryHdr() can no longer encounter any error conditions, change tehe function signature so that it does not return an error code. This removes unreachable branches from other code.
FossilOrigin-Name: 061a282cc0bf76541ab1f99b351a49d489ff93ec
2010-05-07 05:46:23 +00:00
drh 2c47d194a2 Another attempt to fix permutations.test so that it excludes WAL tests
from the journaltest permutation.

FossilOrigin-Name: 58c404429c5af167a82899fc4c736ed7489ed746
2010-05-07 00:28:41 +00:00
drh 6763e3550d Remove savepoint6.test from the set of tests run by journaltest since
savepoint6.test uses journal_mode=WAL.

FossilOrigin-Name: 811b45a96bfaa0ef2394b86c06e8f099a07ee9f0
2010-05-06 22:21:14 +00:00
drh 3ebaee9633 The PRAGMA journal_mode=WAL; command now makes WAL the default journal mode
for new databases added with ATTACH, so the behavior is consistent with the
other journal modes.

FossilOrigin-Name: c3520460a4a39fc5e981c3033068ffbb422a4af2
2010-05-06 21:37:22 +00:00
drh 72af0774f9 Make sure to do a clean shutdown of the library upon existing the shell
in order to remove WAL files.

FossilOrigin-Name: c1762dda00b8bdb7c3247617ac4cb654f1d95cf7
2010-05-06 20:19:55 +00:00
drh fb4a626da0 Exclude all WAL tests from the journaltest permutation.
FossilOrigin-Name: 46c97d7eee9359cd21139a6520633f5d16594ab0
2010-05-06 19:55:57 +00:00
shaneh fd06863881 Changes to support SQLITE_OMIT_WAL.
FossilOrigin-Name: 32a8501d78714cc390eba5f993f329ef3b499878
2010-05-06 19:20:29 +00:00
drh 08fba00781 Updates to the VFS SHM locking documentation.
FossilOrigin-Name: 9927ce421090ac20285cf05768b38e1f91826a68
2010-05-06 19:04:48 +00:00
dan 65be0d8cce Instead of transitioning to RECOVER state from CHECKPOINT when a recovery is required, perform the recovery while holding the CHECKPOINT lock.
FossilOrigin-Name: bb0b6021e721c2e4f1533ab18381604c6b7b31d5
2010-05-06 18:48:27 +00:00
dan 5273f58f37 If recovery is run before a checkpoint, change back to a CHECKPOINT lock before performing the actual checkpoint.
FossilOrigin-Name: dc98ee169cfa43c89f1b36fb1150d4788710fda3
2010-05-06 18:27:19 +00:00
dan 576bc3294d Only pass -1 as the size parameter to xShmGet when the caller does not care what size mapping is returned. Only call xShmSize when the underlying allocation (not the mapping) should be resized.
FossilOrigin-Name: 637f51ddf9e4a57e1f171b6d2c6c93152074267e
2010-05-06 18:04:50 +00:00
dan b7d53f54ae Fix a bug whereby an old snapshot could be checkpointed (and subsequent transactions discarded) if the last connection to disconnect from a WAL database happended to be holding an out-of-date wal-index header.
FossilOrigin-Name: d0c0034b0baa83046c1d6b94c886f7039e4e06f5
2010-05-06 17:28:08 +00:00
drh 6e5b37faef After throwing an error to say that one cannot change into WAL mode within
a tranactions, do not then go and change into WAL mode.

FossilOrigin-Name: 56a17dae91600a3863903f8d654ed52a0f720caf
2010-05-06 16:06:38 +00:00
dan d41a29a653 Further coverage tests.
FossilOrigin-Name: 98a9713e0030a36ea99a18a12a2e7685c6db72b3
2010-05-06 15:56:28 +00:00
shaneh 84aab39782 Update configure scripts for WAL support.
FossilOrigin-Name: 2edc5129f216abec9b13a0ad9b6640606caa9f72
2010-05-06 15:35:59 +00:00
dan a861469a07 Add tests to cover a couple of branches in wal.c.
FossilOrigin-Name: 429f437fb776fc974a6adf791b729e25bea82fef
2010-05-06 14:42:34 +00:00
dan c9e4665e7d Unset a tcl variable before reusing it in wal.test.
FossilOrigin-Name: e83efb232fe8d30714f4c7cffeef80092aea4df7
2010-05-06 13:36:47 +00:00
dan ff6dfc73fe Add tests for some lock-contention cases.
FossilOrigin-Name: f0fcb9c9a67e2bf7bbedbedbc27791b605a21dd1
2010-05-06 12:15:48 +00:00
drh e404de05c0 Remove the noop-mutex implementations of mutex_held() and mutex_notheld()
since they are both unreachable.

FossilOrigin-Name: 6767b62a9a063582889f5ceb42f95eab24c697da
2010-05-06 11:56:52 +00:00
drh 24e3971197 Add two text files containing pager design notes to the doc/ subfolder.
FossilOrigin-Name: ed817fc893e7162ae0ff4022591f7e9e3b81d622
2010-05-06 11:55:56 +00:00
dan 9a6b4e9adb Add test cases to test the libraries handling of corrupt wal-index headers.
FossilOrigin-Name: 9465b267d420120c050bbe4f143ac824146a9e4a
2010-05-06 11:32:09 +00:00
dan 8f6097c244 Add tests for handling errors returned by xShm VFS methods.
FossilOrigin-Name: fbbcacb137e8f5246b88ad09331236aaa1900f60
2010-05-06 07:43:58 +00:00
drh 5def0843f1 Change the behavior of the sqlite3_wal_hook() callback. It should now return
SQLITE_OK or an error code and the error code is propagated back up the 
stack.  If a checkpoint is desired, the callback should invoke
sqlite3_wal_callback() itself.

FossilOrigin-Name: 1b14195e05fe5551992a39246ec3bcf6a33bbfac
2010-05-05 20:00:25 +00:00
drh ccd13d1f80 Further simplifications to the SHM locking logic. Remove the SQLITE_SHM_QUERY
option.  Unify the WRITE to READ and RECOVER to READ transitions.

FossilOrigin-Name: e9bfa6e4ce7d1edc6be8b9173ac3b6bfd180632a
2010-05-05 19:09:49 +00:00
dan c7991bdf29 Test the handling of errors returned by the xShmXXX() APIs.
FossilOrigin-Name: 72663123d6be2b194cad7a6057d0f20dd0d9fe05
2010-05-05 19:04:59 +00:00
drh 5c10f77d52 Do not compare page sizes on source and destination of backup until
transactions are started and the page sizes are locked.  This is a
fix to check-in [7bd44794c4].

FossilOrigin-Name: ec7157788b16936b4b6e4642107b3c86aa44df24
2010-05-05 18:46:44 +00:00
drh 4bc79def36 Simplifications to the SHM locking implementation in os_unix.c.
FossilOrigin-Name: 9de05bfb09e29bafdf5782263330fe8eefcfaba3
2010-05-05 18:20:07 +00:00
drh 3289c5efc8 Prohibit backup if the destination is using WAL and has a different page
size from the source.

FossilOrigin-Name: 7bd44794c482beee16c684712545275e2bf63dfa
2010-05-05 16:23:26 +00:00
dan 1018e90b1e When closing a WAL database, if the exclusive lock on the database file is obtained and the database successfully checkpointed, delete the wal-index file from the file system.
FossilOrigin-Name: 2ac5d96c8e5831b392d83c86491d9ed8bc9c8db7
2010-05-05 15:33:05 +00:00
drh 16adb77623 Make sure the page size of the main database is fixed following a
failed VACUUM attempt.  Otherwise, two consecutive failed VACUUM attempts
with attempted page_size changes on encrypted or WAL databases could
result in database corruption.

FossilOrigin-Name: 208e7d5d3a8915433dbf50c6cc6698ec6c8df944
2010-05-05 04:11:44 +00:00
drh 811bdbd206 Do not attempt to modify the page_size when running VACUUM on a WAL database.
FossilOrigin-Name: 58a1a59be89b33c6d5fa8b43571037d7d96625a1
2010-05-05 03:39:53 +00:00
drh fc34ad291e Get the previous mutex fix working with SQLITE_DEBUG and with the amalgamation.
FossilOrigin-Name: df19928f7ee94bca3989313ff16507c15d6efe2b
2010-05-05 00:22:21 +00:00
drh 92d7652379 When the in single-threaded mode, the sqlite3_mutex_alloc() interface
still returns a non-NULL value.  The mutex doesn't do anything, but it
tests non-NULL.  This way, extensions (or VFSes) that use sqlite3_mutex_alloc()
can tell the difference between an OOM error and mutexes being disabled.

FossilOrigin-Name: 451fd175758983c335aab449fdc4cb838156c4cb
2010-05-05 00:05:24 +00:00
drh 7721b23e0a When sqlite3PagerPagecount() is called without any locks, always return
the physical file size, not the logical file size.

FossilOrigin-Name: 4016b422286587beda7323052d27821adb1fed73
2010-05-04 18:50:40 +00:00
drh a8e654eb38 Be sure to release all wal-index locks before closing the wal-index.
FossilOrigin-Name: b15b67fa14ff77963f470678ff6188c63be8e079
2010-05-04 17:38:42 +00:00
drh cd058ec4ef Relax an over-zealous assert() in sqlite3WalUndo().
FossilOrigin-Name: 8f9d22d58c75ad7476c1eea8ba296347e30b7beb
2010-05-04 17:20:09 +00:00
drh 33bec22fb1 Take care not to invoke the xShmClose method of the VFS with a NULL
shared memory object.

FossilOrigin-Name: 1465d3842c52aa7471f63deb47fe5b256d4e01c2
2010-05-04 16:33:37 +00:00
dan 2cee6abf8e Add a test case to verify that log files containing pages that are not a power-of-two bytes in size are handled correctly.
FossilOrigin-Name: c2bf693f933313991d85394009e79a7903037a18
2010-05-04 15:20:45 +00:00
dan b6e099a973 Fix problems with recovering wal files that use a page-size other than the default.
FossilOrigin-Name: 1a391f3c55dc9d4266552fa26d2a9839c6bafce4
2010-05-04 14:47:39 +00:00
dan ef37802545 Fix a typo in walfault.test.
FossilOrigin-Name: 232dbe8ecec16485be5c5995fdf7a0ed951c2097
2010-05-04 11:06:03 +00:00
dan 8d6ad1cc2c Test that the correct number of padding frames are appended to the log file after committing a transaction in synchronous=FULL mode.
FossilOrigin-Name: a60104aa7e38e7d9f2ff2eae02687dc9c5dd5d77
2010-05-04 10:36:20 +00:00
drh d0b2677b78 Unset some global TCL variables prior to use in test where prior tests can
have those same variables set to an array value.

FossilOrigin-Name: 49bef00e5cda600ceb964148bf745de4aff1ab62
2010-05-03 19:20:46 +00:00
drh d5e6e4004b Fix a bug in the computation of the current time for the alternative
CURRENT_TIMESTAMP functions used when SQLITE_OMIT_DATETIME is defined.

FossilOrigin-Name: e7ded46b5efabe521008d9043dd72bd1ca748316
2010-05-03 19:17:01 +00:00
drh 324e46d424 Documentation stubs for sqlite3_wal_autocheckpoint and sqlite3_wal_checkpoint.
FossilOrigin-Name: 313762427d96954667909887a797ea996dc6304a
2010-05-03 18:51:41 +00:00
drh 0dcb0a7d7b Fix a bug in the xCurrentTime() method of the os_unix.c VFS.
FossilOrigin-Name: 551df11a5613e3edc6c5de44f0ac6abc2d0e6cdf
2010-05-03 18:22:52 +00:00
dan 5e9e482fe0 Add a test to simulate an OOM during log recovery to walfault.test.
FossilOrigin-Name: 7ed85e87dd206083310ba28afab4389885f61dac
2010-05-03 18:01:21 +00:00
drh 529b18706d Clear global variable "seconds" before use in walthread.test.
FossilOrigin-Name: a35551a5305b5160b0eb511da7f8e6fb351ef271
2010-05-03 17:24:45 +00:00
dan 76ed3bc044 Fix a couple of errors in WAL code that can occur in an OOM situation.
FossilOrigin-Name: 9d3f3736be42ef8ab48b099d4712e08dfca97873
2010-05-03 17:18:24 +00:00
drh 4c846bb148 Update the crash-test VFS in test6.c to pass-through the shared-memory
methods to the real underlying VFS.  This fixes the walcrash.test script.

FossilOrigin-Name: ea09ff37911376505e8262ee9841224995b696f2
2010-05-03 16:36:55 +00:00
drh 1fbe0f2a8f Change the VFS definition so that all methods take a VFS object pointer as
their first parameter.

FossilOrigin-Name: 43b5b07f0d996d7ef7426346b1792e9ca898f487
2010-05-03 16:30:27 +00:00
dan af0cfd366a Have sqlite3_wal_checkpoint() handle a zero-length string in the same way as a NULL pointer. Fix "PRAGMA wal_checkpoint" so that it checkpoints all attached databases.
FossilOrigin-Name: 7fecd21f45b9ce773ffbcef6c84066474e8cd01c
2010-05-03 15:58:50 +00:00
drh b7e8ea2015 Use VFS method xCurrentTimeInt64 instead of xCurrentTime when it is available.
Provide an implementation of xCurrentTimeInt64 for os_unix.c.

FossilOrigin-Name: ab77b3ae6da3370d8bc3b2c9c0edc723b69f5a95
2010-05-03 14:32:30 +00:00
drh e8e1c9d50e Merge the write-ahead-logging changes into the trunk.
FossilOrigin-Name: de9ae443cc8eebfb0692dcdac93bde9e4c54199a
2010-05-03 14:08:27 +00:00
207 changed files with 26388 additions and 6615 deletions
+218 -128
View File
@@ -161,31 +161,35 @@ NAWK = @AWK@
# You should not have to change anything below this line
###############################################################################
USE_AMALGAMATION = @USE_AMALGAMATION@
# Object files for the SQLite library (non-amalgamation).
#
OBJS0 = alter.lo analyze.lo attach.lo auth.lo backup.lo bitvec.lo btmutex.lo \
btree.lo build.lo callback.lo complete.lo ctime.lo date.lo \
delete.lo expr.lo fault.lo fkey.lo func.lo global.lo \
hash.lo journal.lo insert.lo legacy.lo loadext.lo \
main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
memjournal.lo \
mutex.lo mutex_noop.lo mutex_os2.lo mutex_unix.lo mutex_w32.lo \
notify.lo opcodes.lo os.lo os_unix.lo os_win.lo os_os2.lo \
pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
random.lo resolve.lo rowset.lo select.lo status.lo \
table.lo tokenize.lo trigger.lo update.lo \
util.lo vacuum.lo \
vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbetrace.lo \
walker.lo where.lo utf.lo vtab.lo
LIBOBJS0 = alter.lo analyze.lo attach.lo auth.lo \
backup.lo bitvec.lo btmutex.lo btree.lo build.lo \
callback.lo complete.lo ctime.lo date.lo delete.lo expr.lo fault.lo fkey.lo \
fts3.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo fts3_porter.lo \
fts3_snippet.lo fts3_tokenizer.lo fts3_tokenizer1.lo fts3_write.lo \
func.lo global.lo hash.lo \
icu.lo insert.lo journal.lo legacy.lo loadext.lo \
main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
memjournal.lo \
mutex.lo mutex_noop.lo mutex_os2.lo mutex_unix.lo mutex_w32.lo \
notify.lo opcodes.lo os.lo os_os2.lo os_unix.lo os_win.lo \
pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
random.lo resolve.lo rowset.lo rtree.lo select.lo status.lo \
table.lo tokenize.lo trigger.lo \
update.lo util.lo vacuum.lo \
vdbe.lo vdbeapi.lo vdbeaux.lo vdbeblob.lo vdbemem.lo vdbetrace.lo \
wal.lo walker.lo where.lo utf.o vtab.lo
# Object files for the amalgamation.
#
OBJS1 = sqlite3.lo
LIBOBJS1 = sqlite3.lo
# Determine the real value of LIBOBJ based on the 'configure' script
#
USE_AMALGAMATION = @USE_AMALGAMATION@
LIBOBJ = $(OBJS$(USE_AMALGAMATION))
LIBOBJ = $(LIBOBJS$(USE_AMALGAMATION))
# All of the source code files.
@@ -281,17 +285,6 @@ SRC = \
$(TOP)/src/walker.c \
$(TOP)/src/where.c
# Generated source code files
#
SRC += \
keywordhash.h \
opcodes.c \
opcodes.h \
parse.c \
parse.h \
config.h \
sqlite3.h
# Source code for extensions
#
SRC += \
@@ -333,44 +326,19 @@ SRC += \
$(TOP)/ext/rtree/rtree.h \
$(TOP)/ext/rtree/rtree.c
# Source code to the library files needed by the test fixture
#
TESTSRC2 = \
$(TOP)/src/attach.c \
$(TOP)/src/backup.c \
$(TOP)/src/bitvec.c \
$(TOP)/src/btree.c \
$(TOP)/src/build.c \
$(TOP)/src/date.c \
$(TOP)/src/ctime.c \
$(TOP)/src/expr.c \
$(TOP)/src/func.c \
$(TOP)/src/insert.c \
$(TOP)/src/mem5.c \
$(TOP)/src/os.c \
$(TOP)/src/os_os2.c \
$(TOP)/src/os_unix.c \
$(TOP)/src/os_win.c \
$(TOP)/src/pager.c \
$(TOP)/src/pcache.c \
$(TOP)/src/pcache1.c \
$(TOP)/src/pragma.c \
$(TOP)/src/prepare.c \
$(TOP)/src/printf.c \
$(TOP)/src/random.c \
$(TOP)/src/select.c \
$(TOP)/src/tokenize.c \
$(TOP)/src/utf.c \
$(TOP)/src/util.c \
$(TOP)/src/vdbe.c \
$(TOP)/src/vdbeapi.c \
$(TOP)/src/vdbeaux.c \
$(TOP)/src/vdbemem.c \
$(TOP)/src/vdbetrace.c \
$(TOP)/src/where.c \
parse.c
# Source code to the actual test files.
# Generated source code files
#
SRC += \
keywordhash.h \
opcodes.c \
opcodes.h \
parse.c \
parse.h \
config.h \
sqlite3.h
# Source code to the test files.
#
TESTSRC = \
$(TOP)/src/test1.c \
@@ -387,6 +355,7 @@ TESTSRC = \
$(TOP)/src/test_backup.c \
$(TOP)/src/test_btree.c \
$(TOP)/src/test_config.c \
$(TOP)/src/test_demovfs.c \
$(TOP)/src/test_devsym.c \
$(TOP)/src/test_func.c \
$(TOP)/src/test_hexio.c \
@@ -400,60 +369,98 @@ TESTSRC = \
$(TOP)/src/test_pcache.c \
$(TOP)/src/test_schema.c \
$(TOP)/src/test_server.c \
$(TOP)/src/test_stat.c \
$(TOP)/src/test_tclvar.c \
$(TOP)/src/test_thread.c \
$(TOP)/src/test_vfs.c \
$(TOP)/src/test_wsd.c
# Source code to the library files needed by the test fixture
#
TESTSRC2 = \
$(TOP)/src/attach.c \
$(TOP)/src/backup.c \
$(TOP)/src/bitvec.c \
$(TOP)/src/btree.c \
$(TOP)/src/build.c \
$(TOP)/src/ctime.c \
$(TOP)/src/date.c \
$(TOP)/src/expr.c \
$(TOP)/src/func.c \
$(TOP)/src/insert.c \
$(TOP)/src/wal.c \
$(TOP)/src/mem5.c \
$(TOP)/src/os.c \
$(TOP)/src/os_os2.c \
$(TOP)/src/os_unix.c \
$(TOP)/src/os_win.c \
$(TOP)/src/pager.c \
$(TOP)/src/pragma.c \
$(TOP)/src/prepare.c \
$(TOP)/src/printf.c \
$(TOP)/src/random.c \
$(TOP)/src/pcache.c \
$(TOP)/src/pcache1.c \
$(TOP)/src/select.c \
$(TOP)/src/tokenize.c \
$(TOP)/src/utf.c \
$(TOP)/src/util.c \
$(TOP)/src/vdbeapi.c \
$(TOP)/src/vdbeaux.c \
$(TOP)/src/vdbe.c \
$(TOP)/src/vdbemem.c \
$(TOP)/src/vdbetrace.c \
$(TOP)/src/where.c \
parse.c \
$(TOP)/ext/fts3/fts3.c \
$(TOP)/ext/fts3/fts3_expr.c \
$(TOP)/ext/fts3/fts3_tokenizer.c \
$(TOP)/ext/fts3/fts3_write.c \
$(TOP)/ext/async/sqlite3async.c
# Header files used by all library source files.
#
HDR = \
sqlite3.h \
$(TOP)/src/btree.h \
$(TOP)/src/btreeInt.h \
$(TOP)/src/hash.h \
$(TOP)/src/hwtime.h \
$(TOP)/src/sqliteLimit.h \
keywordhash.h \
$(TOP)/src/mutex.h \
opcodes.h \
$(TOP)/src/os.h \
$(TOP)/src/os_common.h \
$(TOP)/src/pager.h \
$(TOP)/src/pcache.h \
parse.h \
sqlite3.h \
$(TOP)/src/sqlite3ext.h \
$(TOP)/src/sqliteInt.h \
$(TOP)/src/sqliteLimit.h \
$(TOP)/src/vdbe.h \
$(TOP)/src/vdbeInt.h \
parse.h \
config.h
# Header files used by extensions
#
HDR += \
EXTHDR += \
$(TOP)/ext/fts1/fts1.h \
$(TOP)/ext/fts1/fts1_hash.h \
$(TOP)/ext/fts1/fts1_tokenizer.h
HDR += \
EXTHDR += \
$(TOP)/ext/fts2/fts2.h \
$(TOP)/ext/fts2/fts2_hash.h \
$(TOP)/ext/fts2/fts2_tokenizer.h
HDR += \
EXTHDR += \
$(TOP)/ext/fts3/fts3.h \
$(TOP)/ext/fts3/fts3Int.h \
$(TOP)/ext/fts3/fts3_hash.h \
$(TOP)/ext/fts3/fts3_tokenizer.h
HDR += \
EXTHDR += \
$(TOP)/ext/rtree/rtree.h
HDR += \
EXTHDR += \
$(TOP)/ext/icu/sqliteicu.h
# If using the amalgamation, use sqlite3.c directly to build the test
# fixture. Otherwise link against libsqlite3.la. (This distinction is
# necessary because the test fixture requires non-API symbols which are
# hidden when the library is built via the amalgamation).
#
TESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.la
TESTFIXTURE_SRC1 = sqlite3.c
TESTFIXTURE_SRC = $(TESTSRC) $(TOP)/src/tclsqlite.c $(TESTFIXTURE_SRC$(USE_AMALGAMATION))
# This is the default Makefile target. The objects listed here
# are what get build when you type just "make" with no arguments.
#
@@ -487,10 +494,10 @@ sqlite3$(TEXE): $(TOP)/src/shell.c libsqlite3.la sqlite3.h
# files are automatically generated. This target takes care of
# all that automatic generation.
#
.target_source: $(SRC)
.target_source: $(SRC) $(TOP)/tool/vdbe-compress.tcl
rm -rf tsrc
mkdir -p tsrc
cp $(SRC) tsrc
mkdir tsrc
cp -f $(SRC) tsrc
rm tsrc/sqlite.h.in tsrc/parse.y
$(TCLSH_CMD) $(TOP)/tool/vdbe-compress.tcl <tsrc/vdbe.c >vdbe.new
mv vdbe.new tsrc/vdbe.c
@@ -499,19 +506,30 @@ sqlite3$(TEXE): $(TOP)/src/shell.c libsqlite3.la sqlite3.h
sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl
$(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl
# Rule to build the amalgamation
#
sqlite3.lo: sqlite3.c
$(LTCOMPILE) $(TEMP_STORE) -c sqlite3.c
# Rules to build the LEMON compiler generator
#
lemon$(BEXE): $(TOP)/tool/lemon.c $(TOP)/src/lempar.c
$(BCC) -o $@ $(TOP)/tool/lemon.c
cp $(TOP)/src/lempar.c .
# Rule to build the amalgamation
# Rules to build individual *.o files from generated *.c files. This
# applies to:
#
sqlite3.lo: sqlite3.c
$(LTCOMPILE) $(TEMP_STORE) -c sqlite3.c
# parse.o
# opcodes.o
#
parse.lo: parse.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c parse.c
# Rules to build individual files
opcodes.lo: opcodes.c
$(LTCOMPILE) $(TEMP_STORE) -c opcodes.c
# Rules to build individual *.o files from files in the src directory.
#
alter.lo: $(TOP)/src/alter.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/alter.c
@@ -636,15 +654,6 @@ pcache.lo: $(TOP)/src/pcache.c $(HDR) $(TOP)/src/pcache.h
pcache1.lo: $(TOP)/src/pcache1.c $(HDR) $(TOP)/src/pcache.h
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/pcache1.c
opcodes.lo: opcodes.c
$(LTCOMPILE) $(TEMP_STORE) -c opcodes.c
opcodes.c: opcodes.h $(TOP)/mkopcodec.awk
sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c
opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
cat parse.h $(TOP)/src/vdbe.c | $(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
os.lo: $(TOP)/src/os.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os.c
@@ -657,17 +666,6 @@ os_win.lo: $(TOP)/src/os_win.c $(HDR)
os_os2.lo: $(TOP)/src/os_os2.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/os_os2.c
parse.lo: parse.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c parse.c
parse.h: parse.c
parse.c: $(TOP)/src/parse.y lemon$(BEXE) $(TOP)/addopcodes.awk
cp $(TOP)/src/parse.y .
./lemon$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
mv parse.h parse.h.temp
$(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
pragma.lo: $(TOP)/src/pragma.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/pragma.c
@@ -692,22 +690,12 @@ select.lo: $(TOP)/src/select.c $(HDR)
status.lo: $(TOP)/src/status.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/status.c
sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION
tclsh $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
table.lo: $(TOP)/src/table.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/table.c
tclsqlite.lo: $(TOP)/src/tclsqlite.c $(HDR)
$(LTCOMPILE) -DUSE_TCL_STUBS=1 -c $(TOP)/src/tclsqlite.c
tokenize.lo: $(TOP)/src/tokenize.c keywordhash.h $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/tokenize.c
keywordhash.h: $(TOP)/tool/mkkeywordhash.c
$(BCC) -o mkkeywordhash$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)/tool/mkkeywordhash.c
./mkkeywordhash$(BEXE) >keywordhash.h
trigger.lo: $(TOP)/src/trigger.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/trigger.c
@@ -753,6 +741,9 @@ walker.lo: $(TOP)/src/walker.c $(HDR)
where.lo: $(TOP)/src/where.c $(HDR)
$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/where.c
tclsqlite.lo: $(TOP)/src/tclsqlite.c $(HDR)
$(LTCOMPILE) -DUSE_TCL_STUBS=1 -c $(TOP)/src/tclsqlite.c
tclsqlite-shell.lo: $(TOP)/src/tclsqlite.c $(HDR)
$(LTCOMPILE) -DTCLSH=1 -o $@ -c $(TOP)/src/tclsqlite.c
@@ -763,16 +754,113 @@ tclsqlite3$(TEXE): tclsqlite-shell.lo libsqlite3.la
$(LTLINK) -o $@ tclsqlite-shell.lo \
libsqlite3.la $(LIBTCL)
# Rules to build opcodes.c and opcodes.h
#
opcodes.c: opcodes.h $(TOP)/mkopcodec.awk
sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c
opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
cat parse.h $(TOP)/src/vdbe.c | $(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
# Rules to build parse.c and parse.h - the outputs of lemon.
#
parse.h: parse.c
parse.c: $(TOP)/src/parse.y lemon$(BEXE) $(TOP)/addopcodes.awk
cp $(TOP)/src/parse.y .
rm -f parse.h
./lemon$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
mv parse.h parse.h.temp
$(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION
tclsh $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
keywordhash.h: $(TOP)/tool/mkkeywordhash.c
$(BCC) -o mkkeywordhash$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)/tool/mkkeywordhash.c
./mkkeywordhash$(BEXE) >keywordhash.h
# Rules to build the extension objects.
#
icu.lo: $(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c
fts2.lo: $(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c
fts2_hash.lo: $(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c
fts2_icu.lo: $(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c
fts2_porter.lo: $(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c
fts2_tokenizer.lo: $(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c
fts2_tokenizer1.lo: $(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c
fts3.lo: $(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c
fts3_expr.lo: $(TOP)/ext/fts3/fts3_expr.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_expr.c
fts3_hash.lo: $(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c
fts3_icu.lo: $(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c
fts3_snippet.lo: $(TOP)/ext/fts3/fts3_snippet.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_snippet.c
fts3_porter.lo: $(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c
fts3_tokenizer.lo: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c
fts3_tokenizer1.lo: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
fts3_write.lo: $(TOP)/ext/fts3/fts3_write.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_write.c
rtree.lo: $(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/rtree/rtree.c
# Rules to build the 'testfixture' application.
#
# If using the amalgamation, use sqlite3.c directly to build the test
# fixture. Otherwise link against libsqlite3.la. (This distinction is
# necessary because the test fixture requires non-API symbols which are
# hidden when the library is built via the amalgamation).
#
TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
TESTFIXTURE_SRC0 = $(TESTSRC2) libsqlite3.la
TESTFIXTURE_SRC1 = sqlite3.c
TESTFIXTURE_SRC = $(TESTSRC) $(TOP)/src/tclsqlite.c $(TESTFIXTURE_SRC$(USE_AMALGAMATION))
testfixture$(TEXE): $(TESTFIXTURE_SRC)
$(LTLINK) -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_NO_SYNC=1\
-DSQLITE_CRASH_TEST=1 \
-DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE $(TEMP_STORE) \
$(LTLINK) -DSQLITE_NO_SYNC=1 $(TEMP_STORE) $(TESTFIXTURE_FLAGS) \
-o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS)
fulltest: testfixture$(TEXE) sqlite3$(TEXE)
./testfixture$(TEXE) $(TOP)/test/all.test
soaktest: testfixture$(TEXE) sqlite3$(TEXE)
./testfixture$(TEXE) $(TOP)/test/all.test -soak=1
test: testfixture$(TEXE) sqlite3$(TEXE)
./testfixture$(TEXE) $(TOP)/test/veryquick.test
@@ -786,9 +874,11 @@ sqlite3_analyzer$(TEXE): $(TESTFIXTURE_SRC) $(TOP)/tool/spaceanal.tcl
$(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
$(LTLINK) -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 \
-DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE \
$(TEMP_STORE) -o $@ $(TESTFIXTURE_SRC) $(LIBTCL)
$(TEMP_STORE) -o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS)
# Standard install and cleanup targets
#
lib_install: libsqlite3.la
$(INSTALL) -d $(DESTDIR)$(libdir)
$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
@@ -813,15 +903,15 @@ tcl_install: lib_install libtclsqlite3.la pkgIndex.tcl
clean:
rm -f *.lo *.la *.o sqlite3$(TEXE) libsqlite3.la
rm -f sqlite3.h opcodes.*
rm -rf .libs .deps tsrc
rm -rf .libs .deps
rm -f lemon$(BEXE) lempar.c parse.* sqlite*.tar.gz
rm -f mkkeywordhash$(BEXE) keywordhash.h
rm -f $(PUBLISH)
rm -f *.da *.bb *.bbg gmon.out
rm -rf tsrc .target_source
rm -f testfixture$(TEXE) test.db
rm -f common.tcl
rm -f sqlite3.dll sqlite3.lib sqlite3.def
rm -f sqlite3.c .target_source
rm -f sqlite3.c
distclean: clean
rm -f config.log config.status libtool Makefile sqlite3.pc
+2 -1
View File
@@ -386,6 +386,7 @@ TESTSRC = \
$(TOP)/src/test_server.c \
$(TOP)/src/test_tclvar.c \
$(TOP)/src/test_thread.c \
$(TOP)/src/test_vfs.c \
$(TOP)/src/test_wsd.c \
#TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
@@ -624,7 +625,7 @@ fulltest: testfixture$(EXE) sqlite3$(EXE)
./testfixture$(EXE) $(TOP)/test/all.test
soaktest: testfixture$(EXE) sqlite3$(EXE)
./testfixture$(EXE) $(TOP)/test/all.test -soak 1
./testfixture$(EXE) $(TOP)/test/all.test -soak=1
test: testfixture$(EXE) sqlite3$(EXE)
./testfixture$(EXE) $(TOP)/test/veryquick.test
+5333
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Vendored
+11 -10
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.62 for sqlite 3.6.23.
# Generated by GNU Autoconf 2.62 for sqlite 3.7.0.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@@ -743,8 +743,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.6.23'
PACKAGE_STRING='sqlite 3.6.23'
PACKAGE_VERSION='3.7.0'
PACKAGE_STRING='sqlite 3.7.0'
PACKAGE_BUGREPORT=''
# Factoring default headers for most tests.
@@ -1487,7 +1487,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures sqlite 3.6.23 to adapt to many kinds of systems.
\`configure' configures sqlite 3.7.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1552,7 +1552,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of sqlite 3.6.23:";;
short | recursive ) echo "Configuration of sqlite 3.7.0:";;
esac
cat <<\_ACEOF
@@ -1670,7 +1670,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
sqlite configure 3.6.23
sqlite configure 3.7.0
generated by GNU Autoconf 2.62
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1684,7 +1684,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by sqlite $as_me 3.6.23, which was
It was created by sqlite $as_me 3.7.0, which was
generated by GNU Autoconf 2.62. Invocation command line was
$ $0 $@
@@ -13972,7 +13972,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by sqlite $as_me 3.6.23, which was
This file was extended by sqlite $as_me 3.7.0, which was
generated by GNU Autoconf 2.62. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14025,7 +14025,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
sqlite config.status 3.6.23
sqlite config.status 3.7.0
configured by $0, generated by GNU Autoconf 2.62,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
@@ -14458,7 +14458,8 @@ $debug ||
if test -n "$CONFIG_FILES"; then
ac_cr=' '
ac_cr='
'
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
ac_cs_awk_cr='\\r'
+76
View File
@@ -0,0 +1,76 @@
*** Throughout this document, a page is deemed to have been synced
automatically as soon as it is written when PRAGMA synchronous=OFF.
Otherwise, the page is not synced until the xSync method of the VFS
is called successfully on the file containing the page.
*** Definition: A page of the database file is said to be "overwriteable" if
one or more of the following are true about the page:
(a) The original content of the page as it was at the beginning of
the transaction has been written into the rollback journal and
synced.
(b) The page was a freelist leaf page at the start of the transaction.
(c) The page number is greater than the largest page that existed in
the database file at the start of the transaction.
(1) A page of the database file is never overwritten unless one of the
following are true:
(a) The page and all other pages on the same sector are overwriteable.
(b) The atomic page write optimization is enabled, and the entire
transaction other than the update of the transaction sequence
number consists of a single page change.
(2) The content of a page written into the rollback journal exactly matches
both the content in the database when the rollback journal was written
and the content in the database at the beginning of the current
transaction.
(3) Writes to the database file are an integer multiple of the page size
in length and are aligned to a page boundary.
(4) Reads from the database file are either aligned on a page boundary and
an integer multiple of the page size in length or are taken from the
first 100 bytes of the database file.
(5) All writes to the database file are synced prior to the rollback journal
being deleted, truncated, or zeroed.
(6) If a master journal file is used, then all writes to the database file
are synced prior to the master journal being deleted.
*** Definition: Two databases (or the same database at two points it time)
are said to be "logically equivalent" if they give the same answer to
all queries. Note in particular the the content of freelist leaf
pages can be changed arbitarily without effecting the logical equivalence
of the database.
(7) At any time, if any subset, including the empty set and the total set,
of the unsynced changes to a rollback journal are removed and the
journal is rolled back, the resulting database file will be logical
equivalent to the database file at the beginning of the transaction.
(8) When a transaction is rolled back, the xTruncate method of the VFS
is called to restore the database file to the same size it was at
the beginning of the transaction. (In some VFSes, the xTruncate
method is a no-op, but that does not change the fact the SQLite will
invoke it.)
(9) Whenever the database file is modified, at least one bit in the range
of bytes from 24 through 39 inclusive will be changed prior to releasing
the EXCLUSIVE lock.
(10) The pattern of bits in bytes 24 through 39 shall not repeat in less
than one billion transactions.
(11) A database file is well-formed at the beginning and at the conclusion
of every transaction.
(12) An EXCLUSIVE lock must be held on the database file before making
any changes to the database file.
(13) A SHARED lock must be held on the database file before reading any
content out of the database file.
+130
View File
@@ -0,0 +1,130 @@
The 5 states of an historical rollback lock as implemented by the
xLock, xUnlock, and xCheckReservedLock methods of the sqlite3_io_methods
objec are:
UNLOCKED
SHARED
RESERVED
PENDING
EXCLUSIVE
The wal-index file has a similar locking hierarchy implemented using
the xShmLock method of the sqlite3_vfs object, but with 7
states. Each connection to a wal-index file must be in one of
the following 7 states:
UNLOCKED
READ
READ_FULL
WRITE
PENDING
CHECKPOINT
RECOVER
These roughly correspond to the 5 states of a rollback lock except
that SHARED is split out into 2 states: READ and READ_FULL and
there is an extra RECOVER state used for wal-index reconstruction.
The meanings of the various wal-index locking states is as follows:
UNLOCKED - The wal-index is not in use.
READ - Some prefix of the wal-index is being read. Additional
wal-index information can be appended at any time. The
newly appended content will be ignored by the holder of
the READ lock.
READ_FULL - The entire wal-index is being read. No new information
can be added to the wal-index. The holder of a READ_FULL
lock promises never to read pages from the database file
that are available anywhere in the wal-index.
WRITE - It is OK to append to the wal-index file and to adjust
the header to indicate the new "last valid frame".
PENDING - Waiting on all READ locks to clear so that a
CHECKPOINT lock can be acquired.
CHECKPOINT - It is OK to write any WAL data into the database file
and zero the last valid frame field of the wal-index
header. The wal-index file itself may not be changed
other than to zero the last valid frame field in the
header.
RECOVER - Held during wal-index recovery. Used to prevent a
race if multiple clients try to recover a wal-index at
the same time.
A particular lock manager implementation may coalesce one or more of
the wal-index locking states, though with a reduction in concurrency.
For example, an implemention might implement only exclusive locking,
in which case all states would be equivalent to CHECKPOINT, meaning that
only one reader or one writer or one checkpointer could be active at a
time. Or, an implementation might combine READ and READ_FULL into
a single state equivalent to READ, meaning that a writer could
coexist with a reader, but no reader or writers could coexist with a
checkpointer.
The lock manager must obey the following rules:
(1) A READ cannot coexist with CHECKPOINT.
(2) A READ_FULL cannot coexist with WRITE.
(3) None of WRITE, PENDING, CHECKPOINT, or RECOVER can coexist.
The SQLite core will obey the next set of rules. These rules are
assertions on the behavior of the SQLite core which might be verified
during testing using an instrumented lock manager.
(5) No part of the wal-index will be read without holding either some
kind of SHM lock or an EXCLUSIVE lock on the original database.
The original database is the file named in the 2nd parameter to
the xShmOpen method.
(6) A holder of a READ_FULL will never read any page of the database
file that is contained anywhere in the wal-index.
(7) No part of the wal-index other than the header will be written nor
will the size of the wal-index grow without holding a WRITE or
an EXCLUSIVE on the original database file.
(8) The wal-index header will not be written without holding one of
WRITE, CHECKPOINT, or RECOVER on the wal-index or an EXCLUSIVE on
the original database files.
(9) A CHECKPOINT or RECOVER must be held on the wal-index, or an
EXCLUSIVE on the original database file, in order to reset the
last valid frame counter in the header of the wal-index back to zero.
(10) A WRITE can only increase the last valid frame pointer in the header.
The SQLite core will only ever send requests for UNLOCK, READ, WRITE,
CHECKPOINT, or RECOVER to the lock manager. The SQLite core will never
request a READ_FULL or PENDING lock though the lock manager may deliver
those locking states in response to READ and CHECKPOINT requests,
respectively, if and only if the requested READ or CHECKPOINT cannot
be delivered.
The following are the allowed lock transitions:
Original-State Request New-State
-------------- ---------- ----------
(11a) UNLOCK READ READ
(11b) UNLOCK READ READ_FULL
(11c) UNLOCK CHECKPOINT PENDING
(11d) UNLOCK CHECKPOINT CHECKPOINT
(11e) READ UNLOCK UNLOCK
(11f) READ WRITE WRITE
(11g) READ RECOVER RECOVER
(11h) READ_FULL UNLOCK UNLOCK
(11i) READ_FULL WRITE WRITE
(11j) READ_FULL RECOVER RECOVER
(11k) WRITE READ READ
(11l) PENDING UNLOCK UNLOCK
(11m) PENDING CHECKPOINT CHECKPOINT
(11n) CHECKPOINT UNLOCK UNLOCK
(11o) RECOVER READ READ
These 15 transitions are all that needs to be supported. The lock
manager implementation can assert that fact. The other 27 possible
transitions among the 7 locking states will never occur.
+12 -5
View File
@@ -667,7 +667,7 @@ static int asyncRead(
){
AsyncFileData *p = ((AsyncFile *)pFile)->pData;
int rc = SQLITE_OK;
sqlite3_int64 filesize;
sqlite3_int64 filesize = 0;
sqlite3_file *pBase = p->pBaseRead;
sqlite3_int64 iAmt64 = (sqlite3_int64)iAmt;
@@ -690,7 +690,7 @@ static int asyncRead(
}
nRead = MIN(filesize - iOffset, iAmt64);
if( nRead>0 ){
rc = pBase->pMethods->xRead(pBase, zOut, nRead, iOffset);
rc = pBase->pMethods->xRead(pBase, zOut, (int)nRead, iOffset);
ASYNC_TRACE(("READ %s %d bytes at %d\n", p->zName, nRead, iOffset));
}
}
@@ -717,9 +717,11 @@ static int asyncRead(
if( iBeginIn<0 ) iBeginIn = 0;
if( iBeginOut<0 ) iBeginOut = 0;
filesize = MAX(filesize, pWrite->iOffset+nByte64);
nCopy = MIN(nByte64-iBeginIn, iAmt64-iBeginOut);
if( nCopy>0 ){
memcpy(&((char *)zOut)[iBeginOut], &pWrite->zBuf[iBeginIn], nCopy);
memcpy(&((char *)zOut)[iBeginOut], &pWrite->zBuf[iBeginIn], (size_t)nCopy);
ASYNC_TRACE(("OVERREAD %d bytes at %d\n", nCopy, iBeginOut+iOffset));
}
}
@@ -728,6 +730,9 @@ static int asyncRead(
asyncread_out:
async_mutex_leave(ASYNC_MUTEX_QUEUE);
if( rc==SQLITE_OK && filesize<(iOffset+iAmt) ){
rc = SQLITE_IOERR_SHORT_READ;
}
return rc;
}
@@ -1138,7 +1143,6 @@ static int asyncOpen(
async_mutex_leave(ASYNC_MUTEX_LOCK);
if( rc==SQLITE_OK ){
incrOpenFileCount();
pData->pLock = pLock;
}
@@ -1155,7 +1159,10 @@ static int asyncOpen(
}
if( rc!=SQLITE_OK ){
p->pMethod = 0;
}else{
incrOpenFileCount();
}
return rc;
}
@@ -1232,7 +1239,7 @@ static int asyncFullPathname(
if( rc==SQLITE_OK ){
int i, j;
char *z = zPathOut;
int n = strlen(z);
int n = (int)strlen(z);
while( n>1 && z[n-1]=='/' ){ n--; }
for(i=j=0; i<n; i++){
if( z[i]=='/' ){
+107 -26
View File
@@ -607,6 +607,9 @@ static int fts3CreateTables(Fts3Table *p){
** An sqlite3_exec() callback for fts3TableExists.
*/
static int fts3TableExistsCallback(void *pArg, int n, char **pp1, char **pp2){
UNUSED_PARAMETER(n);
UNUSED_PARAMETER(pp1);
UNUSED_PARAMETER(pp2);
*(int*)pArg = 1;
return 1;
}
@@ -632,7 +635,7 @@ static void fts3TableExists(
);
rc = sqlite3_exec(db, zSql, fts3TableExistsCallback, &res, 0);
sqlite3_free(zSql);
*pResult = res & 0xff;
*pResult = (u8)(res & 0xff);
if( rc!=SQLITE_ABORT ) *pRc = rc;
}
@@ -1618,10 +1621,58 @@ static int fts3DoclistMerge(
typedef struct TermSelect TermSelect;
struct TermSelect {
int isReqPos;
char *aOutput; /* Malloc'd output buffer */
int nOutput; /* Size of output in bytes */
char *aaOutput[16]; /* Malloc'd output buffer */
int anOutput[16]; /* Size of output in bytes */
};
/*
** Merge all doclists in the TermSelect.aaOutput[] array into a single
** doclist stored in TermSelect.aaOutput[0]. If successful, delete all
** other doclists (except the aaOutput[0] one) and return SQLITE_OK.
**
** If an OOM error occurs, return SQLITE_NOMEM. In this case it is
** the responsibility of the caller to free any doclists left in the
** TermSelect.aaOutput[] array.
*/
static int fts3TermSelectMerge(TermSelect *pTS){
int mergetype = (pTS->isReqPos ? MERGE_POS_OR : MERGE_OR);
char *aOut = 0;
int nOut = 0;
int i;
/* Loop through the doclists in the aaOutput[] array. Merge them all
** into a single doclist.
*/
for(i=0; i<SizeofArray(pTS->aaOutput); i++){
if( pTS->aaOutput[i] ){
if( !aOut ){
aOut = pTS->aaOutput[i];
nOut = pTS->anOutput[i];
pTS->aaOutput[0] = 0;
}else{
int nNew = nOut + pTS->anOutput[i];
char *aNew = sqlite3_malloc(nNew);
if( !aNew ){
sqlite3_free(aOut);
return SQLITE_NOMEM;
}
fts3DoclistMerge(mergetype, 0, 0,
aNew, &nNew, pTS->aaOutput[i], pTS->anOutput[i], aOut, nOut
);
sqlite3_free(pTS->aaOutput[i]);
sqlite3_free(aOut);
pTS->aaOutput[i] = 0;
aOut = aNew;
nOut = nNew;
}
}
}
pTS->aaOutput[0] = aOut;
pTS->anOutput[0] = nOut;
return SQLITE_OK;
}
/*
** This function is used as the sqlite3Fts3SegReaderIterate() callback when
** querying the full-text index for a doclist associated with a term or
@@ -1636,38 +1687,63 @@ static int fts3TermSelectCb(
int nDoclist
){
TermSelect *pTS = (TermSelect *)pContext;
int nNew = pTS->nOutput + nDoclist;
char *aNew = sqlite3_malloc(nNew);
UNUSED_PARAMETER(p);
UNUSED_PARAMETER(zTerm);
UNUSED_PARAMETER(nTerm);
if( !aNew ){
return SQLITE_NOMEM;
}
if( pTS->nOutput==0 ){
if( pTS->aaOutput[0]==0 ){
/* If this is the first term selected, copy the doclist to the output
** buffer using memcpy(). TODO: Add a way to transfer control of the
** aDoclist buffer from the caller so as to avoid the memcpy().
*/
memcpy(aNew, aDoclist, nDoclist);
pTS->aaOutput[0] = sqlite3_malloc(nDoclist);
pTS->anOutput[0] = nDoclist;
if( pTS->aaOutput[0] ){
memcpy(pTS->aaOutput[0], aDoclist, nDoclist);
}else{
return SQLITE_NOMEM;
}
}else{
/* The output buffer is not empty. Merge doclist aDoclist with the
** existing output. This can only happen with prefix-searches (as
** searches for exact terms return exactly one doclist).
*/
int mergetype = (pTS->isReqPos ? MERGE_POS_OR : MERGE_OR);
fts3DoclistMerge(mergetype, 0, 0,
aNew, &nNew, pTS->aOutput, pTS->nOutput, aDoclist, nDoclist
);
char *aMerge = aDoclist;
int nMerge = nDoclist;
int iOut;
for(iOut=0; iOut<SizeofArray(pTS->aaOutput); iOut++){
char *aNew;
int nNew;
if( pTS->aaOutput[iOut]==0 ){
assert( iOut>0 );
pTS->aaOutput[iOut] = aMerge;
pTS->anOutput[iOut] = nMerge;
break;
}
nNew = nMerge + pTS->anOutput[iOut];
aNew = sqlite3_malloc(nNew);
if( !aNew ){
if( aMerge!=aDoclist ){
sqlite3_free(aMerge);
}
return SQLITE_NOMEM;
}
fts3DoclistMerge(mergetype, 0, 0,
aNew, &nNew, pTS->aaOutput[iOut], pTS->anOutput[iOut], aMerge, nMerge
);
if( iOut>0 ) sqlite3_free(aMerge);
sqlite3_free(pTS->aaOutput[iOut]);
pTS->aaOutput[iOut] = 0;
aMerge = aNew;
nMerge = nNew;
if( (iOut+1)==SizeofArray(pTS->aaOutput) ){
pTS->aaOutput[iOut] = aMerge;
pTS->anOutput[iOut] = nMerge;
}
}
}
sqlite3_free(pTS->aOutput);
pTS->aOutput = aNew;
pTS->nOutput = nNew;
return SQLITE_OK;
}
@@ -1791,12 +1867,17 @@ static int fts3TermSelect(
rc = sqlite3Fts3SegReaderIterate(p, apSegment, nSegment, &filter,
fts3TermSelectCb, (void *)&tsc
);
if( rc==SQLITE_OK ){
rc = fts3TermSelectMerge(&tsc);
}
if( rc==SQLITE_OK ){
*ppOut = tsc.aOutput;
*pnOut = tsc.nOutput;
*ppOut = tsc.aaOutput[0];
*pnOut = tsc.anOutput[0];
}else{
sqlite3_free(tsc.aOutput);
for(i=0; i<SizeofArray(tsc.aaOutput); i++){
sqlite3_free(tsc.aaOutput[i]);
}
}
finished:
+45 -22
View File
@@ -247,26 +247,51 @@ TESTSRC = \
$(TOP)/src/test_pcache.c \
$(TOP)/src/test_schema.c \
$(TOP)/src/test_server.c \
$(TOP)/src/test_stat.c \
$(TOP)/src/test_tclvar.c \
$(TOP)/src/test_thread.c \
$(TOP)/src/test_vfs.c \
$(TOP)/src/test_wsd.c
#TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
#TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
TESTSRC2 = \
$(TOP)/src/attach.c $(TOP)/src/backup.c $(TOP)/src/btree.c \
$(TOP)/src/build.c $(TOP)/src/date.c \
$(TOP)/src/expr.c $(TOP)/src/func.c $(TOP)/src/insert.c $(TOP)/src/wal.c \
$(TOP)/src/mem5.c $(TOP)/src/os.c \
$(TOP)/src/os_os2.c $(TOP)/src/os_unix.c $(TOP)/src/os_win.c \
$(TOP)/src/pager.c $(TOP)/src/pragma.c $(TOP)/src/prepare.c \
$(TOP)/src/printf.c $(TOP)/src/random.c $(TOP)/src/pcache.c \
$(TOP)/src/pcache1.c $(TOP)/src/select.c $(TOP)/src/tokenize.c \
$(TOP)/src/utf.c $(TOP)/src/util.c $(TOP)/src/vdbeapi.c $(TOP)/src/vdbeaux.c \
$(TOP)/src/vdbe.c $(TOP)/src/vdbemem.c $(TOP)/src/where.c parse.c \
$(TOP)/ext/fts3/fts3.c $(TOP)/ext/fts3/fts3_expr.c \
$(TOP)/ext/fts3/fts3_tokenizer.c $(TOP)/ext/fts3/fts3_write.c \
$(TOP)/src/attach.c \
$(TOP)/src/backup.c \
$(TOP)/src/btree.c \
$(TOP)/src/build.c \
$(TOP)/src/date.c \
$(TOP)/src/expr.c \
$(TOP)/src/func.c \
$(TOP)/src/insert.c \
$(TOP)/src/wal.c \
$(TOP)/src/mem5.c \
$(TOP)/src/os.c \
$(TOP)/src/os_os2.c \
$(TOP)/src/os_unix.c \
$(TOP)/src/os_win.c \
$(TOP)/src/pager.c \
$(TOP)/src/pragma.c \
$(TOP)/src/prepare.c \
$(TOP)/src/printf.c \
$(TOP)/src/random.c \
$(TOP)/src/pcache.c \
$(TOP)/src/pcache1.c \
$(TOP)/src/select.c \
$(TOP)/src/tokenize.c \
$(TOP)/src/utf.c \
$(TOP)/src/util.c \
$(TOP)/src/vdbeapi.c \
$(TOP)/src/vdbeaux.c \
$(TOP)/src/vdbe.c \
$(TOP)/src/vdbemem.c \
$(TOP)/src/where.c \
parse.c \
$(TOP)/ext/fts3/fts3.c \
$(TOP)/ext/fts3/fts3_expr.c \
$(TOP)/ext/fts3/fts3_tokenizer.c \
$(TOP)/ext/fts3/fts3_write.c \
$(TOP)/ext/async/sqlite3async.c
# Header files used by all library source files.
@@ -325,8 +350,6 @@ sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h
$(TOP)/src/shell.c \
libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
objects: $(LIBOBJ_ORIG)
# This target creates a directory named "tsrc" and fills it with
# copies of all of the C source code and header files needed to
# build on the target system. Some of the C source code and header
@@ -396,7 +419,7 @@ parse.c: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk
rm -f parse.h
./lemon $(OPTS) parse.y
mv parse.h parse.h.temp
awk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
$(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION
tclsh $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
@@ -470,21 +493,21 @@ tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a
# Rules to build the 'testfixture' application.
#
TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
TESTFIXTURE_FLAGS = -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
$(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
$(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
$(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \
-o testfixture$(EXE) $(LIBTCL) $(THREADLIB) libsqlite3.a
amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c
$(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
$(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
$(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
-o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
fts3-testfixture$(EXE): sqlite3.c fts3amal.c $(TESTSRC) $(TOP)/src/tclsqlite.c
$(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
$(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
-DSQLITE_ENABLE_FTS3=1 \
$(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c fts3amal.c \
-o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
@@ -493,7 +516,7 @@ fulltest: testfixture$(EXE) sqlite3$(EXE)
./testfixture$(EXE) $(TOP)/test/all.test
soaktest: testfixture$(EXE) sqlite3$(EXE)
./testfixture$(EXE) $(TOP)/test/all.test -soak 1
./testfixture$(EXE) $(TOP)/test/all.test -soak=1
test: testfixture$(EXE) sqlite3$(EXE)
./testfixture$(EXE) $(TOP)/test/veryquick.test
@@ -507,8 +530,8 @@ sqlite3_analyzer$(EXE): $(TOP)/src/tclsqlite.c sqlite3.c $(TESTSRC) \
-e 's,^,",' \
-e 's,$$,\\n",' \
$(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
$(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \
-DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_DEBUG=1 -DSQLITE_PRIVATE="" \
$(TCCX) $(TCL_FLAGS) -DTCLSH=2 $(TESTFIXTURE_FLAGS) \
-DSQLITE_TEST=1 -DSQLITE_PRIVATE="" \
$(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
-o sqlite3_analyzer$(EXE) \
$(LIBTCL) $(THREADLIB)
+220 -181
View File
@@ -1,9 +1,12 @@
C If\sthe\ssqlite3_wal_checkpoint()\sAPI\sis\spassed\sa\sNULL\spointer\sin\splace\sof\sa\sdatabase\sname,\sattempt\sto\scheckpoint\sall\sattached\sdatabases.
D 2010-05-03T14:05:43
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Fix\sa\scomment\stypo.\s\sThis\scheck-in\sis\s3.7.0\srelease\scandidate\s2.
D 2010-07-21T16:16:28
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F Makefile.vxworks ab005d301296c40e021ccd0133ce49ca811e319f
F Makefile.vxworks 4314cde20a1d9460ec5083526ea975442306ae7e
F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
F VERSION 4dce4379514b12d6bc5c30f7d1f64582ccb4f412
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
@@ -15,17 +18,21 @@ F art/SQLiteLogo3.tiff b9e6bf022ae939bc986cddb8ab99583ca1b02cb3
F art/SQLite_big.gif 2b8e4603b91ba2a2c7062a82ff570d945034bb30
F art/nocopy.gif 716aa07d4bb7250d4e75756073bf8ef9f56bec8f
F art/powered_by_sqlite.gif 7fbcd7d3675391fd3d21672c14c05f5999eb60d1
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
F art/src_logo.gif 9341ef09f0e53cd44c0c9b6fc3c16f7f3d6c2ad9
F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
F config.h.in 868fdb48c028421a203470e15c69ada15b9ba673
F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
F configure 72c0ad7c8cfabbffeaf8ca61e1d24143cf857eb2 x
F configure 009ceb10a7bd768b6460b7b8782eb639063c8899 x
F configure.ac 14740970ddb674d92a9f5da89083dff1179014ff
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/lemon.html f0f682f50210928c07e562621c3b7e8ab912a538
F doc/pager-invariants.txt 870107036470d7c419e93768676fae2f8749cf9e
F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a
F ext/README.txt 913a7bd3f4837ab14d7e063304181787658b14e1
F ext/async/README.txt 0c541f418b14b415212264cbaaf51c924ec62e5b
F ext/async/sqlite3async.c 676066c2a111a8b3107aeb59bdbbbf335c348f4a
F ext/async/sqlite3async.c a7c6078c82c0bac3b7bea95bc52d5ce7ed58083a
F ext/async/sqlite3async.h a21e1252deb14a2c211f0e165c4b9122a8f1f344
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b
@@ -56,7 +63,7 @@ F ext/fts2/mkfts2amal.tcl 974d5d438cb3f7c4a652639262f82418c1e4cff0
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
F ext/fts3/fts3.c 20c55bed37307a2cd590387d33a9c8127b354ab4
F ext/fts3/fts3.c 9dec342fa1cf0914da679a3b7c0d4b53a27883ba
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
F ext/fts3/fts3Int.h 70528ba8c33991699f96ecc64112122833cdbdb5
F ext/fts3/fts3_expr.c f4ff02ebe854e97ac03ff00b38b728a9ab57fd4b
@@ -89,7 +96,7 @@ F ext/rtree/tkt3363.test 2bf324f7908084a5f463de3109db9c6e607feb1b
F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F main.mk b681194d6bf557b80ca363306e9c172f81f15b1d
F main.mk 26ad86cf0689940f19b3d608bbfdb3956b2fb9a7
F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a
F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac
@@ -103,143 +110,145 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad
F src/alter.c a9ff6f14b3935502537e90194b66c7bc79bed317
F src/analyze.c 8dfd781ac326496746ecdfc3e099250ed5d79be5
F src/attach.c 7abe1607c2054585377cdba3c219e8572f84ca5e
F src/analyze.c 3457a2af126eb78f20ad239c225a2c8ed61b78b6
F src/attach.c 17bec1f18254d9341369f20f90ba24ce35d20d10
F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
F src/backup.c e86634da8c48357a759694c9c7c471125cd8d5a8
F src/backup.c 51d83300fe0baee39405c416ceb19a58ed30a8ed
F src/bitvec.c 06ad2c36a9c3819c0b9cbffec7b15f58d5d834e0
F src/btmutex.c 96a12f50f7a17475155971a241d85ec5171573ff
F src/btree.c d0414a5f09b0cacb64bd60b91c5a3720585925aa
F src/btree.c 9a214e6141555b183216b73ace058c7a499cdbe2
F src/btree.h dd83041eda10c17daf023257c1fc883b5f71f85a
F src/btreeInt.h b0c87f6725b06a0aa194a6d25d54b16ce9d6e291
F src/build.c 11100b66fb97638d2d874c1d34d8db90650bb1d7
F src/build.c 559d38b48f79bc92370c082f4606eefe1e8f94ac
F src/callback.c 01843bdf4b0420fd28046525d150fcd9802931a9
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
F src/ctime.c 51553a859994d01d8bf3500747f66a890c459774
F src/date.c 485a4409a384310e6d93fd1104a9d0a8658becd9
F src/delete.c 610dc008e88a9599f905f5cbe9577ac9c36e0581
F src/expr.c 286f62b24217ade1c14ba56de413ffdd607b6a41
F src/ctime.c 4f3aadad62c6c9f0d4e5a96718516ac4e3c598df
F src/date.c 5dd8448a0bfea8d31fb14cff487d0c06ff8c8b20
F src/delete.c 41cb4f78557810eecc167b7e2317de7e12d20929
F src/expr.c b2b053429575bf964c64bdf5459c5cbbe5bf93b8
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c e2116672a6bd610dc888e27df292ebc7999c9bb0
F src/func.c 0c28599430856631216b6c0131c51c89bf516026
F src/global.c 5a9c1e3c93213ca574786ac1caa976ce8f709105
F src/global.c 02335177cf6946fe5525c6f0755cf181140debf3
F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af
F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
F src/insert.c 3a9567687f6b84ab9a41448e3d2ce20424f4743c
F src/journal.c b0ea6b70b532961118ab70301c00a33089f9315c
F src/insert.c d9476f23f85a20eea3cc25a4b9f9cbae77a33bf2
F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
F src/loadext.c 1c7a61ce1281041f437333f366a96aa0d29bb581
F src/main.c 6bc746f6016e0a3e6a7089078d9feffc0aa24a5e
F src/malloc.c a08f16d134f0bfab6b20c3cd142ebf3e58235a6a
F src/main.c a487fe90aecaccb142e4a6b738c7e26e99145bcd
F src/malloc.c 09c3777bf733a387bec6aa344e455eb4e8ecf47e
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 89d4ea8d5cdd55635cbaa48ad53132af6294cbb2
F src/mem2.c 2ee7bdacda8299b5a91cff9f7ee3e46573195c38
F src/mem3.c 9b237d911ba9904142a804be727cc6664873f8a3
F src/mem5.c eb7a5cb98915dd7a086fa415ce3a5a0f20d0acff
F src/memjournal.c f3be374af30588de297dcf678925b2a4758e4135
F src/mutex.c c04412513619b3a763f3484bb412336fa3a3fbd9
F src/memjournal.c 4a93a25ad9f76c40afa070ffd7187eb3a5fd7aee
F src/mutex.c 6949180803ff05a7d0e2b9334a95b4fb5a00e23f
F src/mutex.h 6fde601e55fa6c3fae768783c439797ab84c87c6
F src/mutex_noop.c 5f58eaa31f2d742cb8957a747f7887ae98f16053
F src/mutex_os2.c 20477db50cf3817c2f1cd3eb61e5c177e50231db
F src/mutex_unix.c 04a25238abce7e3d06b358dcf706e26624270809
F src/mutex_w32.c 4cc201c1bfd11d1562810554ff5500e735559d7e
F src/mutex_noop.c d5cfbca87168c661a0b118cd8e329a908e453151
F src/mutex_os2.c 6a62583e374ba3ac1a3fcc0da2bfdac7d3942689
F src/mutex_unix.c cf84466b4fdd2baa0d5a10bb19f08b2abc1ce42e
F src/mutex_w32.c 1fe0e735897be20e09dd6f53c3fb516c6b48c0eb
F src/notify.c cbfa66a836da3a51567209636e6a94059c137930
F src/os.c 8bc63cf91e9802e2b807198e54e50227fa889306
F src/os.h 534b082c3cb349ad05fa6fa0b06087e022af282c
F src/os_common.h 0d6ee583b6ee3185eb9d951f890c6dd03021a08d
F src/os_os2.c 8ad77a418630d7dee91d1bb04f79c2096301d3a0
F src/os_unix.c 5c821e4eb04093102d901c22f40341bc1d30aef0
F src/os_win.c a8fc01d8483be472e495793c01064fd87e56a5c1
F src/pager.c e9c7fe979b32a3c5bf4216d8fbe1cf8beff8a1b8
F src/pager.h 934b598583a9d936bb13c37d62a2fe68ac48781c
F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e
F src/pcache.c ace8f6a5ecd4711cc66a1b23053be7109bd437cf
F src/os.c 60178f518c4d6c0dcb59f7292232281d7bea2dcf
F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19
F src/os_unix.c 3109e0e5a0d5551bab2e8c7322b20a3b8b171248
F src/os_win.c 1f8b0a1a5bcf6289e7754d0d3c16cec16d4c93ab
F src/pager.c 78ca1e1f3315c8227431c403c04d791dccf242fb
F src/pager.h 879fdde5a102d2f21a3135d6f647530b21c2796c
F src/parse.y 220a11ac72e2c9dffbf4cbe5fe462f328bd8d884
F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07
F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050
F src/pcache1.c 6dc1871ce8ead9187161c370a58cd06c84221f76
F src/pragma.c 5fa66bc24bd4e842d3edb86a319223b86ba5493c
F src/prepare.c fd1398cb1da54385ba5bd68d93928f10d10a1d9c
F src/pcache1.c 3a7c28f46a61b43ff0b5c087a7983c154f4b264c
F src/pragma.c 4a79269ea6f86150fb8e44688c753989fc7238dd
F src/prepare.c f045aeff869d6409a2eae2fe08f7dc2df9528195
F src/printf.c 5f5b65a83e63f2096a541a340722a509fa0240a7
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
F src/resolve.c ac5f1a713cd1ae77f08b83cc69581e11bf5ae6f9
F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
F src/select.c c03d8a0565febcde8c6a12c5d77d065fddae889b
F src/shell.c c40427c7245535a04a9cb4a417b6cc05c022e6a4
F src/sqlite.h.in 8097161ad63e2a00e26217da43327d396371c2e5
F src/select.c 4903ff1bbd08b55cbce00ea43c645530de41b362
F src/shell.c fd4ccdb37c3b68de0623eb938a649e0990710714
F src/sqlite.h.in 8b05aef506d9bc7fc7da1572744e3174cb16ed59
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
F src/sqliteInt.h e7f1368eb56d8a410e510bcffb9ca5795060c58c
F src/sqliteInt.h d9e42f2029d4c526f9ba960bda1980ef17429c30
F src/sqliteLimit.h 196e2f83c3b444c4548fc1874f52f84fdbda40f3
F src/status.c 4df6fe7dce2d256130b905847c6c60055882bdbe
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F src/tclsqlite.c 4de81521174fedacd8393ea7b70b730ce17f8eae
F src/test1.c ff95ca772d1df51618f9f1ef7ea432cdf851f97b
F src/test2.c b6b43413d495addd039a88b87d65c839f86b18cb
F src/tclsqlite.c ae1e4fb653c91ddad7e2534d209711a12604ccc4
F src/test1.c ff3b4533fc4d78d1bff2ef831a5791db55096ed3
F src/test2.c e3f564ab1e9fd0b47b0c9e23e7054e38bf0836cf
F src/test3.c 4c21700c73a890a47fc685c1097bfb661346ac94
F src/test4.c ad03bb987ddedce928f4258c1e7fa4109a73497d
F src/test5.c cc55900118fa4add8ec9cf69fc4225a4662f76b1
F src/test6.c 49b39daf8e88ed6baab25c524ca5635304f6f315
F src/test6.c c7256cc21d2409486d094277d5b017e8eced44ba
F src/test7.c 3f2d63e4ccf97f8c2cf1a7fa0a3c8e2e2a354e6e
F src/test8.c f959db9a22d882013b64c92753fa793b2ce3bdea
F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60
F src/test_async.c c1656facbaf43cb2e71b62621e5b9eb080e2621c
F src/test_async.c 0612a752896fad42d55c3999a5122af10dcf22ad
F src/test_autoext.c 30e7bd98ab6d70a62bb9ba572e4c7df347fe645e
F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de
F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2
F src/test_config.c 6210f501d358bde619ae761f06f123529c6ba24f
F src/test_config.c 5a11c51af2156e2d07186930b36f2b8239a4393f
F src/test_demovfs.c da81a5f7785bb352bda7911c332a983ec4f17f27
F src/test_devsym.c 3d324248b80f31b3b29ab9bca39c4d856a2c9160
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
F src/test_func.c 13b582345fb1185a93e46c53310fae8547dcce20
F src/test_hexio.c 1237f000ec7a491009b1233f5c626ea71bce1ea2
F src/test_init.c 5d624ffd0409d424cf9adbfe1f056b200270077c
F src/test_intarray.c d879bbf8e4ce085ab966d1f3c896a7c8b4f5fc99
F src/test_intarray.h 489edb9068bb926583445cb02589344961054207
F src/test_journal.c 0537fcf9d4ecb394ec8b27d887a004ecaab85f16
F src/test_journal.c 424a334cdfdc8a6f975abe3641440147bded3185
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
F src/test_malloc.c 2842c922b8e8d992aba722214952204ca025b411
F src/test_malloc.c 4ab85f2b8ae3a237f4e6557b0a641181a19ffab1
F src/test_mutex.c ce06b59aca168cd8c520b77159a24352a7469bd3
F src/test_onefile.c d9585f6e2056868f208b0c21378a05b68c9ceae2
F src/test_osinst.c f5d1a4ee8b80fc58d1430c56146de748584013a9
F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
F src/test_osinst.c f408c6a181f2fb04c56273afd5c3e1e82f60392c
F src/test_pcache.c 7bf828972ac0d2403f5cfa4cd14da41f8ebe73d8
F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6
F src/test_stat.c 6ebaf2a86d01ccda24e49c148f1d33e8badda06e
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
F src/test_thread.c aa9919c885a1fe53eafc73492f0898ee6c0a0726
F src/test_thread.c bedd05cad673dba53326f3aa468cc803038896c0
F src/test_vfs.c 7e291f85256516ebde6633bc381ff7eedfa30234
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/tokenize.c 25ceb0f0a746ea1d0f9553787f3f0a56853cfaeb
F src/trigger.c 8927588cb9e6d47f933b53bfe74200fbb504100d
F src/update.c c0dc6b75ad28b76b619042d934f337b02acee208
F src/trigger.c 67e95c76d625b92d43409ace771c8e0d02a09ac2
F src/update.c 19c899c23cd29fd102c9068e0b0ff5b087204beb
F src/utf.c 1baeeac91707a4df97ccc6141ec0f808278af685
F src/util.c 32aebf04c10e51ad3977a928b7416bed671b620b
F src/vacuum.c 8e7d9a6fd076774bb6e211cad335c7337948a164
F src/vdbe.c 8be37a1b18786b5c026adcb2e9edc93e3a940885
F src/vacuum.c 241a8386727c1497eba4955933356dfba6ff8c9f
F src/vdbe.c 6294de3327e09d14e9c06ecfd10e57c2d8e85307
F src/vdbe.h 471f6a3dcec4817ca33596fe7f6654d56c0e75f3
F src/vdbeInt.h 19ebc8c2a2e938340051ee65af3f377fb99102d1
F src/vdbeapi.c cf1ff7cbcbd44d2082af71b98762407ae01ce009
F src/vdbeaux.c 395d21a1617553ea9b9f4abe0d302449d8549e1d
F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
F src/vdbeapi.c dc3138f10afbc95ed3c21dd25abb154504b1db9d
F src/vdbeaux.c 7f99c1f00e4b31e8b28d8a87ecc2322bb46ae99c
F src/vdbeblob.c 258a6010ba7a82b72b327fb24c55790655689256
F src/vdbemem.c 5e579abf6532001dfbee0e640dc34eae897a9807
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
F src/wal.c dadd533e0103883f72bf541eaf1ef34adb4e3c99
F src/wal.h d6d4a6809151e30bed5b01dd05cf27858f5a7bc8
F src/wal.c 0925601f3299c2941a67c9cfff41ee710f70ca82
F src/wal.h 906c85760598b18584921fe08008435aa4eeeeb2
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356
F src/where.c 903a7828a0a7de03b5d0f1b5eff222d8d5b138f1
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
F test/all.test 6745008c144bd2956d58864d21f7b304689c1cce
F test/alter.test 15f9224868b290d6bf7a63f31437f31aee070636
F test/alter2.test 0266160d61b0f7156b7e7a9905dbf85ebe067c63
F test/alter2.test 52096b711afe5f219e575c6db7a70f7a35df4f63
F test/alter3.test 25b95a136708f22b87184fa6a4309eea03d65153
F test/alter4.test 9386ffd1e9c7245f43eca412b2058d747509cc1f
F test/altermalloc.test e81ac9657ed25c6c5bb09bebfa5a047cd8e4acfc
F test/analyze.test ad5329098fe4de4a96852231d53e3e9e6283ad4b
F test/analyze2.test a2ad7b0a4e13801ee3968fe70f22aff52326569c
F test/analyze.test bf692e7db414f268a136bade16c03a1bdbb9240c
F test/analyze2.test 59dac6c399c0c5d1a90a11ee7cc606743fb6db93
F test/analyze3.test 506203875258ffd8ffa879b9c3c5432022d2b6d8
F test/async.test 8c75d31b8330f8b70cf2571b014d4476a063efdb
F test/async.test ad4ba51b77cd118911a3fe1356b0809da9c108c3
F test/async2.test bf5e2ca2c96763b4cba3d016249ad7259a5603b6
F test/async3.test 93edaa9122f498e56ea98c36c72abc407f4fb11e
F test/async4.test 166cc07057ff6f908fe42dcffaa8ca732c757acb
F test/async4.test 1787e3952128aa10238bf39945126de7ca23685a
F test/async5.test f3592d79c84d6e83a5f50d3fd500445f7d97dfdf
F test/attach.test ce9660e51768fab93cf129787be886c5d6c4fd81
F test/attach2.test a295d2d7061adcee5884ef4a93c7c96a82765437
@@ -250,16 +259,16 @@ F test/auth2.test 270baddc8b9c273682760cffba6739d907bd2882
F test/auth3.test a4755e6a2a2fea547ffe63c874eb569e60a28eb5
F test/autoinc.test 85ef3180a737e6580086a018c09c6f1a52759b46
F test/autoindex1.test ffb06a246e2c1f89cfbe3d93eca513c9e78d4063
F test/autovacuum.test 25f891bc343a8bf5d9229e2e9ddab9f31a9ab5ec
F test/autovacuum.test bb7c0885e6f8f1d633045de48f2b66082162766d
F test/autovacuum_ioerr2.test 598b0663074d3673a9c1bc9a16e80971313bafe6
F test/avtrans.test 7a26ffc6a355b7fbff2a082f56180ede863b126c
F test/backup.test 5f7f66d067e695a6040be3295a5abc289f823838
F test/backup2.test 159419073d9769fdb1780ed7e5b391a046f898d5
F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85
F test/backup.test 200e64bd91244b73ca8094bc1e03dfc83cc94c2e
F test/backup2.test b7c69f937c912e85ac8a5dbd1e1cf290302b2d49
F test/backup_ioerr.test 1f012e692f42c0442ae652443258f70e9f20fa38
F test/backup_malloc.test 1e063c6d75143d0d6e0ae77971dd690070369387
F test/backup_malloc.test 7162d604ec2b4683c4b3799a48657fb8b5e2d450
F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f
F test/between.test 16b1776c6323faadb097a52d673e8e3d8be7d070
F test/bigfile.test 1e12ce56e59fc41ace231009599506c22b031fbb
F test/bigfile.test a8ec8073a20207456dab01a29ad9cde42b0dd103
F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
F test/bind.test 3c7b320969000c441a70952b0b15938fbb66237c
F test/bindxfer.test efecd12c580c14df5f4ad3b3e83c667744a4f7e0
@@ -274,11 +283,11 @@ F test/boundary3.test 56ef82096b4329aca2be74fa1e2b0f762ea0eb45
F test/boundary4.tcl 0bb4b1a94f4fc5ae59b79b9a2b7a140c405e2983
F test/boundary4.test 89e02fa66397b8a325d5eb102b5806f961f8ec4b
F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0
F test/cache.test 3ff445c445742a7b6b9ba6e1d62a25263f9424b9
F test/cache.test c4288607b54f2702858492fc4b92828336a1812f
F test/capi2.test 00032d7504b9c14f1b36331670c5e7b0f73e3c5d
F test/capi3.test 168e2cd66c58c510955b0f299750e4de73b8d952
F test/capi3b.test 664eb55318132f292f2c436f90906f578cad6b97
F test/capi3c.test 493385107dcedfaf4f2b1c3738c8c1fa00362006
F test/capi3.test 1945a2ba75e3f4c49d5beb8fc092115b6292d471
F test/capi3b.test efb2b9cfd127efa84433cd7a2d72ce0454ae0dc4
F test/capi3c.test bea67403a5e37a4b33230ee4723e315a2ffb31e7
F test/capi3d.test 57d83b690d7364bde02cddbf8339a4b50d80ce23
F test/cast.test 166951664a0b0a2e0f8fb5997a152490c6363932
F test/check.test db2b29d557544347d28e25b8406f5d5ecc3d1bc3
@@ -296,20 +305,20 @@ F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6
F test/colmeta.test 087c42997754b8c648819832241daf724f813322
F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b
F test/conflict.test 0ed68b11f22721052d880ee80bd528a0e0828236
F test/corrupt.test 0d346c9fe064ca71281685a8a732fcc83461bb99
F test/corrupt2.test 576122d756feda40e63ef1c1ff6c4720a927d126
F test/corrupt3.test 263e8bb04e2728df832fddf6973cf54c91db0c32
F test/corrupt4.test acdb01afaedf529004b70e55de1a6f5a05ae7fff
F test/corrupt.test 1a5bef8b2d178859af69814ecedcd37219a89968
F test/corrupt2.test 808a28d0ca3b97e9aa8c91cd2b485ea2700b76d1
F test/corrupt3.test a399dacccb91c732f6b071c913e70d195af8c058
F test/corrupt4.test b963f9e01e0f92d15c76fb0747876fd4b96dc30a
F test/corrupt5.test c23da7bfb20917cc7fdbb13ee25c7cc4e9fffeff
F test/corrupt6.test e69b877d478224deab7b66844566258cecacd25e
F test/corrupt7.test 1eb2214f29474fa6b155aa3da8a7d46bf52089e1
F test/corrupt8.test 9992ef7f67cefc576b92373f6bf5ab8775280f51
F test/corrupt9.test 4aa1cb1ef091cb0e13e89a819c72911631b5176a
F test/corrupt6.test 4e4161aef1f30b9f34582bb4142334b7f47eacae
F test/corrupt7.test a90caf89c7d7cb7893ea4d92529bd0c129317ee4
F test/corrupt8.test 48eb37ffb9a03bceada62219e2bd4c92f4b0cb75
F test/corrupt9.test fad0bc26a5c972580a8d763c62f24094f4e8ef25
F test/corruptA.test 38b4f81c16099f6d8fa8b37e188fde76b8243994
F test/corruptB.test d88b500f7994cb2eb9646410c263111e9831f889
F test/corruptC.test 691ed070baef5e1345939caadf270a52837a5064
F test/corruptB.test 44133515cf46c4d7bba691e3bcfa478080413af0
F test/corruptC.test 483aa35dadfd96bdf549e38d75ffc2942576477e
F test/corruptD.test 3ae6e2dc6e2226c6935a8a40d4b5ee3eba75f8c0
F test/corruptE.test 34de490791060d749c933aef3970839df3f63ea9
F test/corruptE.test 7290b61145d954be549340e462ca84826d8a31a3
F test/count.test 454e1ce985c94d13efeac405ce54439f49336163
F test/crash.test 1b6ac8410689ff78028887f445062dc897c9ac89
F test/crash2.test 5b14d4eb58b880e231361d3b609b216acda86651
@@ -318,36 +327,37 @@ F test/crash4.test 02ff4f15c149ca1e88a5c299b4896c84d9450c3b
F test/crash5.test 80a2f7073381837fc082435c97df52a830abcd80
F test/crash6.test 9c730cf06335003cb1f5cfceddacd044155336e0
F test/crash7.test e20a7b9ee1d16eaef7c94a4cb7ed2191b4d05970
F test/crash8.test 3af0fc90c3e593b85e810b8d6c50fc7d0df30008
F test/crash8.test 76b95451933fe172ce8e26bff22d5c663c8ae473
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
F test/createtab.test 199cf68f44e5d9e87a0b8afc7130fdeb4def3272
F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
F test/ctime.test f5040beef89c1b2bdb6a9edb7358a519213ff80c
F test/date.test 0b8473ed9ab6fd4283b4a01f035e1067762ba734
F test/ctime.test 7bd009071e242aac4f18521581536b652b789a47
F test/date.test 6354b883f922c38046a8efbad187cc95df6da023
F test/dbstatus.test 838447a0ecca1232675b025c0a518a9ef0f8057e
F test/default.test 6faf23ccb300114924353007795aa9a8ec0aa9dc
F test/delete.test f7629d9eb245dfca170169cc5c7a735dec34aeb4
F test/delete2.test 3a03f2cca1f9a67ec469915cb8babd6485db43fa
F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab
F test/descidx1.test a13d443571e045b61b1b2b759df8dcffa092c968
F test/descidx2.test 1310ed1326cdfed4ea2c55169631579f082d174f
F test/descidx3.test 3394ad4d089335cac743c36a14129d6d931c316f
F test/descidx1.test b1353c1a15cfbee97b13a1dcedaf0fe78163ba6a
F test/descidx2.test 9f1a0c83fd57f8667c82310ca21b30a350888b5d
F test/descidx3.test fe720e8b37d59f4cef808b0bf4e1b391c2e56b6f
F test/diskfull.test 0cede7ef9d8f415d9d3944005c76be7589bb5ebb
F test/distinctagg.test 1a6ef9c87a58669438fc771450d7a72577417376
F test/e_expr.test 141e53fea525bce4f5403fcb0067b88e64fec5eb
F test/e_fkey.test 6721a741c6499b3ab7e5385923233343c8f1ad05
F test/e_fts3.test 75bb0aee26384ef586165e21018a17f7cd843469
F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398
F test/enc3.test 5c550d59ff31dccdba5d1a02ae11c7047d77c041
F test/eval.test bc269c365ba877554948441e91ad5373f9f91be3
F test/exclusive.test 4d8a112d6c5bf52014e9383c25ff193cc4f67185
F test/exclusive2.test 6bdf254770a843c2933b54bee9ed239934f0a183
F test/exclusive.test 5fe18e10a159342dd52ca14b1554e33f98734267
F test/exclusive2.test fcbb1c9ca9739292a0a22a3763243ad6d868086b
F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7
F test/expr.test 9f521ae22f00e074959f72ce2e55d46b9ed23f68
F test/filectrl.test 8923a6dc7630f31c8a9dd3d3d740aa0922df7bf8
F test/filefmt.test 84e3d0fe9f12d0d2ac852465c6f8450aea0d6f43
F test/filectrl.test 97003734290887566e01dded09dc9e99cb937e9e
F test/filefmt.test 5d271bf467e6557fe7499dcc8203069c9dc5825e
F test/fkey1.test 01c7de578e11747e720c2d9aeef27f239853c4da
F test/fkey2.test d5e065ede294ab52affe2116d54dc85a09301354
F test/fkey2.test 098c06c139a79f690301a43511cd1f6420ae5433
F test/fkey3.test 42f88d6048d8dc079e2a8cf7baad1cc1483a7620
F test/fkey_malloc.test a5ede29bd2f6e56dea78c3d43fb86dd696c068c8
F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb
@@ -365,7 +375,7 @@ F test/fts1m.test 2d9ca67b095d49f037a914087cc0a61e89da4f0c
F test/fts1n.test a2317dcd27b1d087ee3878b30e0a59c593c98b7a
F test/fts1o.test 382b8b07a2d6de5610814d9477117c4430464b9c
F test/fts1porter.test d86e9c3e0c7f8ff95add6582b4b585fb4e02b96d
F test/fts2.test 2fcc0cfcda440f1eb23b5d7897a8ec7b55a02239
F test/fts2.test e3fb95f96a650411574efc136f3fb10eef479ed7
F test/fts2a.test 473a5c8b473a4e21a8e3fddaed1e59666e0c6ab7
F test/fts2b.test 964abc0236c849c07ca1ae496bb25c268ae94816
F test/fts2c.test ffb5a35230ac72c4354535c547965ce6824537c0
@@ -385,8 +395,8 @@ F test/fts2p.test 4b48c35c91e6a7dbf5ac8d1e5691823cc999aafb
F test/fts2q.test b2fbbe038b7a31a52a6079b215e71226d8c6a682
F test/fts2r.test b154c30b63061d8725e320fba1a39e2201cadd5e
F test/fts2token.test d8070b241a15ff13592a9ae4a8b7c171af6f445a
F test/fts3.test ae0433b09b12def08105640e57693726c4949338
F test/fts3_common.tcl 1d887ded06dac9b993cfb175618df7f70c796de2
F test/fts3.test 672a040ea57036fb4b6fdc09027c18d7d24ab654
F test/fts3_common.tcl 4d8eec9db565fed9098f45c378f28e1657802011
F test/fts3aa.test 5327d4c1d9b6c61021696746cc9a6cdc5bf159c0
F test/fts3ab.test 09aeaa162aee6513d9ff336b6932211008b9d1f9
F test/fts3ac.test 636ed7486043055d4f126a0e385f2d5a82ebbf63
@@ -400,7 +410,7 @@ F test/fts3aj.test 584facbc9ac4381a7ec624bfde677340ffc2a5a4
F test/fts3ak.test bd14deafe9d1586e8e9bf032411026ac4f8c925d
F test/fts3al.test 07d64326e79bbdbab20ee87fc3328fbf01641c9f
F test/fts3am.test 218aa6ba0dfc50c7c16b2022aac5c6be593d08d8
F test/fts3an.test 931fa21bd80641ca594bfa32e105250a8a07918b
F test/fts3an.test a49ccadc07a2f7d646ec1b81bc09da2d85a85b18
F test/fts3ao.test 0aa29dd4fc1c8d46b1f7cfe5926f7ac97551bea9
F test/fts3atoken.test 25c2070e1e8755d414bf9c8200427b277a9f99fa
F test/fts3b.test e93bbb653e52afde110ad53bbd793f14fe7a8984
@@ -412,32 +422,32 @@ F test/fts3expr.test 5e745b2b6348499d9ef8d59015de3182072c564c
F test/fts3expr2.test 18da930352e5693eaa163a3eacf96233b7290d1a
F test/fts3malloc.test 059592c4f37ccd30138bbf8e3e5b7982cb5c8f2e
F test/fts3near.test 2e318ee434d32babd27c167142e2b94ddbab4844
F test/fts3query.test 1acb21b58d6aa7504e990f0f589be85e9a133969
F test/fts3rnd.test 2f5761db9dd92f6fe09d08976ac658ef521846ed
F test/fts3query.test 2468caf7938dbc3be2e049524320ce4faf2227b3
F test/fts3rnd.test 707533ce943f490443ce5e696236bb1675a37635
F test/fts3snippet.test 9f9a4a7e396c5d8ce2898be65ebabc429555430f
F test/fts4aa.test eadf85621c0a113d4c7ad3ccbf8441130e007b8f
F test/func.test 6c5ce11e3a0021ca3c0649234e2d4454c89110ca
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
F test/fuzz.test a4174c3009a3e2c2e14b31b364ebf7ddb49de2c9
F test/fuzz.test 77fd50afc12847af50fcf1941679d90adebadde6
F test/fuzz2.test 207d0f9d06db3eaf47a6b7bfc835b8e2fc397167
F test/fuzz3.test aec64345184d1662bd30e6a17851ff659d596dc5
F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b
F test/fuzz_malloc.test 4eca9d345f06d5b0b0105f7a2ef9e7f22658827b
F test/fuzz_malloc.test dd7001ac86d09c154a7dff064f4739c60e2b312c
F test/hook.test f04c3412463f8ec117c1c704c74ca0f627ce733a
F test/icu.test 1fc0ff9a3bafc80abf679b11afc0f8a3ce995abd
F test/in.test d49419c6df515852f477fa513f3317181d46bc92
F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75
F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0
F test/in4.test 64f3cc1acde1b9161ccdd8e5bde3daefdb5b2617
F test/incrblob.test 54ac96eacab29215f1e1513f3b6843ebd0242eac
F test/incrblob.test e557f262cd2cc088e6bb4d154575a1bbe242edcd
F test/incrblob2.test edc3a96e557bd61fb39acc8d2edd43371fbbaa19
F test/incrblob_err.test c577c91d4ed9e8336cdb188b15d6ee2a6fe9604e
F test/incrvacuum.test d0fb6ef6d747ef5c5ebe878aafa72dd3e178856b
F test/incrvacuum.test 453d1e490d8f5ad2c9b3a54282a0690d6ae56462
F test/incrvacuum2.test 9e22a794899c91b7d8c8e12eaacac8df249faafe
F test/incrvacuum_ioerr.test 57d2f5777ab13fa03b87b262a4ea1bad5cfc0291
F test/index.test cbf301cdb2da43e4eac636c3400c2439af1834ad
F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6
F test/index3.test 727d55dceb9a4ec36675057bb5becfc265e28ca6
F test/index3.test 423a25c789fc8cc51aaf2a4370bbdde2d9e9eed7
F test/indexedby.test 946ca2628a521f4ced0520421a0788345abaf3dc
F test/init.test 15c823093fdabbf7b531fe22cf037134d09587a7
F test/insert.test aef273dd1cee84cc92407469e6bd1b3cdcb76908
@@ -461,8 +471,10 @@ F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
F test/join5.test 86675fc2919269aa923c84dd00ee4249b97990fe
F test/join6.test bf82cf3f979e9eade83ad0d056a66c5ed71d1901
F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19
F test/jrnlmode.test a7407c0f193696f0ef303c663916c89e3bc4605d
F test/jrnlmode2.test fe79ea1f0375c926b8de0362ddf94f34a64135fd
F test/journal2.test 50a3604768494d4a337f194f0a9480e7c57dcb72
F test/journal3.test ff175219be1b02d2f7e54297ad7e491b7533edb6
F test/jrnlmode.test 2d5a8b6d68de8512f522532731d90ca96912f3b7
F test/jrnlmode2.test a19e28de1a6ec898067e46a122f1b71c9323bf00
F test/jrnlmode3.test cfcdb12b90e640a23b92785a002d96c0624c8710
F test/keyword1.test a2400977a2e4fde43bf33754c2929fda34dbca05
F test/lastinsert.test 474d519c68cb79d07ecae56a763aa7f322c72f51
@@ -473,17 +485,17 @@ F test/limit.test 2db7b3b34fb925b8e847d583d2eb67531d0ce67e
F test/loadext.test 0393ce12d9616aa87597dd0ec88181de181f6db0
F test/loadext2.test 0bcaeb4d81cd5b6e883fdfea3c1bdbe1f173cbca
F test/lock.test 842e80b6be816c79525a20b098cca066989feed7
F test/lock2.test 64ba8f1c7709abf91287d564984a6b8c5209e755
F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff
F test/lock3.test f271375930711ae044080f4fe6d6eda930870d00
F test/lock4.test f4f36271aa5ae1da449646bf43c7341f6b2b4c4e
F test/lock5.test 6b1f78f09ad1522843dad571b76b321e6f439bf7
F test/lock6.test 862aa71e97b288d6b3f92ba3313f51bd0b003776
F test/lock4.test c82268c031d39345d05efa672f80b025481b3ae5
F test/lock5.test b2abb5e711bc59b0eae00f6c97a36ec9f458fada
F test/lock6.test 8df56060f396151777390982422c800d026e1722
F test/lock7.test 64006c84c1c616657e237c7ad6532b765611cf64
F test/lock_common.tcl bbc4e15ee5334cc4d01fcac08d7c9de7d8906e55
F test/lookaside.test 1dd350dc6dff015c47c07fcc5a727a72fc5bae02
F test/main.test 2be2352ac77ac5b238c6337a5469aeeef57677e6
F test/lock_common.tcl e7013c6208f5fa818735c324eb0249b4c0f317cf
F test/lookaside.test 382e7bc2fab23d902c8eafb1b9ed7ababfff75a6
F test/main.test 9d7bbfcc1b52c88ba7b2ba6554068ecf9939f252
F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
F test/malloc.test d23580e15c33ee0353717129421b077541e910dc
F test/malloc.test 927e6c8668a1d48c23aa6189bda02aff5a1b83de
F test/malloc3.test 4bc57f850b212f706f3e1b37c4eced1d5a727cd1
F test/malloc4.test 957337613002b7058a85116493a262f679f3a261
F test/malloc5.test 4d16d1bb26d2deddd7c4f480deec341f9b2d0e22
@@ -492,70 +504,76 @@ F test/malloc7.test 7c68a32942858bc715284856c5507446bba88c3a
F test/malloc8.test 9b7a3f8cb9cf0b12fff566e80a980b1767bd961d
F test/malloc9.test 2307c6ee3703b0a21391f3ea92388b4b73f9105e
F test/mallocA.test 4b650c745aab289079454f4d1c02abe5c97ab6b3
F test/mallocAll.test 2a2222a5e447be6c6579055a9a26e507e4586f4e
F test/mallocAll.test 98f1be74bc9f49a858bc4f361fc58e26486798be
F test/mallocB.test bc475ab850cda896142ab935bbfbc74c24e51ed6
F test/mallocC.test 7fcfb7c6cab30dc90d0fe3f2d5e3bcda5de33761
F test/mallocC.test 3dffe16532f109293ce1ccecd0c31dca55ef08c4
F test/mallocD.test f78c295e8e18ea3029e65ca08278690e00c22100
F test/mallocE.test db1ed69d7eded1b080952e2a7c37f364ad241b08
F test/mallocF.test 2d5c590ebc2fc7f0dcebdf5aa8498b9aed69107e
F test/mallocG.test 4584d0d8ddb8009f16ca0c8bab1fa37f6358efa2
F test/mallocH.test 79b65aed612c9b3ed2dcdaa727c85895fd1bfbdb
F test/mallocI.test e3ea401904d010cb7c1e4b2ee8803f4a9f5b999d
F test/mallocI.test a88c2b9627c8506bf4703d8397420043a786cdb6
F test/mallocJ.test b5d1839da331d96223e5f458856f8ffe1366f62e
F test/mallocK.test d79968641d1b70d88f6c01bdb9a7eb4a55582cc9
F test/malloc_common.tcl 984baeb6c6b185e798827d1187d426acc2bc4962
F test/malloc_common.tcl f4a04b7a733eb114a3da16eb39035cde2c851220
F test/manydb.test b3d3bc4c25657e7f68d157f031eb4db7b3df0d3c
F test/memdb.test 0825155b2290e900264daaaf0334b6dfe69ea498
F test/memleak.test d2d2a1ff7105d32dc3fdf691458cf6cba58c7217
F test/memsubsys1.test fd8a33046b6e758e3eb93747dc4eec21fe56bf64
F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2
F test/memsubsys1.test 8fb47b7e2523f94c100f5885c5697505524de4b9
F test/memsubsys2.test 72a731225997ad5e8df89fdbeae9224616b6aecc
F test/minmax.test 722d80816f7e096bf2c04f4111f1a6c1ba65453d
F test/minmax2.test 33504c01a03bd99226144e4b03f7631a274d66e0
F test/minmax3.test a38686c33b07d595e98a2fc6d3aa84a5e886a972
F test/minmax3.test 66a60eb0f20281b0753249d347c5de0766954cee
F test/misc1.test e56baf44656dd68d6475a4b44521045a60241e9b
F test/misc2.test a628db7b03e18973e5d446c67696b03de718c9fd
F test/misc3.test 72c5dc87a78e7865c5ec7a969fc572913dbe96b6
F test/misc4.test 91e8ed25c092c2bb4e0bb01864631e2930f8d7de
F test/misc5.test 6a5c1e3217a95b0db05ff9a0f1ecb5ce9043ffef
F test/misc5.test 45b2e3ed5f79af2b4f38ae362eaf4c49674575bd
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
F test/misc7.test c5f4e6a82e04e71820c0f9f64f6733f04c8ae0ae
F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33
F test/mutex1.test 5b71777fc127509cd257910c8db799de557a02de
F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
F test/nan.test cf555724e5a26aed2296a3f2637feee9f728cd81
F test/nan.test a44e04df1486fcfb02d32468cbcd3c8e1e433723
F test/notify1.test 8433bc74bd952fb8a6e3f8d7a4c2b28dfd69e310
F test/notify2.test 195a467e021f74197be2c4fb02d6dee644b8d8db
F test/notify3.test 7eeba3628c4e707c004b72a2489c48fbdbc5c2ee
F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
F test/null.test a8b09b8ed87852742343b33441a9240022108993
F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
F test/pageropt.test 3ee6578891baaca967f0bd349e4abfa736229e1a
F test/pager1.test d8e4b2bc8164c920e6ea0572c9e13576d6e4f3fa
F test/pager2.test f5c757c271ce642d36a393ecbfb3aef1c240dcef
F test/pagerfault.test a4c0bb8900b8dbf5fcbe41ee2a96148e22174bcb
F test/pagerfault2.test 1f79ea40d1133b2683a2f811b00f2399f7ec2401
F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806
F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb
F test/pcache.test eebc4420b37cb07733ae9b6e99c9da7c40dd6d58
F test/pcache.test 4118a183908ecaed343a06fcef3ba82e87e0129d
F test/pcache2.test 0d85f2ab6963aee28c671d4c71bec038c00a1d16
F test/permutations.test 7d9064978f0ca90d0ec827a7ada9e8e2615b1143
F test/pragma.test 6960f9efbce476f70ba9ee2171daf5042f9e3d8a
F test/permutations.test 3fe47c21c32b294b2354e702a25bfbff65747bb1
F test/pragma.test ed78d200f65c6998df51196cb8c39d5300570f24
F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea
F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
F test/quick.test 6f202befe1cfae0b63df96b3120a8022ab11f574
F test/quick.test 1681febc928d686362d50057c642f77a02c62e57
F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6
F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459
F test/randexpr1.test 1084050991e9ba22c1c10edd8d84673b501cc25a
F test/rdonly.test c243623b26c311faab2aee311a26af372e123a65
F test/rdonly.test c267d050a1d9a6a321de502b737daf28821a518d
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
F test/rollback.test 73355ad4492ff9a3a31e61c7e5eb5e01a1de94ca
F test/rowhash.test 97f56043ba11f0679920416c0cdbc72e5272267b
F test/rollback.test 1a83118ea6db4e7d8c10eaa63871b5e90502ffdc
F test/rowhash.test 0bc1d31415e4575d10cacf31e1a66b5cc0f8be81
F test/rowid.test e58e0acef38b527ed1b0b70d3ada588f804af287
F test/rtree.test 55466a200af3591946c5da77ad5dbfbc1e5e05f9
F test/savepoint.test 14f78c2c2538764850b38446957048113cc24f75
F test/rtree.test fb372aff108d4371bd0b5e63e106947587ff4310
F test/savepoint.test 992d6429b6bce16ac172f7431975044ceaeb0803
F test/savepoint2.test 9b8543940572a2f01a18298c3135ad0c9f4f67d7
F test/savepoint3.test e328085853b14898d78ceea00dfe7db18bb6a9ec
F test/savepoint4.test c8f8159ade6d2acd9128be61e1230f1c1edc6cc0
F test/savepoint5.test 0735db177e0ebbaedc39812c8d065075d563c4fd
F test/savepoint6.test bdc653c5c08328c84a74471b5b23fd483b919dfe
F test/savepoint6.test 76d3948568b2cdc0c13a671cadcae75009b183d6
F test/schema.test 8f7999be894260f151adf15c2c7540f1c6d6a481
F test/schema2.test 906408621ea881fdb496d878b1822572a34e32c5
F test/schema3.test 1bc1008e1f8cb5654b248c55f27249366eb7ed38
F test/securedel.test 328d2921c0ca49bdd3352e516b0377fc07143254
F test/select1.test f67ca2dfc05df41c7b86eb32ca409b427a5f43b0
F test/select2.test 352480e0e9c66eda9c3044e412abdf5be0215b56
@@ -565,14 +583,14 @@ F test/select5.test e758b8ef94f69b111df4cb819008856655dcd535
F test/select6.test 2b5e8500d8ec3dd4c8e0c99eb1431b3d11fcc24c
F test/select7.test dad6f00f0d49728a879d6eb6451d4752db0b0abe
F test/select8.test 391de11bdd52339c30580dabbbbe97e3e9a3c79d
F test/select9.test b4007b15396cb7ba2615cab31e1973b572e43210
F test/select9.test 74c0fb2c6eecb0219cbed0cbe3df136f8fbf9343
F test/selectA.test 06d1032fa9009314c95394f2ca2e60d9f7ae8532
F test/selectB.test f305cc6660804cb239aab4e2f26b0e288b59958b
F test/selectC.test 33bb5673a8141df193c6fd56e6de7fea38b8d2ee
F test/server1.test f5b790d4c0498179151ca8a7715a65a7802c859c
F test/shared.test 3b448dc0f7a9356e641894ed81c27599f39d809d
F test/shared2.test d6ba4ca1827ea36a1ac23a99e3c36eeac9165450
F test/shared3.test 9c880afc081d797da514ef64bccf36f3fce2f09c
F test/shared3.test d69bdd5f156580876c5345652d21dc2092e85962
F test/shared4.test d0fadacb50bb6981b2fb9dc6d1da30fa1edddf83
F test/shared6.test 990d2584b5db28e6e1f24742c711b26e59757b67
F test/shared7.test 8114027cb5e8c376e467115703d46e5ac4e77739
@@ -580,8 +598,8 @@ F test/shared_err.test 91e26ec4f3fbe07951967955585137e2f18993de
F test/sharedlock.test ffa0a3c4ac192145b310f1254f8afca4d553eabf
F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
F test/sidedelete.test f0ad71abe6233e3b153100f3b8d679b19a488329
F test/soak.test d9d0a5e5c0157115c9a17f526f12691fe146768d
F test/softheap1.test 73ebd6e020d2954d965da2072baba5922fc8fb6a
F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f
F test/softheap1.test c16709a16ad79fa43b32929b2e623d1d117ccf53
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
F test/speed1.test f2974a91d79f58507ada01864c0e323093065452
F test/speed1p.explain d841e650a04728b39e6740296b852dccdca9b2cb
@@ -592,40 +610,46 @@ F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b
F test/sqllimits1.test e90a0ed94452076f6a10209d378e06b5f75ef0a0
F test/stmt.test ac97e59879fd3bd52ecd60ef4efb03ba16292829
F test/stat.test 70fe540ffb285947aead5533dfd0c8c12f17f14e
F test/stmt.test 7915bd3e8380b956c095f40f41a775a30716e649
F test/subquery.test b524f57c9574b2c0347045b4510ef795d4686796
F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4
F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a
F test/sync.test ded6b39d8d8ca3c0c5518516c6371b3316d3e3a3
F test/table.test bf102a5669c4db7a41330802f24a4a81a4204f83
F test/table.test 04ba066432430657712d167ebf28080fe878d305
F test/tableapi.test 7262a8cbaa9965d429f1cbd2747edc185fa56516
F test/tclsqlite.test 013133fa83128569c6fb8a7a48dc7c4507e6ff1c
F test/tempdb.test 1bf52da28a9c24e29717362a87722dff08feb72b
F test/tclsqlite.test 8c154101e704170c2be10f137a5499ac2c6da8d3
F test/tempdb.test 800c36623d67a2ad1f58784b9c5644e0405af6e6
F test/temptable.test f42121a0d29a62f00f93274464164177ab1cc24a
F test/temptrigger.test b0273db072ce5f37cf19140ceb1f0d524bbe9f05
F test/tester.tcl 17082172a11795f9bc3e843aadb463ff76050c68
F test/tester.tcl cab2b46972cd50c3939a0e30e0b37e73f558bc2d
F test/thread001.test a3e6a7254d1cb057836cb3145b60c10bf5b7e60f
F test/thread002.test afd20095e6e845b405df4f2c920cb93301ca69db
F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca
F test/thread004.test f51dfc3936184aaf73ee85f315224baad272a87f
F test/thread005.test bf5c374ca65dd89fd56c8fe511ccfb46875bda5e
F test/thread1.test 862dd006d189e8b0946935db17399dcac2f8ef91
F test/thread2.test 6e0997f7beabb6a7e471bd18740ed04805c785f4
F test/thread_common.tcl 0b07423d29ddb73d4bacbac69268c8d37b6cc5d2
F test/thread2.test e08034b83fe9693ade77049732518e5b3d2d700d
F test/thread_common.tcl 2aa6f2fdcd4d6e461169c3e5ca098eebf643b863
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9
F test/tkt-02a8e81d44.test 58494de77be2cf249228ada3f313fa399821c6ab
F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660
F test/tkt-2ea2425d34.test 1cf13e6f75d149b3209a0cb32927a82d3d79fb28
F test/tkt-31338dca7e.test 5741cd48de500347a437ba1be58c8335e83c5a5e
F test/tkt-3fe897352e.test 10de1a67bd5c66b238a4c96abe55531b37bb4f00
F test/tkt-4a03edc4c8.test 2865e4edbc075b954daa82f8da7cc973033ec76e
F test/tkt-5ee23731f.test 3581260f2a71e51db94e1506ba6b0f7311d002a9
F test/tkt-78e04e52ea.test fb5430c675e708f5cbafdf3e7e5593da5145a527
F test/tkt-80e031a00f.test 9a154173461a4dbe2de49cda73963e04842d52f7
F test/tkt-94c04eaadb.test be5ea61cb04dfdc047d19b5c5a9e75fa3da67a7f
F test/tkt-9d68c883.test 4251ef9fa08158e50b28a682e56124457a59d048
F test/tkt-9d68c883.test 458f7d82a523d7644b54b497c986378a7d8c8b67
F test/tkt-cbd054fa6b.test f14f97ea43662e6f70c9e63287081e8be5d9d589
F test/tkt-d11f09d36e.test fb44f7961aa6d4b632fb7b9768239832210b5fc7
F test/tkt-d82e3f3721.test 731359dfdcdb36fea0559cd33fec39dd0ceae8e6
F test/tkt-f777251dc7a.test 6f24c053bc5cdb7e1e19be9a72c8887cf41d5e87
F test/tkt-f973c7ac31.test 1da0ed15ec2c7749fb5ce2828cd69d07153ad9f4
F test/tkt-fc62af4523.test 72825d3febdedcd5593a27989fc05accdbfc2bb4
F test/tkt1435.test f8c52c41de6e5ca02f1845f3a46e18e25cadac00
F test/tkt1443.test bacc311da5c96a227bf8c167e77a30c99f8e8368
F test/tkt1444.test a9d72f9e942708bd82dde6c707da61c489e213e9
@@ -677,7 +701,6 @@ F test/tkt3424.test 61f831bd2b071bd128fa5d00fbda57e656ca5812
F test/tkt3442.test 89d7b41a4ec4d9d9b40ab8575d648579fb13cb4f
F test/tkt3457.test edbf54b05cbe5165f00192becbd621038f1615e4
F test/tkt3461.test 228ea328a5a21e8663f80ee3d212a6ad92549a19
F test/tkt3472.test 98c7e54b8fef2b1266a552a66c8e5d88a6908d1d
F test/tkt3493.test 1686cbde85f8721fc1bdc0ee72f2ef2f63139218
F test/tkt3508.test d75704db9501625c7f7deec119fcaf1696aefb7d
F test/tkt3522.test 22ce2ebbcb04a6be56c0977d405c207967318fd6
@@ -712,7 +735,7 @@ F test/tkt3997.test a335fa41ca3985660a139df7b734a26ef53284bd
F test/tkt4018.test 7c2c9ba4df489c676a0a7a0e809a1fb9b2185bd1
F test/tokenize.test ce430a7aed48fc98301611429595883fdfcab5d7
F test/trace.test 4b36a41a3e9c7842151af6da5998f5080cdad9e5
F test/trans.test f19bd2c8b5ccc89295454a42b35319b1381b9a3d
F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6
F test/trans2.test d5337e61de45e66b1fcbf9db833fa8c82e624b22
F test/trans3.test d728abaa318ca364dc370e06576aa7e5fbed7e97
F test/trigger1.test 2e18561f85e448bb633c9c9de792e9bbf7b2dd3e
@@ -721,7 +744,7 @@ F test/trigger3.test d2c60d8be271c355d61727411e753181e877230a
F test/trigger4.test 8e90ee98cba940cd5f96493f82e55083806ab8a0
F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83
F test/trigger6.test 0e411654f122552da6590f0b4e6f781048a4a9b9
F test/trigger7.test 72feaf8dbc52cea84de0c3e6ce7559ff19c479af
F test/trigger7.test b39e6dee1debe0ff9c2ef66326668f149f07c9c4
F test/trigger8.test 30cb0530bd7c4728055420e3f739aa00412eafa4
F test/trigger9.test 5b0789f1c5c4600961f8e68511b825b87be53e31
F test/triggerA.test eaf11a29db2a11967d2d4b49d37f92bce598194e
@@ -739,7 +762,7 @@ F test/vacuum2.test ec57f21d394b7b72249b11f8e4b5d487bab56539
F test/vacuum3.test f39ad1428347c5808cd2da7578c470f186a4d0ce
F test/vacuum4.test d3f8ecff345f166911568f397d2432c16d2867d9
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/veryquick.test e265401afefa994cdf2fe4b6f286b1e87c2f9b9d
F test/veryquick.test 7701bb609fe8bf6535514e8b849a309e8f00573b
F test/view.test 45f518205ecdb6dd23a86dd4a99bb4ae945e625d
F test/vtab1.test 9bc4a349a1989bcd064eb3b8fac2f06aca64297a
F test/vtab2.test 7bcffc050da5c68f4f312e49e443063e2d391c0d
@@ -758,13 +781,21 @@ F test/vtabE.test 7c4693638d7797ce2eda17af74292b97e705cc61
F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
F test/wal.test 0c7c059c194871dd42811c31599cf74f1e1123e4
F test/walbak.test a0e45187c7d8928df035dfea29b99b016b21ca3c
F test/walcrash.test 63edc6a9e05f645b54d649186a5818fc82953e2e
F test/walhook.test 5f18e0fc8787f1f8889d7a9971af18f334f83786
F test/walmode.test bac6f06544a8554588a1543def996bbe2fc41792
F test/wal.test 1891e6f72dd437a1c2a48091aa9182ba17a8f780
F test/wal2.test fa6dc4457b46988f46cf6c68ea51ebe341765f4a
F test/wal3.test d2ae7e66f973bd6b58ce49e546b2c00f44fe0485
F test/wal4.test 3404b048fa5e10605facaf70384e6d2943412e30
F test/wal_common.tcl 895d76138043b86bdccf36494054bdabcf65837b
F test/walbak.test 4df1c7369da0301caeb9a48fa45997fd592380e4
F test/walbig.test e882bc1d014afffbfa2b6ba36e0f07d30a633ad0
F test/walcksum.test a37b36375c595e61bdb7e1ec49b5f0979b6fc7ce
F test/walcrash.test e763841551d6b23677ccb419797c1589dcbdbaf5
F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142
F test/walfault.test 05c470688d742688e455dd56816bd6bcffa298f8
F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483
F test/walmode.test 5dc3008ef71988ecdd949ea16e5750e325b92b54
F test/walslow.test d21625e2e99e11c032ce949e8a94661576548933
F test/walthread.test cc3c5302dfd56361def4023b7f29d361f1f1602d
F test/walthread.test a25a393c068a2b42b44333fa3fdaae9072f1617c
F test/where.test de337a3fe0a459ec7c93db16a519657a90552330
F test/where2.test 43d4becaf5a5df854e6c21d624a1cb84c6904554
F test/where3.test aa44a9b29e8c9f3d7bb94a3bb3a95b31627d520d
@@ -783,32 +814,40 @@ F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4
F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
F tool/lemon.c 6958cb9935be265bf51dbc718ef325e3b77685b6
F tool/lemon.c fe890e2d8d2db1e3f57e2a22503dbb0f6843e517
F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc
F tool/mkkeywordhash.c d2e6b4a5965e23afb80fbe74bb54648cd371f309
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
F tool/mksqlite3c.tcl 42b6ba8b997a5f5a98f7f1df946c21c173eef586
F tool/mksqlite3c.tcl aff0d53f0e84cf919922c0d02e767bdf5eeafb90
F tool/mksqlite3h.tcl eb100dce83f24b501b325b340f8b5eb8e5106b3b
F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87
F tool/omittest.tcl 27d6f6e3b1e95aeb26a1c140e6eb57771c6d794a
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a
F tool/shell1.test ef08a3e738b9fee4fc228920956950bc35db0575
F tool/shell2.test 8f51f61c13b88618e71c17439fe0847c2421c5d1
F tool/shell3.test ff663e83100670a295d473515c12beb8103a78b6
F tool/showdb.c 12fbece85695e3a61bdb4f7607b61f264120c4b6
F tool/shell1.test a738c71bc08ea9162baee9a14b3cf9994f181921
F tool/shell2.test 5dc76b8005b465f420fed8241621da7513060ff3
F tool/shell3.test 4fad469e8003938426355afdf34155f08c587836
F tool/showdb.c 01c20e8181941b714fe07f72c64a7560fee17ff9
F tool/showjournal.c ec3b171be148656827c4949fbfb8ab4370822f87
F tool/showwal.c f09e5a80a293919290ec85a6a37c85a5ddcf37d9
F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe
F tool/space_used.tcl f714c41a59e326b8b9042f415b628b561bafa06b
F tool/spaceanal.tcl b87db46ae29e3116411b1686e136b9b994d7de39
F tool/spaceanal.tcl b91879d52bf77a1ff5382493284f429d32a63490
F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355
F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 11a85b821abff1ecb7ec8c37bc7783be9fc4ea6d
R 496e930fc5a775a552ace6c40959352e
U dan
Z 225bbd40c88bfb84bfc467a361edc728
P 13ed106c8c279422a6159e28c6887d13a88b7b8b
R 48f3b6e106f37a4303da6eef05383891
U drh
Z 6f03f192e574b328cbf6ee712ebb1776
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFMRx1eoxKgR168RlERAkrAAJ9jYeUOTv2JXqP7/ZLTAQf2A6QoNACeLuA0
lTLlFWVnujV93G1zfacFBTo=
=MCKn
-----END PGP SIGNATURE-----
+1 -1
View File
@@ -1 +1 @@
27a5c09ce8a35039d844d08cfe5698e8b438abfe
b36b105eab6fd3195f4bfba6cb5cda0f063b7460
+1 -1
View File
@@ -36,7 +36,7 @@ static void openStatTable(
int iStatCur, /* Open the sqlite_stat1 table on this cursor */
const char *zWhere /* Delete entries associated with this table */
){
static struct {
static const struct {
const char *zName;
const char *zCols;
} aTable[] = {
+3 -4
View File
@@ -143,7 +143,6 @@ static void attachFunc(
}
pPager = sqlite3BtreePager(aNew->pBt);
sqlite3PagerLockingMode(pPager, db->dfltLockMode);
sqlite3PagerJournalMode(pPager, db->dfltJournalMode);
sqlite3BtreeSecureDelete(aNew->pBt,
sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) );
}
@@ -288,7 +287,7 @@ detach_error:
static void codeAttach(
Parse *pParse, /* The parser context */
int type, /* Either SQLITE_ATTACH or SQLITE_DETACH */
FuncDef *pFunc, /* FuncDef wrapper for detachFunc() or attachFunc() */
FuncDef const *pFunc,/* FuncDef wrapper for detachFunc() or attachFunc() */
Expr *pAuthArg, /* Expression to pass to authorization callback */
Expr *pFilename, /* Name of database file */
Expr *pDbname, /* Name of the database to use internally */
@@ -358,7 +357,7 @@ attach_end:
** DETACH pDbname
*/
void sqlite3Detach(Parse *pParse, Expr *pDbname){
static FuncDef detach_func = {
static const FuncDef detach_func = {
1, /* nArg */
SQLITE_UTF8, /* iPrefEnc */
0, /* flags */
@@ -379,7 +378,7 @@ void sqlite3Detach(Parse *pParse, Expr *pDbname){
** ATTACH p AS pDbname KEY pKey
*/
void sqlite3Attach(Parse *pParse, Expr *p, Expr *pDbname, Expr *pKey){
static FuncDef attach_func = {
static const FuncDef attach_func = {
3, /* nArg */
SQLITE_UTF8, /* iPrefEnc */
0, /* flags */
+30 -15
View File
@@ -217,7 +217,7 @@ static int backupOnePage(sqlite3_backup *p, Pgno iSrcPg, const u8 *zSrcData){
/* Catch the case where the destination is an in-memory database and the
** page sizes of the source and destination differ.
*/
if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(sqlite3BtreePager(p->pDest)) ){
if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(pDestPager) ){
rc = SQLITE_READONLY;
}
@@ -287,6 +287,9 @@ static void attachBackupObject(sqlite3_backup *p){
*/
int sqlite3_backup_step(sqlite3_backup *p, int nPage){
int rc;
int destMode; /* Destination journal mode */
int pgszSrc = 0; /* Source page size */
int pgszDest = 0; /* Destination page size */
sqlite3_mutex_enter(p->pSrcDb->mutex);
sqlite3BtreeEnter(p->pSrc);
@@ -327,6 +330,15 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){
rc = sqlite3BtreeBeginTrans(p->pSrc, 0);
bCloseTrans = 1;
}
/* Do not allow backup if the destination database is in WAL mode
** and the page sizes are different between source and destination */
pgszSrc = sqlite3BtreeGetPageSize(p->pSrc);
pgszDest = sqlite3BtreeGetPageSize(p->pDest);
destMode = sqlite3PagerGetJournalMode(sqlite3BtreePager(p->pDest));
if( SQLITE_OK==rc && destMode==PAGER_JOURNALMODE_WAL && pgszSrc!=pgszDest ){
rc = SQLITE_READONLY;
}
/* Now that there is a read-lock on the source database, query the
** source pager for the number of pages in the database.
@@ -363,8 +375,6 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){
if( rc==SQLITE_DONE
&& (rc = sqlite3BtreeUpdateMeta(p->pDest,1,p->iDestSchema+1))==SQLITE_OK
){
const int nSrcPagesize = sqlite3BtreeGetPageSize(p->pSrc);
const int nDestPagesize = sqlite3BtreeGetPageSize(p->pDest);
int nDestTruncate;
if( p->pDestDb ){
@@ -383,18 +393,20 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){
** journalled by PagerCommitPhaseOne() before they are destroyed
** by the file truncation.
*/
if( nSrcPagesize<nDestPagesize ){
int ratio = nDestPagesize/nSrcPagesize;
assert( pgszSrc==sqlite3BtreeGetPageSize(p->pSrc) );
assert( pgszDest==sqlite3BtreeGetPageSize(p->pDest) );
if( pgszSrc<pgszDest ){
int ratio = pgszDest/pgszSrc;
nDestTruncate = (nSrcPage+ratio-1)/ratio;
if( nDestTruncate==(int)PENDING_BYTE_PAGE(p->pDest->pBt) ){
nDestTruncate--;
}
}else{
nDestTruncate = nSrcPage * (nSrcPagesize/nDestPagesize);
nDestTruncate = nSrcPage * (pgszSrc/pgszDest);
}
sqlite3PagerTruncateImage(pDestPager, nDestTruncate);
if( nSrcPagesize<nDestPagesize ){
if( pgszSrc<pgszDest ){
/* If the source page-size is smaller than the destination page-size,
** two extra things may need to happen:
**
@@ -404,31 +416,31 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){
** pending-byte page in the source database may need to be
** copied into the destination database.
*/
const i64 iSize = (i64)nSrcPagesize * (i64)nSrcPage;
const i64 iSize = (i64)pgszSrc * (i64)nSrcPage;
sqlite3_file * const pFile = sqlite3PagerFile(pDestPager);
assert( pFile );
assert( (i64)nDestTruncate*(i64)nDestPagesize >= iSize || (
assert( (i64)nDestTruncate*(i64)pgszDest >= iSize || (
nDestTruncate==(int)(PENDING_BYTE_PAGE(p->pDest->pBt)-1)
&& iSize>=PENDING_BYTE && iSize<=PENDING_BYTE+nDestPagesize
&& iSize>=PENDING_BYTE && iSize<=PENDING_BYTE+pgszDest
));
if( SQLITE_OK==(rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 1))
&& SQLITE_OK==(rc = backupTruncateFile(pFile, iSize))
&& SQLITE_OK==(rc = sqlite3PagerSync(pDestPager))
){
i64 iOff;
i64 iEnd = MIN(PENDING_BYTE + nDestPagesize, iSize);
i64 iEnd = MIN(PENDING_BYTE + pgszDest, iSize);
for(
iOff=PENDING_BYTE+nSrcPagesize;
iOff=PENDING_BYTE+pgszSrc;
rc==SQLITE_OK && iOff<iEnd;
iOff+=nSrcPagesize
iOff+=pgszSrc
){
PgHdr *pSrcPg = 0;
const Pgno iSrcPg = (Pgno)((iOff/nSrcPagesize)+1);
const Pgno iSrcPg = (Pgno)((iOff/pgszSrc)+1);
rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg);
if( rc==SQLITE_OK ){
u8 *zData = sqlite3PagerGetData(pSrcPg);
rc = sqlite3OsWrite(pFile, zData, nSrcPagesize, iOff);
rc = sqlite3OsWrite(pFile, zData, pgszSrc, iOff);
}
sqlite3PagerUnref(pSrcPg);
}
@@ -457,6 +469,9 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){
assert( rc2==SQLITE_OK );
}
if( rc==SQLITE_IOERR_NOMEM ){
rc = SQLITE_NOMEM;
}
p->rc = rc;
}
if( p->pDestDb ){
+16 -13
View File
@@ -1585,16 +1585,20 @@ static int getAndInitPage(
int rc;
assert( sqlite3_mutex_held(pBt->mutex) );
if( pgno<=0 || pgno>btreePagecount(pBt) ){
return SQLITE_CORRUPT_BKPT;
}
rc = btreeGetPage(pBt, pgno, ppPage, 0);
if( rc==SQLITE_OK ){
rc = btreeInitPage(*ppPage);
if( rc!=SQLITE_OK ){
releasePage(*ppPage);
if( pgno>btreePagecount(pBt) ){
rc = SQLITE_CORRUPT_BKPT;
}else{
rc = btreeGetPage(pBt, pgno, ppPage, 0);
if( rc==SQLITE_OK ){
rc = btreeInitPage(*ppPage);
if( rc!=SQLITE_OK ){
releasePage(*ppPage);
}
}
}
testcase( pgno==0 );
assert( pgno!=0 || rc==SQLITE_CORRUPT );
return rc;
}
@@ -2250,7 +2254,7 @@ static int lockBtree(BtShared *pBt){
if( (rc = sqlite3PagerPagecount(pBt->pPager, &nPageFile))!=SQLITE_OK ){;
goto page1_init_failed;
}
if( nPage==0 ){
if( nPage==0 || memcmp(24+(u8*)pPage1->aData, 92+(u8*)pPage1->aData,4)!=0 ){
nPage = nPageFile;
}
if( nPage>0 ){
@@ -2521,7 +2525,7 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag){
rc = querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK);
if( SQLITE_OK!=rc ) goto trans_begun;
pBt->initiallyEmpty = pBt->nPage==0;
pBt->initiallyEmpty = (u8)(pBt->nPage==0);
do {
/* Call lockBtree() until either pBt->pPage1 is populated or
** lockBtree() returns something other than SQLITE_OK. lockBtree()
@@ -2546,7 +2550,7 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag){
if( rc!=SQLITE_OK ){
unlockBtreeIfUnused(pBt);
}
}while( rc==SQLITE_BUSY && pBt->inTransaction==TRANS_NONE &&
}while( (rc&0xFF)==SQLITE_BUSY && pBt->inTransaction==TRANS_NONE &&
btreeInvokeBusyHandler(pBt) );
if( rc==SQLITE_OK ){
@@ -4244,7 +4248,6 @@ int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){
if( pCur->eState==CURSOR_INVALID ){
assert( pCur->apPage[pCur->iPage]->nCell==0 );
*pRes = 1;
rc = SQLITE_OK;
}else{
assert( pCur->apPage[pCur->iPage]->nCell>0 );
*pRes = 0;
@@ -8009,7 +8012,7 @@ int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){
/* If setting the version fields to 1, do not automatically open the
** WAL connection, even if the version fields are currently set to 2.
*/
pBt->doNotUseWAL = (iVersion==1);
pBt->doNotUseWAL = (u8)(iVersion==1);
rc = sqlite3BtreeBeginTrans(pBtree, 0);
if( rc==SQLITE_OK ){
+2 -2
View File
@@ -2614,6 +2614,7 @@ Index *sqlite3CreateIndex(
if( j>=pTab->nCol ){
sqlite3ErrorMsg(pParse, "table %s has no column named %s",
pTab->zName, zColName);
pParse->checkSchema = 1;
goto exit_create_index;
}
pIndex->aiColumn[i] = j;
@@ -3382,7 +3383,7 @@ void sqlite3Savepoint(Parse *pParse, int op, Token *pName){
if( zName ){
Vdbe *v = sqlite3GetVdbe(pParse);
#ifndef SQLITE_OMIT_AUTHORIZATION
static const char *az[] = { "BEGIN", "RELEASE", "ROLLBACK" };
static const char * const az[] = { "BEGIN", "RELEASE", "ROLLBACK" };
assert( !SAVEPOINT_BEGIN && SAVEPOINT_RELEASE==1 && SAVEPOINT_ROLLBACK==2 );
#endif
if( !v || sqlite3AuthCheck(pParse, SQLITE_SAVEPOINT, az[op], zName, 0) ){
@@ -3422,7 +3423,6 @@ int sqlite3OpenTempDatabase(Parse *pParse){
db->mallocFailed = 1;
return 1;
}
sqlite3PagerJournalMode(sqlite3BtreePager(pBt), db->dfltJournalMode);
}
return 0;
}
+8 -6
View File
@@ -195,9 +195,11 @@ static const char * const azCompileOpt[] = {
#ifdef SQLITE_OMIT_CHECK
"OMIT_CHECK",
#endif
#ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
"OMIT_COMPILEOPTION_DIAGS",
#endif
/* // redundant
** #ifdef SQLITE_OMIT_COMPILEOPTION_DIAGS
** "OMIT_COMPILEOPTION_DIAGS",
** #endif
*/
#ifdef SQLITE_OMIT_COMPLETE
"OMIT_COMPLETE",
#endif
@@ -231,9 +233,6 @@ static const char * const azCompileOpt[] = {
#ifdef SQLITE_OMIT_GET_TABLE
"OMIT_GET_TABLE",
#endif
#ifdef SQLITE_OMIT_GLOBALRECOVER
"OMIT_GLOBALRECOVER",
#endif
#ifdef SQLITE_OMIT_INCRBLOB
"OMIT_INCRBLOB",
#endif
@@ -312,6 +311,9 @@ static const char * const azCompileOpt[] = {
#ifdef SQLITE_OMIT_VIRTUALTABLE
"OMIT_VIRTUALTABLE",
#endif
#ifdef SQLITE_OMIT_WAL
"OMIT_WAL",
#endif
#ifdef SQLITE_OMIT_WSD
"OMIT_WSD",
#endif
+4 -13
View File
@@ -314,10 +314,8 @@ static int parseYyyyMmDd(const char *zDate, DateTime *p){
** Set the time to the current time reported by the VFS
*/
static void setDateTimeToCurrent(sqlite3_context *context, DateTime *p){
double r;
sqlite3 *db = sqlite3_context_db_handle(context);
sqlite3OsCurrentTime(db->pVfs, &r);
p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5);
sqlite3OsCurrentTimeInt64(db->pVfs, &p->iJD);
p->validJD = 1;
}
@@ -1038,22 +1036,15 @@ static void currentTimeFunc(
time_t t;
char *zFormat = (char *)sqlite3_user_data(context);
sqlite3 *db;
double rT;
sqlite3_int64 iT;
char zBuf[20];
UNUSED_PARAMETER(argc);
UNUSED_PARAMETER(argv);
db = sqlite3_context_db_handle(context);
sqlite3OsCurrentTime(db->pVfs, &rT);
#ifndef SQLITE_OMIT_FLOATING_POINT
t = 86400.0*(rT - 2440587.5) + 0.5;
#else
/* without floating point support, rT will have
** already lost fractional day precision.
*/
t = 86400 * (rT - 2440587) - 43200;
#endif
sqlite3OsCurrentTimeInt64(db->pVfs, &iT);
t = iT/1000 - 10000*(sqlite3_int64)21086676;
#ifdef HAVE_GMTIME_R
{
struct tm sNow;
+1 -3
View File
@@ -508,9 +508,7 @@ void sqlite3GenerateRowDelete(
sqlite3VdbeAddOp2(v, OP_Copy, iRowid, iOld);
for(iCol=0; iCol<pTab->nCol; iCol++){
if( mask==0xffffffff || mask&(1<<iCol) ){
int iTarget = iOld + iCol + 1;
sqlite3VdbeAddOp3(v, OP_Column, iCur, iCol, iTarget);
sqlite3ColumnDefault(v, pTab, iCol, iTarget);
sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, iCol, iOld+iCol+1);
}
}
+41 -29
View File
@@ -1635,7 +1635,7 @@ int sqlite3CodeSubselect(
keyInfo.aColl[0] = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft,
pEList->a[0].pExpr);
}
}else if( pExpr->x.pList!=0 ){
}else if( ALWAYS(pExpr->x.pList!=0) ){
/* Case 2: expr IN (exprlist)
**
** For each expression, build an index key from the evaluation and
@@ -1705,7 +1705,6 @@ int sqlite3CodeSubselect(
** an integer 0 (not exists) or 1 (exists) into a memory cell
** and record that memory cell in iColumn.
*/
static const Token one = { "1", 1 }; /* Token for literal value 1 */
Select *pSel; /* SELECT statement to encode */
SelectDest dest; /* How to deal with SELECt result */
@@ -1726,7 +1725,8 @@ int sqlite3CodeSubselect(
VdbeComment((v, "Init EXISTS result"));
}
sqlite3ExprDelete(pParse->db, pSel->pLimit);
pSel->pLimit = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &one);
pSel->pLimit = sqlite3PExpr(pParse, TK_INTEGER, 0, 0,
&sqlite3IntTokens[1]);
if( sqlite3Select(pParse, pSel, &dest) ){
return 0;
}
@@ -1794,8 +1794,20 @@ static void sqlite3ExprCodeIN(
sqlite3ExprCachePush(pParse);
r1 = sqlite3GetTempReg(pParse);
sqlite3ExprCode(pParse, pExpr->pLeft, r1);
sqlite3VdbeAddOp2(v, OP_IsNull, r1, destIfNull);
/* If the LHS is NULL, then the result is either false or NULL depending
** on whether the RHS is empty or not, respectively.
*/
if( destIfNull==destIfFalse ){
/* Shortcut for the common case where the false and NULL outcomes are
** the same. */
sqlite3VdbeAddOp2(v, OP_IsNull, r1, destIfNull);
}else{
int addr1 = sqlite3VdbeAddOp1(v, OP_NotNull, r1);
sqlite3VdbeAddOp2(v, OP_Rewind, pExpr->iTable, destIfFalse);
sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfNull);
sqlite3VdbeJumpHere(v, addr1);
}
if( eType==IN_INDEX_ROWID ){
/* In this case, the RHS is the ROWID of table b-tree
@@ -2082,6 +2094,27 @@ static void sqlite3ExprCachePinRegister(Parse *pParse, int iReg){
}
}
/*
** Generate code to extract the value of the iCol-th column of a table.
*/
void sqlite3ExprCodeGetColumnOfTable(
Vdbe *v, /* The VDBE under construction */
Table *pTab, /* The table containing the value */
int iTabCur, /* The cursor for this table */
int iCol, /* Index of the column to extract */
int regOut /* Extract the valud into this register */
){
if( iCol<0 || iCol==pTab->iPKey ){
sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut);
}else{
int op = IsVirtual(pTab) ? OP_VColumn : OP_Column;
sqlite3VdbeAddOp3(v, op, iTabCur, iCol, regOut);
}
if( iCol>=0 ){
sqlite3ColumnDefault(v, pTab, iCol, regOut);
}
}
/*
** Generate code that will extract the iColumn-th column from
** table pTab and store the column value in a register. An effort
@@ -2110,13 +2143,7 @@ int sqlite3ExprCodeGetColumn(
}
}
assert( v!=0 );
if( iColumn<0 ){
sqlite3VdbeAddOp2(v, OP_Rowid, iTable, iReg);
}else if( ALWAYS(pTab!=0) ){
int op = IsVirtual(pTab) ? OP_VColumn : OP_Column;
sqlite3VdbeAddOp3(v, op, iTable, iColumn, iReg);
sqlite3ColumnDefault(v, pTab, iColumn, iReg);
}
sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg);
sqlite3ExprCacheStore(pParse, iTable, iColumn, iReg);
return iReg;
}
@@ -2353,27 +2380,12 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
}
#endif
case TK_VARIABLE: {
VdbeOp *pOp;
assert( !ExprHasProperty(pExpr, EP_IntValue) );
assert( pExpr->u.zToken!=0 );
assert( pExpr->u.zToken[0]!=0 );
if( pExpr->u.zToken[1]==0
&& (pOp = sqlite3VdbeGetOp(v, -1))->opcode==OP_Variable
&& pOp->p1+pOp->p3==pExpr->iColumn
&& pOp->p2+pOp->p3==target
&& pOp->p4.z==0
){
/* If the previous instruction was a copy of the previous unnamed
** parameter into the previous register, then simply increment the
** repeat count on the prior instruction rather than making a new
** instruction.
*/
pOp->p3++;
}else{
sqlite3VdbeAddOp3(v, OP_Variable, pExpr->iColumn, target, 1);
if( pExpr->u.zToken[1]!=0 ){
sqlite3VdbeChangeP4(v, -1, pExpr->u.zToken, 0);
}
sqlite3VdbeAddOp2(v, OP_Variable, pExpr->iColumn, target);
if( pExpr->u.zToken[1]!=0 ){
sqlite3VdbeChangeP4(v, -1, pExpr->u.zToken, 0);
}
break;
}
+11
View File
@@ -176,6 +176,15 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = {
*/
SQLITE_WSD FuncDefHash sqlite3GlobalFunctions;
/*
** Constant tokens for values 0 and 1.
*/
const Token sqlite3IntTokens[] = {
{ "0", 1 },
{ "1", 1 }
};
/*
** The value of the "pending" byte must be 0x40000000 (1 byte past the
** 1-gibabyte boundary) in a compatible database. SQLite never uses
@@ -194,7 +203,9 @@ SQLITE_WSD FuncDefHash sqlite3GlobalFunctions;
** Changing the pending byte during operating results in undefined
** and dileterious behavior.
*/
#ifndef SQLITE_OMIT_WSD
int sqlite3PendingByte = 0x40000000;
#endif
#include "opcodes.h"
/*
+1 -1
View File
@@ -727,7 +727,7 @@ void sqlite3Insert(
}else{
sqlite3ErrorMsg(pParse, "table %S has no column named %s",
pTabList, 0, pColumn->a[i].zName);
pParse->nErr++;
pParse->checkSchema = 1;
goto insert_cleanup;
}
}
+5 -1
View File
@@ -182,7 +182,11 @@ static struct sqlite3_io_methods JournalFileMethods = {
0, /* xCheckReservedLock */
0, /* xFileControl */
0, /* xSectorSize */
0 /* xDeviceCharacteristics */
0, /* xDeviceCharacteristics */
0, /* xShmMap */
0, /* xShmLock */
0, /* xShmBarrier */
0 /* xShmUnmap */
};
/*
+39 -20
View File
@@ -776,7 +776,7 @@ const char *sqlite3ErrStr(int rc){
/* SQLITE_NOTFOUND */ 0,
/* SQLITE_FULL */ "database or disk is full",
/* SQLITE_CANTOPEN */ "unable to open database file",
/* SQLITE_PROTOCOL */ 0,
/* SQLITE_PROTOCOL */ "locking protocol",
/* SQLITE_EMPTY */ "table contains no data",
/* SQLITE_SCHEMA */ "database schema has changed",
/* SQLITE_TOOBIG */ "string or blob too big",
@@ -1189,19 +1189,22 @@ void *sqlite3_rollback_hook(
#ifndef SQLITE_OMIT_WAL
/*
** The sqlite3_wal_hook() callback registered by sqlite3_wal_autocheckpoint().
** Return non-zero, indicating to the caller that a checkpoint should be run,
** if the number of frames in the log file is greater than
** sqlite3.pWalArg cast to an integer (the value configured by
** Invoke sqlite3_wal_checkpoint if the number of frames in the log file
** is greater than sqlite3.pWalArg cast to an integer (the value configured by
** wal_autocheckpoint()).
*/
int sqlite3WalDefaultHook(
void *p, /* Argument */
void *pClientData, /* Argument */
sqlite3 *db, /* Connection */
const char *zNotUsed, /* Database */
const char *zDb, /* Database */
int nFrame /* Size of WAL */
){
UNUSED_PARAMETER(zNotUsed);
return ( nFrame>=SQLITE_PTR_TO_INT(p));
if( nFrame>=SQLITE_PTR_TO_INT(pClientData) ){
sqlite3BeginBenignMalloc();
sqlite3_wal_checkpoint(db, zDb);
sqlite3EndBenignMalloc();
}
return SQLITE_OK;
}
#endif /* SQLITE_OMIT_WAL */
@@ -1218,13 +1221,11 @@ int sqlite3WalDefaultHook(
*/
int sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){
#ifndef SQLITE_OMIT_WAL
sqlite3_mutex_enter(db->mutex);
if( nFrame>0 ){
sqlite3_wal_hook(db, sqlite3WalDefaultHook, SQLITE_INT_TO_PTR(nFrame));
}else{
sqlite3_wal_hook(db, 0, 0);
}
sqlite3_mutex_leave(db->mutex);
#endif
return SQLITE_OK;
}
@@ -1253,7 +1254,9 @@ void *sqlite3_wal_hook(
/*
** Checkpoint database zDb. If zDb is NULL, the main database is checkpointed.
** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points
** to contains a zero-length string, all attached databases are
** checkpointed.
*/
int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
#ifdef SQLITE_OMIT_WAL
@@ -1263,7 +1266,7 @@ int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
int iDb = SQLITE_MAX_ATTACHED; /* sqlite3.aDb[] index of db to checkpoint */
sqlite3_mutex_enter(db->mutex);
if( zDb ){
if( zDb && zDb[0] ){
iDb = sqlite3FindDbName(db, zDb);
}
if( iDb<0 ){
@@ -2058,7 +2061,6 @@ int sqlite3_collation_needed16(
}
#endif /* SQLITE_OMIT_UTF16 */
#ifndef SQLITE_OMIT_GLOBALRECOVER
#ifndef SQLITE_OMIT_DEPRECATED
/*
** This function is now an anachronism. It used to be used to recover from a
@@ -2068,7 +2070,6 @@ int sqlite3_global_recover(void){
return SQLITE_OK;
}
#endif
#endif
/*
** Test to see whether or not the database connection is in autocommit
@@ -2096,17 +2097,22 @@ int sqlite3_get_autocommit(sqlite3 *db){
int sqlite3CorruptError(int lineno){
testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(SQLITE_CORRUPT,
"database corruption found by source line %d", lineno);
"database corruption at line %d of [%.10s]",
lineno, 20+sqlite3_sourceid());
return SQLITE_CORRUPT;
}
int sqlite3MisuseError(int lineno){
testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(SQLITE_MISUSE, "misuse detected by source line %d", lineno);
sqlite3_log(SQLITE_MISUSE,
"misuse at line %d of [%.10s]",
lineno, 20+sqlite3_sourceid());
return SQLITE_MISUSE;
}
int sqlite3CantopenError(int lineno){
testcase( sqlite3GlobalConfig.xLog!=0 );
sqlite3_log(SQLITE_CANTOPEN, "cannot open file at source line %d", lineno);
sqlite3_log(SQLITE_CANTOPEN,
"cannot open file at line %d of [%.10s]",
lineno, 20+sqlite3_sourceid());
return SQLITE_CANTOPEN;
}
@@ -2378,9 +2384,13 @@ int sqlite3_test_control(int op, ...){
** dileterious behavior.
*/
case SQLITE_TESTCTRL_PENDING_BYTE: {
unsigned int newVal = va_arg(ap, unsigned int);
rc = sqlite3PendingByte;
if( newVal ) sqlite3PendingByte = newVal;
rc = PENDING_BYTE;
#ifndef SQLITE_OMIT_WSD
{
unsigned int newVal = va_arg(ap, unsigned int);
if( newVal ) sqlite3PendingByte = newVal;
}
#endif
break;
}
@@ -2484,6 +2494,15 @@ int sqlite3_test_control(int op, ...){
}
#endif
/* sqlite3_test_control(SQLITE_TESTCTRL_PGHDRSZ)
**
** Return the size of a pcache header in bytes.
*/
case SQLITE_TESTCTRL_PGHDRSZ: {
rc = sizeof(PgHdr);
break;
}
}
va_end(ap);
#endif /* SQLITE_OMIT_BUILTIN_TEST */
+12 -12
View File
@@ -315,11 +315,11 @@ void *sqlite3ScratchMalloc(int n){
assert( n>0 );
#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
/* Verify that no more than one scratch allocation per thread
/* Verify that no more than two scratch allocation per thread
** is outstanding at one time. (This is only checked in the
** single-threaded case since checking in the multi-threaded case
** would be much more complicated.) */
assert( scratchAllocOut==0 );
assert( scratchAllocOut<=1 );
#endif
if( sqlite3GlobalConfig.szScratch<n ){
@@ -364,16 +364,6 @@ scratch_overflow:
}
void sqlite3ScratchFree(void *p){
if( p ){
#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
/* Verify that no more than one scratch allocation per thread
** is outstanding at one time. (This is only checked in the
** single-threaded case since checking in the multi-threaded case
** would be much more complicated.) */
assert( scratchAllocOut==1 );
scratchAllocOut = 0;
#endif
if( sqlite3GlobalConfig.pScratch==0
|| p<sqlite3GlobalConfig.pScratch
|| p>=(void*)mem0.aScratchFree ){
@@ -399,6 +389,16 @@ void sqlite3ScratchFree(void *p){
mem0.aScratchFree[mem0.nScratchFree++] = i;
sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, -1);
sqlite3_mutex_leave(mem0.mutex);
#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
/* Verify that no more than two scratch allocation per thread
** is outstanding at one time. (This is only checked in the
** single-threaded case since checking in the multi-threaded case
** would be much more complicated.) */
assert( scratchAllocOut>=1 && scratchAllocOut<=2 );
scratchAllocOut = 0;
#endif
}
}
}
+7 -3
View File
@@ -213,7 +213,7 @@ static int memjrnlFileSize(sqlite3_file *pJfd, sqlite_int64 *pSize){
/*
** Table of methods for MemJournal sqlite3_file object.
*/
static struct sqlite3_io_methods MemJournalMethods = {
static const struct sqlite3_io_methods MemJournalMethods = {
1, /* iVersion */
memjrnlClose, /* xClose */
memjrnlRead, /* xRead */
@@ -226,7 +226,11 @@ static struct sqlite3_io_methods MemJournalMethods = {
0, /* xCheckReservedLock */
0, /* xFileControl */
0, /* xSectorSize */
0 /* xDeviceCharacteristics */
0, /* xDeviceCharacteristics */
0, /* xShmMap */
0, /* xShmLock */
0, /* xShmBarrier */
0 /* xShmUnlock */
};
/*
@@ -236,7 +240,7 @@ void sqlite3MemJournalOpen(sqlite3_file *pJfd){
MemJournal *p = (MemJournal *)pJfd;
assert( EIGHT_BYTE_ALIGNMENT(p) );
memset(p, 0, sqlite3MemJournalSize());
p->pMethod = &MemJournalMethods;
p->pMethod = (sqlite3_io_methods*)&MemJournalMethods;
}
/*
+17 -15
View File
@@ -31,23 +31,26 @@ static SQLITE_WSD int mutexIsInit = 0;
*/
int sqlite3MutexInit(void){
int rc = SQLITE_OK;
if( sqlite3GlobalConfig.bCoreMutex ){
if( !sqlite3GlobalConfig.mutex.xMutexAlloc ){
/* If the xMutexAlloc method has not been set, then the user did not
** install a mutex implementation via sqlite3_config() prior to
** sqlite3_initialize() being called. This block copies pointers to
** the default implementation into the sqlite3GlobalConfig structure.
*/
sqlite3_mutex_methods *pFrom = sqlite3DefaultMutex();
sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex;
if( !sqlite3GlobalConfig.mutex.xMutexAlloc ){
/* If the xMutexAlloc method has not been set, then the user did not
** install a mutex implementation via sqlite3_config() prior to
** sqlite3_initialize() being called. This block copies pointers to
** the default implementation into the sqlite3GlobalConfig structure.
*/
sqlite3_mutex_methods const *pFrom;
sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex;
memcpy(pTo, pFrom, offsetof(sqlite3_mutex_methods, xMutexAlloc));
memcpy(&pTo->xMutexFree, &pFrom->xMutexFree,
sizeof(*pTo) - offsetof(sqlite3_mutex_methods, xMutexFree));
pTo->xMutexAlloc = pFrom->xMutexAlloc;
if( sqlite3GlobalConfig.bCoreMutex ){
pFrom = sqlite3DefaultMutex();
}else{
pFrom = sqlite3NoopMutex();
}
rc = sqlite3GlobalConfig.mutex.xMutexInit();
memcpy(pTo, pFrom, offsetof(sqlite3_mutex_methods, xMutexAlloc));
memcpy(&pTo->xMutexFree, &pFrom->xMutexFree,
sizeof(*pTo) - offsetof(sqlite3_mutex_methods, xMutexFree));
pTo->xMutexAlloc = pFrom->xMutexAlloc;
}
rc = sqlite3GlobalConfig.mutex.xMutexInit();
#ifdef SQLITE_DEBUG
GLOBAL(int, mutexIsInit) = 1;
@@ -77,7 +80,6 @@ int sqlite3MutexEnd(void){
** Retrieve a pointer to a static mutex or allocate a new dynamic one.
*/
sqlite3_mutex *sqlite3_mutex_alloc(int id){
if( !sqlite3GlobalConfig.bCoreMutex ) return 0;
#ifndef SQLITE_OMIT_AUTOINIT
if( sqlite3_initialize() ) return 0;
#endif
+54 -32
View File
@@ -27,25 +27,30 @@
*/
#include "sqliteInt.h"
#ifndef SQLITE_MUTEX_OMIT
#if defined(SQLITE_MUTEX_NOOP) && !defined(SQLITE_DEBUG)
#ifndef SQLITE_DEBUG
/*
** Stub routines for all mutex methods.
**
** This routines provide no mutual exclusion or error checking.
*/
static int noopMutexHeld(sqlite3_mutex *p){ return 1; }
static int noopMutexNotheld(sqlite3_mutex *p){ return 1; }
static int noopMutexInit(void){ return SQLITE_OK; }
static int noopMutexEnd(void){ return SQLITE_OK; }
static sqlite3_mutex *noopMutexAlloc(int id){ return (sqlite3_mutex*)8; }
static void noopMutexFree(sqlite3_mutex *p){ return; }
static void noopMutexEnter(sqlite3_mutex *p){ return; }
static int noopMutexTry(sqlite3_mutex *p){ return SQLITE_OK; }
static void noopMutexLeave(sqlite3_mutex *p){ return; }
static sqlite3_mutex *noopMutexAlloc(int id){
UNUSED_PARAMETER(id);
return (sqlite3_mutex*)8;
}
static void noopMutexFree(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }
static void noopMutexEnter(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }
static int noopMutexTry(sqlite3_mutex *p){
UNUSED_PARAMETER(p);
return SQLITE_OK;
}
static void noopMutexLeave(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }
sqlite3_mutex_methods *sqlite3DefaultMutex(void){
static sqlite3_mutex_methods sMutex = {
sqlite3_mutex_methods const *sqlite3NoopMutex(void){
static const sqlite3_mutex_methods sMutex = {
noopMutexInit,
noopMutexEnd,
noopMutexAlloc,
@@ -54,15 +59,15 @@ sqlite3_mutex_methods *sqlite3DefaultMutex(void){
noopMutexTry,
noopMutexLeave,
noopMutexHeld,
noopMutexNotheld
0,
0,
};
return &sMutex;
}
#endif /* defined(SQLITE_MUTEX_NOOP) && !defined(SQLITE_DEBUG) */
#endif /* !SQLITE_DEBUG */
#if defined(SQLITE_MUTEX_NOOP) && defined(SQLITE_DEBUG)
#ifdef SQLITE_DEBUG
/*
** In this implementation, error checking is provided for testing
** and debugging purposes. The mutexes still do not provide any
@@ -72,19 +77,21 @@ sqlite3_mutex_methods *sqlite3DefaultMutex(void){
/*
** The mutex object
*/
struct sqlite3_mutex {
typedef struct sqlite3_debug_mutex {
int id; /* The mutex type */
int cnt; /* Number of entries without a matching leave */
};
} sqlite3_debug_mutex;
/*
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
** intended for use inside assert() statements.
*/
static int debugMutexHeld(sqlite3_mutex *p){
static int debugMutexHeld(sqlite3_mutex *pX){
sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;
return p==0 || p->cnt>0;
}
static int debugMutexNotheld(sqlite3_mutex *p){
static int debugMutexNotheld(sqlite3_mutex *pX){
sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;
return p==0 || p->cnt==0;
}
@@ -100,8 +107,8 @@ static int debugMutexEnd(void){ return SQLITE_OK; }
** that means that a mutex could not be allocated.
*/
static sqlite3_mutex *debugMutexAlloc(int id){
static sqlite3_mutex aStatic[6];
sqlite3_mutex *pNew = 0;
static sqlite3_debug_mutex aStatic[6];
sqlite3_debug_mutex *pNew = 0;
switch( id ){
case SQLITE_MUTEX_FAST:
case SQLITE_MUTEX_RECURSIVE: {
@@ -120,13 +127,14 @@ static sqlite3_mutex *debugMutexAlloc(int id){
break;
}
}
return pNew;
return (sqlite3_mutex*)pNew;
}
/*
** This routine deallocates a previously allocated mutex.
*/
static void debugMutexFree(sqlite3_mutex *p){
static void debugMutexFree(sqlite3_mutex *pX){
sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;
assert( p->cnt==0 );
assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );
sqlite3_free(p);
@@ -143,12 +151,14 @@ static void debugMutexFree(sqlite3_mutex *p){
** can enter. If the same thread tries to enter any other kind of mutex
** more than once, the behavior is undefined.
*/
static void debugMutexEnter(sqlite3_mutex *p){
assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(p) );
static void debugMutexEnter(sqlite3_mutex *pX){
sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;
assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) );
p->cnt++;
}
static int debugMutexTry(sqlite3_mutex *p){
assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(p) );
static int debugMutexTry(sqlite3_mutex *pX){
sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;
assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) );
p->cnt++;
return SQLITE_OK;
}
@@ -159,14 +169,15 @@ static int debugMutexTry(sqlite3_mutex *p){
** is undefined if the mutex is not currently entered or
** is not currently allocated. SQLite will never do either.
*/
static void debugMutexLeave(sqlite3_mutex *p){
assert( debugMutexHeld(p) );
static void debugMutexLeave(sqlite3_mutex *pX){
sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;
assert( debugMutexHeld(pX) );
p->cnt--;
assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(p) );
assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) );
}
sqlite3_mutex_methods *sqlite3DefaultMutex(void){
static sqlite3_mutex_methods sMutex = {
sqlite3_mutex_methods const *sqlite3NoopMutex(void){
static const sqlite3_mutex_methods sMutex = {
debugMutexInit,
debugMutexEnd,
debugMutexAlloc,
@@ -181,4 +192,15 @@ sqlite3_mutex_methods *sqlite3DefaultMutex(void){
return &sMutex;
}
#endif /* defined(SQLITE_MUTEX_NOOP) && defined(SQLITE_DEBUG) */
#endif /* SQLITE_DEBUG */
/*
** If compiled with SQLITE_MUTEX_NOOP, then the no-op mutex implementation
** is used regardless of the run-time threadsafety setting.
*/
#ifdef SQLITE_MUTEX_NOOP
sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
return sqlite3NoopMutex();
}
#endif /* SQLITE_MUTEX_NOOP */
#endif /* SQLITE_MUTEX_OMIT */
+2 -2
View File
@@ -251,8 +251,8 @@ static void os2MutexLeave(sqlite3_mutex *p){
DosReleaseMutexSem(p->mutex);
}
sqlite3_mutex_methods *sqlite3DefaultMutex(void){
static sqlite3_mutex_methods sMutex = {
sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
static const sqlite3_mutex_methods sMutex = {
os2MutexInit,
os2MutexEnd,
os2MutexAlloc,
+29 -7
View File
@@ -24,23 +24,33 @@
#include <pthread.h>
/*
** The sqlite3_mutex.id, sqlite3_mutex.nRef, and sqlite3_mutex.owner fields
** are necessary under two condidtions: (1) Debug builds and (2) using
** home-grown mutexes. Encapsulate these conditions into a single #define.
*/
#if defined(SQLITE_DEBUG) || defined(SQLITE_HOMEGROWN_RECURSIVE_MUTEX)
# define SQLITE_MUTEX_NREF 1
#else
# define SQLITE_MUTEX_NREF 0
#endif
/*
** Each recursive mutex is an instance of the following structure.
*/
struct sqlite3_mutex {
pthread_mutex_t mutex; /* Mutex controlling the lock */
#if SQLITE_MUTEX_NREF
int id; /* Mutex type */
int nRef; /* Number of entrances */
pthread_t owner; /* Thread that is within this mutex */
#ifdef SQLITE_DEBUG
volatile int nRef; /* Number of entrances */
volatile pthread_t owner; /* Thread that is within this mutex */
int trace; /* True to trace changes */
#endif
};
#ifdef SQLITE_DEBUG
#if SQLITE_MUTEX_NREF
#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0, 0, (pthread_t)0, 0 }
#else
#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0, 0, (pthread_t)0 }
#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }
#endif
/*
@@ -142,14 +152,18 @@ static sqlite3_mutex *pthreadMutexAlloc(int iType){
pthread_mutex_init(&p->mutex, &recursiveAttr);
pthread_mutexattr_destroy(&recursiveAttr);
#endif
#if SQLITE_MUTEX_NREF
p->id = iType;
#endif
}
break;
}
case SQLITE_MUTEX_FAST: {
p = sqlite3MallocZero( sizeof(*p) );
if( p ){
#if SQLITE_MUTEX_NREF
p->id = iType;
#endif
pthread_mutex_init(&p->mutex, 0);
}
break;
@@ -158,7 +172,9 @@ static sqlite3_mutex *pthreadMutexAlloc(int iType){
assert( iType-2 >= 0 );
assert( iType-2 < ArraySize(staticMutexes) );
p = &staticMutexes[iType-2];
#if SQLITE_MUTEX_NREF
p->id = iType;
#endif
break;
}
}
@@ -218,9 +234,11 @@ static void pthreadMutexEnter(sqlite3_mutex *p){
/* Use the built-in recursive mutexes if they are available.
*/
pthread_mutex_lock(&p->mutex);
#if SQLITE_MUTEX_NREF
p->owner = pthread_self();
p->nRef++;
#endif
#endif
#ifdef SQLITE_DEBUG
if( p->trace ){
@@ -261,8 +279,10 @@ static int pthreadMutexTry(sqlite3_mutex *p){
/* Use the built-in recursive mutexes if they are available.
*/
if( pthread_mutex_trylock(&p->mutex)==0 ){
#if SQLITE_MUTEX_NREF
p->owner = pthread_self();
p->nRef++;
#endif
rc = SQLITE_OK;
}else{
rc = SQLITE_BUSY;
@@ -285,7 +305,9 @@ static int pthreadMutexTry(sqlite3_mutex *p){
*/
static void pthreadMutexLeave(sqlite3_mutex *p){
assert( pthreadMutexHeld(p) );
#if SQLITE_MUTEX_NREF
p->nRef--;
#endif
assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
@@ -303,8 +325,8 @@ static void pthreadMutexLeave(sqlite3_mutex *p){
#endif
}
sqlite3_mutex_methods *sqlite3DefaultMutex(void){
static sqlite3_mutex_methods sMutex = {
sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
static const sqlite3_mutex_methods sMutex = {
pthreadMutexInit,
pthreadMutexEnd,
pthreadMutexAlloc,
+13 -7
View File
@@ -25,9 +25,9 @@
struct sqlite3_mutex {
CRITICAL_SECTION mutex; /* Mutex controlling the lock */
int id; /* Mutex type */
int nRef; /* Number of enterances */
DWORD owner; /* Thread holding this mutex */
#ifdef SQLITE_DEBUG
volatile int nRef; /* Number of enterances */
volatile DWORD owner; /* Thread holding this mutex */
int trace; /* True to trace changes */
#endif
};
@@ -35,7 +35,7 @@ struct sqlite3_mutex {
#ifdef SQLITE_DEBUG
#define SQLITE3_MUTEX_INITIALIZER { SQLITE_W32_MUTEX_INITIALIZER, 0, 0L, (DWORD)0, 0 }
#else
#define SQLITE3_MUTEX_INITIALIZER { SQLITE_W32_MUTEX_INITIALIZER, 0, 0L, (DWORD)0 }
#define SQLITE3_MUTEX_INITIALIZER { SQLITE_W32_MUTEX_INITIALIZER, 0 }
#endif
/*
@@ -191,7 +191,9 @@ static sqlite3_mutex *winMutexAlloc(int iType){
case SQLITE_MUTEX_RECURSIVE: {
p = sqlite3MallocZero( sizeof(*p) );
if( p ){
#ifdef SQLITE_DEBUG
p->id = iType;
#endif
InitializeCriticalSection(&p->mutex);
}
break;
@@ -201,7 +203,9 @@ static sqlite3_mutex *winMutexAlloc(int iType){
assert( iType-2 >= 0 );
assert( iType-2 < ArraySize(winMutex_staticMutexes) );
p = &winMutex_staticMutexes[iType-2];
#ifdef SQLITE_DEBUG
p->id = iType;
#endif
break;
}
}
@@ -234,12 +238,14 @@ static void winMutexFree(sqlite3_mutex *p){
** more than once, the behavior is undefined.
*/
static void winMutexEnter(sqlite3_mutex *p){
#ifdef SQLITE_DEBUG
DWORD tid = GetCurrentThreadId();
assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) );
#endif
EnterCriticalSection(&p->mutex);
#ifdef SQLITE_DEBUG
p->owner = tid;
p->nRef++;
#ifdef SQLITE_DEBUG
if( p->trace ){
printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
}
@@ -288,11 +294,11 @@ static int winMutexTry(sqlite3_mutex *p){
static void winMutexLeave(sqlite3_mutex *p){
#ifndef NDEBUG
DWORD tid = GetCurrentThreadId();
#endif
assert( p->nRef>0 );
assert( p->owner==tid );
p->nRef--;
assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
#endif
LeaveCriticalSection(&p->mutex);
#ifdef SQLITE_DEBUG
if( p->trace ){
@@ -301,8 +307,8 @@ static void winMutexLeave(sqlite3_mutex *p){
#endif
}
sqlite3_mutex_methods *sqlite3DefaultMutex(void){
static sqlite3_mutex_methods sMutex = {
sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
static const sqlite3_mutex_methods sMutex = {
winMutexInit,
winMutexEnd,
winMutexAlloc,
+34 -6
View File
@@ -34,8 +34,10 @@
** sqlite3OsLock()
**
*/
#if defined(SQLITE_TEST) && (SQLITE_OS_WIN==0)
#define DO_OS_MALLOC_TEST(x) if (!x || !sqlite3IsMemJournal(x)) { \
#if defined(SQLITE_TEST)
int sqlite3_memdebug_vfs_oom_test = 1;
#define DO_OS_MALLOC_TEST(x) \
if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3IsMemJournal(x))) { \
void *pTstAlloc = sqlite3Malloc(10); \
if (!pTstAlloc) return SQLITE_IOERR_NOMEM; \
sqlite3_free(pTstAlloc); \
@@ -98,6 +100,24 @@ int sqlite3OsSectorSize(sqlite3_file *id){
int sqlite3OsDeviceCharacteristics(sqlite3_file *id){
return id->pMethods->xDeviceCharacteristics(id);
}
int sqlite3OsShmLock(sqlite3_file *id, int offset, int n, int flags){
return id->pMethods->xShmLock(id, offset, n, flags);
}
void sqlite3OsShmBarrier(sqlite3_file *id){
id->pMethods->xShmBarrier(id);
}
int sqlite3OsShmUnmap(sqlite3_file *id, int deleteFlag){
return id->pMethods->xShmUnmap(id, deleteFlag);
}
int sqlite3OsShmMap(
sqlite3_file *id, /* Database file handle */
int iPage,
int pgsz,
int bExtend, /* True to extend file if necessary */
void volatile **pp /* OUT: Pointer to mapping */
){
return id->pMethods->xShmMap(id, iPage, pgsz, bExtend, pp);
}
/*
** The next group of routines are convenience wrappers around the
@@ -112,11 +132,11 @@ int sqlite3OsOpen(
){
int rc;
DO_OS_MALLOC_TEST(0);
/* 0x7f3f is a mask of SQLITE_OPEN_ flags that are valid to be passed
/* 0x87f3f is a mask of SQLITE_OPEN_ flags that are valid to be passed
** down into the VFS layer. Some SQLITE_OPEN_ flags (for example,
** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before
** reaching the VFS. */
rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x7f3f, pFlagsOut);
rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x87f3f, pFlagsOut);
assert( rc==SQLITE_OK || pFile->pMethods==0 );
return rc;
}
@@ -161,8 +181,16 @@ int sqlite3OsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
int sqlite3OsSleep(sqlite3_vfs *pVfs, int nMicro){
return pVfs->xSleep(pVfs, nMicro);
}
int sqlite3OsCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
return pVfs->xCurrentTime(pVfs, pTimeOut);
int sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){
int rc;
if( pVfs->iVersion>=2 && pVfs->xCurrentTimeInt64 ){
rc = pVfs->xCurrentTimeInt64(pVfs, pTimeOut);
}else{
double r;
rc = pVfs->xCurrentTime(pVfs, &r);
*pTimeOut = (sqlite3_int64)(r*86400000.0);
}
return rc;
}
int sqlite3OsOpenMalloc(
+10 -2
View File
@@ -217,7 +217,11 @@
** 1GB boundary.
**
*/
#define PENDING_BYTE sqlite3PendingByte
#ifdef SQLITE_OMIT_WSD
# define PENDING_BYTE (0x40000000)
#else
# define PENDING_BYTE sqlite3PendingByte
#endif
#define RESERVED_BYTE (PENDING_BYTE+1)
#define SHARED_FIRST (PENDING_BYTE+2)
#define SHARED_SIZE 510
@@ -243,6 +247,10 @@ int sqlite3OsFileControl(sqlite3_file*,int,void*);
#define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0
int sqlite3OsSectorSize(sqlite3_file *id);
int sqlite3OsDeviceCharacteristics(sqlite3_file *id);
int sqlite3OsShmMap(sqlite3_file *,int,int,int,void volatile **);
int sqlite3OsShmLock(sqlite3_file *id, int, int, int);
void sqlite3OsShmBarrier(sqlite3_file *id);
int sqlite3OsShmUnmap(sqlite3_file *id, int);
/*
** Functions for accessing sqlite3_vfs methods
@@ -259,7 +267,7 @@ void sqlite3OsDlClose(sqlite3_vfs *, void *);
#endif /* SQLITE_OMIT_LOAD_EXTENSION */
int sqlite3OsRandomness(sqlite3_vfs *, int, char *);
int sqlite3OsSleep(sqlite3_vfs *, int);
int sqlite3OsCurrentTime(sqlite3_vfs *, double*);
int sqlite3OsCurrentTimeInt64(sqlite3_vfs *, sqlite3_int64*);
/*
** Convenience functions for opening and closing files using
-16
View File
@@ -31,24 +31,8 @@
#ifdef SQLITE_DEBUG
int sqlite3OSTrace = 0;
#define OSTRACE1(X) if( sqlite3OSTrace ) sqlite3DebugPrintf(X)
#define OSTRACE2(X,Y) if( sqlite3OSTrace ) sqlite3DebugPrintf(X,Y)
#define OSTRACE3(X,Y,Z) if( sqlite3OSTrace ) sqlite3DebugPrintf(X,Y,Z)
#define OSTRACE4(X,Y,Z,A) if( sqlite3OSTrace ) sqlite3DebugPrintf(X,Y,Z,A)
#define OSTRACE5(X,Y,Z,A,B) if( sqlite3OSTrace ) sqlite3DebugPrintf(X,Y,Z,A,B)
#define OSTRACE6(X,Y,Z,A,B,C) \
if(sqlite3OSTrace) sqlite3DebugPrintf(X,Y,Z,A,B,C)
#define OSTRACE7(X,Y,Z,A,B,C,D) \
if(sqlite3OSTrace) sqlite3DebugPrintf(X,Y,Z,A,B,C,D)
#define OSTRACE(X) if( sqlite3OSTrace ) sqlite3DebugPrintf X
#else
#define OSTRACE1(X)
#define OSTRACE2(X,Y)
#define OSTRACE3(X,Y,Z)
#define OSTRACE4(X,Y,Z,A)
#define OSTRACE5(X,Y,Z,A,B)
#define OSTRACE6(X,Y,Z,A,B,C)
#define OSTRACE7(X,Y,Z,A,B,C,D)
#define OSTRACE(X)
#endif
+55 -51
View File
@@ -81,7 +81,7 @@ static int os2Close( sqlite3_file *id ){
APIRET rc = NO_ERROR;
os2File *pFile;
if( id && (pFile = (os2File*)id) != 0 ){
OSTRACE2( "CLOSE %d\n", pFile->h );
OSTRACE(( "CLOSE %d\n", pFile->h ));
rc = DosClose( pFile->h );
pFile->locktype = NO_LOCK;
if( pFile->pathToDel != NULL ){
@@ -112,7 +112,7 @@ static int os2Read(
os2File *pFile = (os2File*)id;
assert( id!=0 );
SimulateIOError( return SQLITE_IOERR_READ );
OSTRACE3( "READ %d lock=%d\n", pFile->h, pFile->locktype );
OSTRACE(( "READ %d lock=%d\n", pFile->h, pFile->locktype ));
if( DosSetFilePtr(pFile->h, offset, FILE_BEGIN, &fileLocation) != NO_ERROR ){
return SQLITE_IOERR;
}
@@ -145,7 +145,7 @@ static int os2Write(
assert( id!=0 );
SimulateIOError( return SQLITE_IOERR_WRITE );
SimulateDiskfullError( return SQLITE_FULL );
OSTRACE3( "WRITE %d lock=%d\n", pFile->h, pFile->locktype );
OSTRACE(( "WRITE %d lock=%d\n", pFile->h, pFile->locktype ));
if( DosSetFilePtr(pFile->h, offset, FILE_BEGIN, &fileLocation) != NO_ERROR ){
return SQLITE_IOERR;
}
@@ -167,7 +167,7 @@ static int os2Write(
static int os2Truncate( sqlite3_file *id, i64 nByte ){
APIRET rc = NO_ERROR;
os2File *pFile = (os2File*)id;
OSTRACE3( "TRUNCATE %d %lld\n", pFile->h, nByte );
OSTRACE(( "TRUNCATE %d %lld\n", pFile->h, nByte ));
SimulateIOError( return SQLITE_IOERR_TRUNCATE );
rc = DosSetFileSize( pFile->h, nByte );
return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR_TRUNCATE;
@@ -187,7 +187,7 @@ int sqlite3_fullsync_count = 0;
*/
static int os2Sync( sqlite3_file *id, int flags ){
os2File *pFile = (os2File*)id;
OSTRACE3( "SYNC %d lock=%d\n", pFile->h, pFile->locktype );
OSTRACE(( "SYNC %d lock=%d\n", pFile->h, pFile->locktype ));
#ifdef SQLITE_TEST
if( flags & SQLITE_SYNC_FULL){
sqlite3_fullsync_count++;
@@ -237,7 +237,7 @@ static int getReadLock( os2File *pFile ){
UnlockArea.lOffset = 0L;
UnlockArea.lRange = 0L;
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 1L );
OSTRACE3( "GETREADLOCK %d res=%d\n", pFile->h, res );
OSTRACE(( "GETREADLOCK %d res=%d\n", pFile->h, res ));
return res;
}
@@ -255,7 +255,7 @@ static int unlockReadLock( os2File *id ){
UnlockArea.lOffset = SHARED_FIRST;
UnlockArea.lRange = SHARED_SIZE;
res = DosSetFileLocks( id->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 1L );
OSTRACE3( "UNLOCK-READLOCK file handle=%d res=%d?\n", id->h, res );
OSTRACE(( "UNLOCK-READLOCK file handle=%d res=%d?\n", id->h, res ));
return res;
}
@@ -296,14 +296,14 @@ static int os2Lock( sqlite3_file *id, int locktype ){
memset(&LockArea, 0, sizeof(LockArea));
memset(&UnlockArea, 0, sizeof(UnlockArea));
assert( pFile!=0 );
OSTRACE4( "LOCK %d %d was %d\n", pFile->h, locktype, pFile->locktype );
OSTRACE(( "LOCK %d %d was %d\n", pFile->h, locktype, pFile->locktype ));
/* If there is already a lock of this type or more restrictive on the
** os2File, do nothing. Don't use the end_lock: exit path, as
** sqlite3_mutex_enter() hasn't been called yet.
*/
if( pFile->locktype>=locktype ){
OSTRACE3( "LOCK %d %d ok (already held)\n", pFile->h, locktype );
OSTRACE(( "LOCK %d %d ok (already held)\n", pFile->h, locktype ));
return SQLITE_OK;
}
@@ -330,7 +330,7 @@ static int os2Lock( sqlite3_file *id, int locktype ){
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 100L, 0L );
if( res == NO_ERROR ){
gotPendingLock = 1;
OSTRACE3( "LOCK %d pending lock boolean set. res=%d\n", pFile->h, res );
OSTRACE(( "LOCK %d pending lock boolean set. res=%d\n", pFile->h, res ));
}
}
@@ -342,7 +342,7 @@ static int os2Lock( sqlite3_file *id, int locktype ){
if( res == NO_ERROR ){
newLocktype = SHARED_LOCK;
}
OSTRACE3( "LOCK %d acquire shared lock. res=%d\n", pFile->h, res );
OSTRACE(( "LOCK %d acquire shared lock. res=%d\n", pFile->h, res ));
}
/* Acquire a RESERVED lock
@@ -357,7 +357,7 @@ static int os2Lock( sqlite3_file *id, int locktype ){
if( res == NO_ERROR ){
newLocktype = RESERVED_LOCK;
}
OSTRACE3( "LOCK %d acquire reserved lock. res=%d\n", pFile->h, res );
OSTRACE(( "LOCK %d acquire reserved lock. res=%d\n", pFile->h, res ));
}
/* Acquire a PENDING lock
@@ -365,7 +365,8 @@ static int os2Lock( sqlite3_file *id, int locktype ){
if( locktype==EXCLUSIVE_LOCK && res == NO_ERROR ){
newLocktype = PENDING_LOCK;
gotPendingLock = 0;
OSTRACE2( "LOCK %d acquire pending lock. pending lock boolean unset.\n", pFile->h );
OSTRACE(( "LOCK %d acquire pending lock. pending lock boolean unset.\n",
pFile->h ));
}
/* Acquire an EXCLUSIVE lock
@@ -373,7 +374,7 @@ static int os2Lock( sqlite3_file *id, int locktype ){
if( locktype==EXCLUSIVE_LOCK && res == NO_ERROR ){
assert( pFile->locktype>=SHARED_LOCK );
res = unlockReadLock(pFile);
OSTRACE2( "unreadlock = %d\n", res );
OSTRACE(( "unreadlock = %d\n", res ));
LockArea.lOffset = SHARED_FIRST;
LockArea.lRange = SHARED_SIZE;
UnlockArea.lOffset = 0L;
@@ -382,10 +383,10 @@ static int os2Lock( sqlite3_file *id, int locktype ){
if( res == NO_ERROR ){
newLocktype = EXCLUSIVE_LOCK;
}else{
OSTRACE2( "OS/2 error-code = %d\n", res );
OSTRACE(( "OS/2 error-code = %d\n", res ));
getReadLock(pFile);
}
OSTRACE3( "LOCK %d acquire exclusive lock. res=%d\n", pFile->h, res );
OSTRACE(( "LOCK %d acquire exclusive lock. res=%d\n", pFile->h, res ));
}
/* If we are holding a PENDING lock that ought to be released, then
@@ -398,7 +399,7 @@ static int os2Lock( sqlite3_file *id, int locktype ){
UnlockArea.lOffset = PENDING_BYTE;
UnlockArea.lRange = 1L;
r = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
OSTRACE3( "LOCK %d unlocking pending/is shared. r=%d\n", pFile->h, r );
OSTRACE(( "LOCK %d unlocking pending/is shared. r=%d\n", pFile->h, r ));
}
/* Update the state of the lock has held in the file descriptor then
@@ -407,12 +408,12 @@ static int os2Lock( sqlite3_file *id, int locktype ){
if( res == NO_ERROR ){
rc = SQLITE_OK;
}else{
OSTRACE4( "LOCK FAILED %d trying for %d but got %d\n", pFile->h,
locktype, newLocktype );
OSTRACE(( "LOCK FAILED %d trying for %d but got %d\n", pFile->h,
locktype, newLocktype ));
rc = SQLITE_BUSY;
}
pFile->locktype = newLocktype;
OSTRACE3( "LOCK %d now %d\n", pFile->h, pFile->locktype );
OSTRACE(( "LOCK %d now %d\n", pFile->h, pFile->locktype ));
return rc;
}
@@ -427,7 +428,7 @@ static int os2CheckReservedLock( sqlite3_file *id, int *pOut ){
assert( pFile!=0 );
if( pFile->locktype>=RESERVED_LOCK ){
r = 1;
OSTRACE3( "TEST WR-LOCK %d %d (local)\n", pFile->h, r );
OSTRACE(( "TEST WR-LOCK %d %d (local)\n", pFile->h, r ));
}else{
FILELOCK LockArea,
UnlockArea;
@@ -439,7 +440,7 @@ static int os2CheckReservedLock( sqlite3_file *id, int *pOut ){
UnlockArea.lOffset = 0L;
UnlockArea.lRange = 0L;
rc = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
OSTRACE3( "TEST WR-LOCK %d lock reserved byte rc=%d\n", pFile->h, rc );
OSTRACE(( "TEST WR-LOCK %d lock reserved byte rc=%d\n", pFile->h, rc ));
if( rc == NO_ERROR ){
APIRET rcu = NO_ERROR; /* return code for unlocking */
LockArea.lOffset = 0L;
@@ -447,10 +448,10 @@ static int os2CheckReservedLock( sqlite3_file *id, int *pOut ){
UnlockArea.lOffset = RESERVED_BYTE;
UnlockArea.lRange = 1L;
rcu = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
OSTRACE3( "TEST WR-LOCK %d unlock reserved byte r=%d\n", pFile->h, rcu );
OSTRACE(( "TEST WR-LOCK %d unlock reserved byte r=%d\n", pFile->h, rcu ));
}
r = !(rc == NO_ERROR);
OSTRACE3( "TEST WR-LOCK %d %d (remote)\n", pFile->h, r );
OSTRACE(( "TEST WR-LOCK %d %d (remote)\n", pFile->h, r ));
}
*pOut = r;
return SQLITE_OK;
@@ -478,7 +479,7 @@ static int os2Unlock( sqlite3_file *id, int locktype ){
memset(&UnlockArea, 0, sizeof(UnlockArea));
assert( pFile!=0 );
assert( locktype<=SHARED_LOCK );
OSTRACE4( "UNLOCK %d to %d was %d\n", pFile->h, locktype, pFile->locktype );
OSTRACE(( "UNLOCK %d to %d was %d\n", pFile->h, locktype, pFile->locktype ));
type = pFile->locktype;
if( type>=EXCLUSIVE_LOCK ){
LockArea.lOffset = 0L;
@@ -486,11 +487,11 @@ static int os2Unlock( sqlite3_file *id, int locktype ){
UnlockArea.lOffset = SHARED_FIRST;
UnlockArea.lRange = SHARED_SIZE;
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
OSTRACE3( "UNLOCK %d exclusive lock res=%d\n", pFile->h, res );
OSTRACE(( "UNLOCK %d exclusive lock res=%d\n", pFile->h, res ));
if( locktype==SHARED_LOCK && getReadLock(pFile) != NO_ERROR ){
/* This should never happen. We should always be able to
** reacquire the read lock */
OSTRACE3( "UNLOCK %d to %d getReadLock() failed\n", pFile->h, locktype );
OSTRACE(( "UNLOCK %d to %d getReadLock() failed\n", pFile->h, locktype ));
rc = SQLITE_IOERR_UNLOCK;
}
}
@@ -500,11 +501,12 @@ static int os2Unlock( sqlite3_file *id, int locktype ){
UnlockArea.lOffset = RESERVED_BYTE;
UnlockArea.lRange = 1L;
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
OSTRACE3( "UNLOCK %d reserved res=%d\n", pFile->h, res );
OSTRACE(( "UNLOCK %d reserved res=%d\n", pFile->h, res ));
}
if( locktype==NO_LOCK && type>=SHARED_LOCK ){
res = unlockReadLock(pFile);
OSTRACE5( "UNLOCK %d is %d want %d res=%d\n", pFile->h, type, locktype, res );
OSTRACE(( "UNLOCK %d is %d want %d res=%d\n",
pFile->h, type, locktype, res ));
}
if( type>=PENDING_LOCK ){
LockArea.lOffset = 0L;
@@ -512,10 +514,10 @@ static int os2Unlock( sqlite3_file *id, int locktype ){
UnlockArea.lOffset = PENDING_BYTE;
UnlockArea.lRange = 1L;
res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
OSTRACE3( "UNLOCK %d pending res=%d\n", pFile->h, res );
OSTRACE(( "UNLOCK %d pending res=%d\n", pFile->h, res ));
}
pFile->locktype = locktype;
OSTRACE3( "UNLOCK %d now %d\n", pFile->h, pFile->locktype );
OSTRACE(( "UNLOCK %d now %d\n", pFile->h, pFile->locktype ));
return rc;
}
@@ -526,7 +528,8 @@ static int os2FileControl(sqlite3_file *id, int op, void *pArg){
switch( op ){
case SQLITE_FCNTL_LOCKSTATE: {
*(int*)pArg = ((os2File*)id)->locktype;
OSTRACE3( "FCNTL_LOCKSTATE %d lock=%d\n", ((os2File*)id)->h, ((os2File*)id)->locktype );
OSTRACE(( "FCNTL_LOCKSTATE %d lock=%d\n",
((os2File*)id)->h, ((os2File*)id)->locktype ));
return SQLITE_OK;
}
}
@@ -713,7 +716,7 @@ static int getTempname(int nBuf, char *zBuf ){
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
}
zBuf[j] = 0;
OSTRACE2( "TEMP FILENAME: %s\n", zBuf );
OSTRACE(( "TEMP FILENAME: %s\n", zBuf ));
return SQLITE_OK;
}
@@ -776,30 +779,30 @@ static int os2Open(
memset( pFile, 0, sizeof(*pFile) );
OSTRACE2( "OPEN want %d\n", flags );
OSTRACE( "OPEN want %d\n", flags ));
if( flags & SQLITE_OPEN_READWRITE ){
ulOpenMode |= OPEN_ACCESS_READWRITE;
OSTRACE1( "OPEN read/write\n" );
OSTRACE(( "OPEN read/write\n" ));
}else{
ulOpenMode |= OPEN_ACCESS_READONLY;
OSTRACE1( "OPEN read only\n" );
OSTRACE(( "OPEN read only\n" ));
}
if( flags & SQLITE_OPEN_CREATE ){
ulOpenFlags |= OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
OSTRACE1( "OPEN open new/create\n" );
OSTRACE(( "OPEN open new/create\n" ));
}else{
ulOpenFlags |= OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
OSTRACE1( "OPEN open existing\n" );
OSTRACE(( "OPEN open existing\n" ));
}
if( flags & SQLITE_OPEN_MAIN_DB ){
ulOpenMode |= OPEN_SHARE_DENYNONE;
OSTRACE1( "OPEN share read/write\n" );
OSTRACE(( "OPEN share read/write\n" ));
}else{
ulOpenMode |= OPEN_SHARE_DENYWRITE;
OSTRACE1( "OPEN share read only\n" );
OSTRACE(( "OPEN share read only\n" ));
}
if( flags & SQLITE_OPEN_DELETEONCLOSE ){
@@ -809,10 +812,10 @@ static int os2Open(
#endif
os2FullPathname( pVfs, zName, CCHMAXPATH, pathUtf8 );
pFile->pathToDel = convertUtf8PathToCp( pathUtf8 );
OSTRACE1( "OPEN hidden/delete on close file attributes\n" );
OSTRACE(( "OPEN hidden/delete on close file attributes\n" ));
}else{
pFile->pathToDel = NULL;
OSTRACE1( "OPEN normal file attribute\n" );
OSTRACE(( "OPEN normal file attribute\n" ));
}
/* always open in random access mode for possibly better speed */
@@ -831,13 +834,14 @@ static int os2Open(
(PEAOP2)NULL );
free( zNameCp );
if( rc != NO_ERROR ){
OSTRACE7( "OPEN Invalid handle rc=%d: zName=%s, ulAction=%#lx, ulAttr=%#lx, ulFlags=%#lx, ulMode=%#lx\n",
rc, zName, ulAction, ulFileAttribute, ulOpenFlags, ulOpenMode );
OSTRACE(( "OPEN Invalid handle rc=%d: zName=%s, ulAction=%#lx, ulAttr=%#lx, ulFlags=%#lx, ulMode=%#lx\n",
rc, zName, ulAction, ulFileAttribute, ulOpenFlags, ulOpenMode ));
if( pFile->pathToDel )
free( pFile->pathToDel );
pFile->pathToDel = NULL;
if( flags & SQLITE_OPEN_READWRITE ){
OSTRACE2( "OPEN %d Invalid handle\n", ((flags | SQLITE_OPEN_READONLY) & ~SQLITE_OPEN_READWRITE) );
OSTRACE(( "OPEN %d Invalid handle\n",
((flags | SQLITE_OPEN_READONLY) & ~SQLITE_OPEN_READWRITE) ));
return os2Open( pVfs, zName, id,
((flags | SQLITE_OPEN_READONLY) & ~SQLITE_OPEN_READWRITE),
pOutFlags );
@@ -853,7 +857,7 @@ static int os2Open(
pFile->pMethod = &os2IoMethod;
pFile->h = h;
OpenCounter(+1);
OSTRACE3( "OPEN %d pOutFlags=%d\n", pFile->h, pOutFlags );
OSTRACE(( "OPEN %d pOutFlags=%d\n", pFile->h, pOutFlags ));
return SQLITE_OK;
}
@@ -870,7 +874,7 @@ static int os2Delete(
SimulateIOError( return SQLITE_IOERR_DELETE );
rc = DosDelete( (PSZ)zFilenameCp );
free( zFilenameCp );
OSTRACE2( "DELETE \"%s\"\n", zFilename );
OSTRACE(( "DELETE \"%s\"\n", zFilename ));
return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR_DELETE;
}
@@ -891,17 +895,17 @@ static int os2Access(
rc = DosQueryPathInfo( (PSZ)zFilenameCp, FIL_STANDARD,
&fsts3ConfigInfo, sizeof(FILESTATUS3) );
free( zFilenameCp );
OSTRACE4( "ACCESS fsts3ConfigInfo.attrFile=%d flags=%d rc=%d\n",
fsts3ConfigInfo.attrFile, flags, rc );
OSTRACE(( "ACCESS fsts3ConfigInfo.attrFile=%d flags=%d rc=%d\n",
fsts3ConfigInfo.attrFile, flags, rc ));
switch( flags ){
case SQLITE_ACCESS_READ:
case SQLITE_ACCESS_EXISTS:
rc = (rc == NO_ERROR);
OSTRACE3( "ACCESS %s access of read and exists rc=%d\n", zFilename, rc );
OSTRACE(( "ACCESS %s access of read and exists rc=%d\n", zFilename, rc));
break;
case SQLITE_ACCESS_READWRITE:
rc = (rc == NO_ERROR) && ( (fsts3ConfigInfo.attrFile & FILE_READONLY) == 0 );
OSTRACE3( "ACCESS %s access of read/write rc=%d\n", zFilename, rc );
OSTRACE(( "ACCESS %s access of read/write rc=%d\n", zFilename, rc ));
break;
default:
assert( !"Invalid flags argument" );
+1178 -1593
View File
File diff suppressed because it is too large Load Diff
+839 -106
View File
File diff suppressed because it is too large Load Diff
+527 -307
View File
File diff suppressed because it is too large Load Diff
+10 -3
View File
@@ -68,9 +68,9 @@ typedef struct PgHdr DbPage;
#define PAGER_LOCKINGMODE_EXCLUSIVE 1
/*
** Valid values for the second argument to sqlite3PagerJournalMode().
** Numeric constants that encode the journalmode.
*/
#define PAGER_JOURNALMODE_QUERY -1
#define PAGER_JOURNALMODE_QUERY (-1) /* Query the value of journalmode */
#define PAGER_JOURNALMODE_DELETE 0 /* Commit by deleting journal file */
#define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */
#define PAGER_JOURNALMODE_OFF 2 /* Journal omitted. */
@@ -104,7 +104,9 @@ int sqlite3PagerMaxPageCount(Pager*, int);
void sqlite3PagerSetCachesize(Pager*, int);
void sqlite3PagerSetSafetyLevel(Pager*,int,int);
int sqlite3PagerLockingMode(Pager *, int);
int sqlite3PagerJournalMode(Pager *, int);
int sqlite3PagerSetJournalMode(Pager *, int);
int sqlite3PagerGetJournalMode(Pager*);
int sqlite3PagerOkToChangeJournalMode(Pager*);
i64 sqlite3PagerJournalSizeLimit(Pager *, i64);
sqlite3_backup **sqlite3PagerBackupPtr(Pager*);
@@ -135,6 +137,7 @@ int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint);
int sqlite3PagerSharedLock(Pager *pPager);
int sqlite3PagerCheckpoint(Pager *pPager);
int sqlite3PagerWalSupported(Pager *pPager);
int sqlite3PagerWalCallback(Pager *pPager);
int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);
int sqlite3PagerCloseWal(Pager *pPager);
@@ -154,6 +157,10 @@ int sqlite3PagerIsMemdb(Pager*);
/* Functions used to truncate the database file. */
void sqlite3PagerTruncateImage(Pager*,Pgno);
#if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL)
void *sqlite3PagerCodec(DbPage *);
#endif
/* Functions to support testing and debugging. */
#if !defined(NDEBUG) || defined(SQLITE_TEST)
Pgno sqlite3PagerPagenumber(DbPage*);
+31 -14
View File
@@ -848,23 +848,27 @@ likeop(A) ::= LIKE_KW(X). {A.eOperator = X; A.not = 0;}
likeop(A) ::= NOT LIKE_KW(X). {A.eOperator = X; A.not = 1;}
likeop(A) ::= MATCH(X). {A.eOperator = X; A.not = 0;}
likeop(A) ::= NOT MATCH(X). {A.eOperator = X; A.not = 1;}
%type escape {ExprSpan}
%destructor escape {sqlite3ExprDelete(pParse->db, $$.pExpr);}
escape(X) ::= ESCAPE expr(A). [ESCAPE] {X = A;}
escape(X) ::= . [ESCAPE] {memset(&X,0,sizeof(X));}
expr(A) ::= expr(X) likeop(OP) expr(Y) escape(E). [LIKE_KW] {
expr(A) ::= expr(X) likeop(OP) expr(Y). [LIKE_KW] {
ExprList *pList;
pList = sqlite3ExprListAppend(pParse,0, Y.pExpr);
pList = sqlite3ExprListAppend(pParse,pList, X.pExpr);
if( E.pExpr ){
pList = sqlite3ExprListAppend(pParse,pList, E.pExpr);
}
A.pExpr = sqlite3ExprFunction(pParse, pList, &OP.eOperator);
if( OP.not ) A.pExpr = sqlite3PExpr(pParse, TK_NOT, A.pExpr, 0, 0);
A.zStart = X.zStart;
A.zEnd = Y.zEnd;
if( A.pExpr ) A.pExpr->flags |= EP_InfixFunc;
}
expr(A) ::= expr(X) likeop(OP) expr(Y) ESCAPE expr(E). [LIKE_KW] {
ExprList *pList;
pList = sqlite3ExprListAppend(pParse,0, Y.pExpr);
pList = sqlite3ExprListAppend(pParse,pList, X.pExpr);
pList = sqlite3ExprListAppend(pParse,pList, E.pExpr);
A.pExpr = sqlite3ExprFunction(pParse, pList, &OP.eOperator);
if( OP.not ) A.pExpr = sqlite3PExpr(pParse, TK_NOT, A.pExpr, 0, 0);
A.zStart = X.zStart;
A.zEnd = E.zEnd;
if( A.pExpr ) A.pExpr->flags |= EP_InfixFunc;
}
%include {
/* Construct an expression node for a unary postfix operator
@@ -959,14 +963,27 @@ expr(A) ::= expr(W) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
in_op(A) ::= IN. {A = 0;}
in_op(A) ::= NOT IN. {A = 1;}
expr(A) ::= expr(X) in_op(N) LP exprlist(Y) RP(E). [IN] {
A.pExpr = sqlite3PExpr(pParse, TK_IN, X.pExpr, 0, 0);
if( A.pExpr ){
A.pExpr->x.pList = Y;
sqlite3ExprSetHeight(pParse, A.pExpr);
if( Y==0 ){
/* Expressions of the form
**
** expr1 IN ()
** expr1 NOT IN ()
**
** simplify to constants 0 (false) and 1 (true), respectively,
** regardless of the value of expr1.
*/
A.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[N]);
sqlite3ExprDelete(pParse->db, X.pExpr);
}else{
sqlite3ExprListDelete(pParse->db, Y);
A.pExpr = sqlite3PExpr(pParse, TK_IN, X.pExpr, 0, 0);
if( A.pExpr ){
A.pExpr->x.pList = Y;
sqlite3ExprSetHeight(pParse, A.pExpr);
}else{
sqlite3ExprListDelete(pParse->db, Y);
}
if( N ) A.pExpr = sqlite3PExpr(pParse, TK_NOT, A.pExpr, 0, 0);
}
if( N ) A.pExpr = sqlite3PExpr(pParse, TK_NOT, A.pExpr, 0, 0);
A.zStart = X.zStart;
A.zEnd = &E.z[E.n];
}
+6 -4
View File
@@ -260,15 +260,17 @@ int sqlite3PcacheFetch(
if( pPage ){
if( !pPage->pData ){
memset(pPage, 0, sizeof(PgHdr) + pCache->szExtra);
pPage->pExtra = (void*)&pPage[1];
pPage->pData = (void *)&((char *)pPage)[sizeof(PgHdr) + pCache->szExtra];
memset(pPage, 0, sizeof(PgHdr));
pPage->pData = (void *)&pPage[1];
pPage->pExtra = (void*)&((char *)pPage->pData)[pCache->szPage];
memset(pPage->pExtra, 0, pCache->szExtra);
pPage->pCache = pCache;
pPage->pgno = pgno;
}
assert( pPage->pCache==pCache );
assert( pPage->pgno==pgno );
assert( pPage->pExtra==(void *)&pPage[1] );
assert( pPage->pData==(void *)&pPage[1] );
assert( pPage->pExtra==(void *)&((char *)&pPage[1])[pCache->szPage] );
if( 0==pPage->nRef ){
pCache->nRef++;
+1 -1
View File
@@ -716,7 +716,7 @@ static void pcache1Destroy(sqlite3_pcache *p){
** already provided an alternative.
*/
void sqlite3PCacheSetDefault(void){
static sqlite3_pcache_methods defaultMethods = {
static const sqlite3_pcache_methods defaultMethods = {
0, /* pArg */
pcache1Init, /* xInit */
pcache1Shutdown, /* xShutdown */
+25 -34
View File
@@ -531,58 +531,49 @@ void sqlite3Pragma(
/*
** PRAGMA [database.]journal_mode
** PRAGMA [database.]journal_mode = (delete|persist|off|truncate|memory)
** PRAGMA [database.]journal_mode =
** (delete|persist|off|truncate|memory|wal|off)
*/
if( sqlite3StrICmp(zLeft,"journal_mode")==0 ){
int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */
int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */
int ii; /* Loop counter */
/* Force the schema to be loaded on all databases. This cases all
** database files to be opened and the journal_modes set. */
if( sqlite3ReadSchema(pParse) ){
goto pragma_out;
}
sqlite3VdbeSetNumCols(v, 1);
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "journal_mode", SQLITE_STATIC);
if( zRight==0 ){
/* If there is no "=MODE" part of the pragma, do a query for the
** current mode */
eMode = PAGER_JOURNALMODE_QUERY;
}else{
const char *zMode;
int n = sqlite3Strlen30(zRight);
for(eMode=0; (zMode = sqlite3JournalModename(eMode)); eMode++){
for(eMode=0; (zMode = sqlite3JournalModename(eMode))!=0; eMode++){
if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break;
}
if( !zMode ){
/* If the "=MODE" part does not match any known journal mode,
** then do a query */
eMode = PAGER_JOURNALMODE_QUERY;
}
}
if( pId2->n==0 && eMode==PAGER_JOURNALMODE_QUERY ){
/* Simple "PRAGMA journal_mode;" statement. This is a query for
** the current default journal mode (which may be different to
** the journal-mode of the main database).
*/
eMode = db->dfltJournalMode;
sqlite3VdbeAddOp2(v, OP_String8, 0, 1);
sqlite3VdbeChangeP4(v, -1, sqlite3JournalModename(eMode), P4_STATIC);
}else{
int ii;
if( pId2->n==0 && eMode!=PAGER_JOURNALMODE_WAL ){
/* This indicates that no database name was specified as part
** of the PRAGMA command. In this case the journal-mode must be
** set on all attached databases, as well as the main db file.
**
** Also, the sqlite3.dfltJournalMode variable is set so that
** any subsequently attached databases also use the specified
** journal mode. Except, the default journal mode is never set
** to WAL.
*/
db->dfltJournalMode = (u8)eMode;
}
for(ii=db->nDb-1; ii>=0; ii--){
if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
sqlite3VdbeUsesBtree(v, ii);
sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode);
}
if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){
/* Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" */
iDb = 0;
pId2->n = 1;
}
for(ii=db->nDb-1; ii>=0; ii--){
if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
sqlite3VdbeUsesBtree(v, ii);
sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode);
}
}
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
}else
@@ -1408,7 +1399,7 @@ void sqlite3Pragma(
*/
if( sqlite3StrICmp(zLeft, "wal_checkpoint")==0 ){
if( sqlite3ReadSchema(pParse) ) goto pragma_out;
sqlite3VdbeAddOp3(v, OP_Checkpoint, iDb, 0, 0);
sqlite3VdbeAddOp3(v, OP_Checkpoint, pId2->z?iDb:SQLITE_MAX_ATTACHED, 0, 0);
}else
/*
+5 -2
View File
@@ -75,12 +75,15 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
*/
int rc;
sqlite3_stmt *pStmt;
TESTONLY(int rcp); /* Return code from sqlite3_prepare() */
assert( db->init.busy );
db->init.iDb = iDb;
db->init.newTnum = atoi(argv[1]);
db->init.orphanTrigger = 0;
rc = sqlite3_prepare(db, argv[2], -1, &pStmt, 0);
TESTONLY(rcp = ) sqlite3_prepare(db, argv[2], -1, &pStmt, 0);
rc = db->errCode;
assert( (rc&0xFF)==(rcp&0xFF) );
db->init.iDb = 0;
if( SQLITE_OK!=rc ){
if( db->init.orphanTrigger ){
@@ -89,7 +92,7 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
pData->rc = rc;
if( rc==SQLITE_NOMEM ){
db->mallocFailed = 1;
}else if( rc!=SQLITE_INTERRUPT && rc!=SQLITE_LOCKED ){
}else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){
corruptSchema(pData, argv[0], sqlite3_errmsg(db));
}
}
+1
View File
@@ -357,6 +357,7 @@ static int lookupName(
}else{
sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol);
}
pParse->checkSchema = 1;
pTopNC->nErr++;
}
+1
View File
@@ -3020,6 +3020,7 @@ int sqlite3IndexedByLookup(Parse *pParse, struct SrcList_item *pFrom){
);
if( !pIdx ){
sqlite3ErrorMsg(pParse, "no such index: %s", zIndex, 0);
pParse->checkSchema = 1;
return SQLITE_ERROR;
}
pFrom->pIndex = pIdx;
+4 -4
View File
@@ -2578,7 +2578,6 @@ int main(int argc, char **argv){
*/
if( zFirstCmd[0]=='.' ){
rc = do_meta_command(zFirstCmd, &data);
return rc;
}else{
open_db(&data);
rc = shell_exec(data.db, zFirstCmd, shell_callback, &data, &zErrMsg);
@@ -2625,9 +2624,10 @@ int main(int argc, char **argv){
}
}
set_table_name(&data, 0);
if( db ){
if( sqlite3_close(db)!=SQLITE_OK ){
fprintf(stderr,"Error: cannot close database \"%s\"\n", sqlite3_errmsg(db));
if( data.db ){
if( sqlite3_close(data.db)!=SQLITE_OK ){
fprintf(stderr,"Error: cannot close database \"%s\"\n",
sqlite3_errmsg(db));
rc++;
}
}
+157 -66
View File
@@ -388,7 +388,7 @@ int sqlite3_exec(
#define SQLITE_NOTFOUND 12 /* NOT USED. Table or record not found */
#define SQLITE_FULL 13 /* Insertion failed because database is full */
#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
#define SQLITE_PROTOCOL 15 /* NOT USED. Database lock protocol error */
#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
#define SQLITE_EMPTY 16 /* Database is empty */
#define SQLITE_SCHEMA 17 /* The database schema changed */
#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
@@ -444,7 +444,12 @@ int sqlite3_exec(
#define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8))
#define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8))
#define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8))
#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8) )
#define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8))
#define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8))
#define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8))
#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
#define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8))
/*
** CAPI3REF: Flags For File Open Operations
@@ -471,11 +476,12 @@ int sqlite3_exec(
#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */
/*
** CAPI3REF: Device Characteristics
**
** The xDeviceCapabilities method of the [sqlite3_io_methods]
** The xDeviceCharacteristics method of the [sqlite3_io_methods]
** object returns an integer which is a vector of the these
** bit values expressing I/O characteristics of the mass storage
** device that holds the file that the [sqlite3_io_methods]
@@ -492,17 +498,18 @@ int sqlite3_exec(
** information is written to disk in the same order as calls
** to xWrite().
*/
#define SQLITE_IOCAP_ATOMIC 0x00000001
#define SQLITE_IOCAP_ATOMIC512 0x00000002
#define SQLITE_IOCAP_ATOMIC1K 0x00000004
#define SQLITE_IOCAP_ATOMIC2K 0x00000008
#define SQLITE_IOCAP_ATOMIC4K 0x00000010
#define SQLITE_IOCAP_ATOMIC8K 0x00000020
#define SQLITE_IOCAP_ATOMIC16K 0x00000040
#define SQLITE_IOCAP_ATOMIC32K 0x00000080
#define SQLITE_IOCAP_ATOMIC64K 0x00000100
#define SQLITE_IOCAP_SAFE_APPEND 0x00000200
#define SQLITE_IOCAP_SEQUENTIAL 0x00000400
#define SQLITE_IOCAP_ATOMIC 0x00000001
#define SQLITE_IOCAP_ATOMIC512 0x00000002
#define SQLITE_IOCAP_ATOMIC1K 0x00000004
#define SQLITE_IOCAP_ATOMIC2K 0x00000008
#define SQLITE_IOCAP_ATOMIC4K 0x00000010
#define SQLITE_IOCAP_ATOMIC8K 0x00000020
#define SQLITE_IOCAP_ATOMIC16K 0x00000040
#define SQLITE_IOCAP_ATOMIC32K 0x00000080
#define SQLITE_IOCAP_ATOMIC64K 0x00000100
#define SQLITE_IOCAP_SAFE_APPEND 0x00000200
#define SQLITE_IOCAP_SEQUENTIAL 0x00000400
#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
/*
** CAPI3REF: File Locking Levels
@@ -653,6 +660,12 @@ struct sqlite3_io_methods {
int (*xFileControl)(sqlite3_file*, int op, void *pArg);
int (*xSectorSize)(sqlite3_file*);
int (*xDeviceCharacteristics)(sqlite3_file*);
/* Methods above are valid for version 1 */
int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);
int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);
void (*xShmBarrier)(sqlite3_file*);
int (*xShmUnmap)(sqlite3_file*, int deleteFlag);
/* Methods above are valid for version 2 */
/* Additional methods may be added in future releases */
};
@@ -670,11 +683,19 @@ struct sqlite3_io_methods {
** into an integer that the pArg argument points to. This capability
** is used during testing and only needs to be supported when SQLITE_TEST
** is defined.
**
** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
** layer a hint of how large the database file will grow to be during the
** current transaction. This hint is not guaranteed to be accurate but it
** is often close. The underlying VFS might choose to preallocate database
** file space based on this hint in order to help writes to the database
** file run faster.
*/
#define SQLITE_FCNTL_LOCKSTATE 1
#define SQLITE_GET_LOCKPROXYFILE 2
#define SQLITE_SET_LOCKPROXYFILE 3
#define SQLITE_LAST_ERRNO 4
#define SQLITE_FCNTL_SIZE_HINT 5
/*
** CAPI3REF: Mutex Handle
@@ -806,19 +827,25 @@ typedef struct sqlite3_mutex sqlite3_mutex;
** handled as a fatal error by SQLite, vfs implementations should endeavor
** to prevent this by setting mxPathname to a sufficiently large value.
**
** The xRandomness(), xSleep(), and xCurrentTime() interfaces
** are not strictly a part of the filesystem, but they are
** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
** interfaces are not strictly a part of the filesystem, but they are
** included in the VFS structure for completeness.
** The xRandomness() function attempts to return nBytes bytes
** of good-quality randomness into zOut. The return value is
** the actual number of bytes of randomness obtained.
** The xSleep() method causes the calling thread to sleep for at
** least the number of microseconds given. The xCurrentTime()
** method returns a Julian Day Number for the current date and time.
**
** method returns a Julian Day Number for the current date and time as
** a floating point value.
** The xCurrentTimeInt64() method returns, as an integer, the Julian
** Day Number multipled by 86400000 (the number of milliseconds in
** a 24-hour day).
** ^SQLite will use the xCurrentTimeInt64() method to get the current
** date and time if that method is available (if iVersion is 2 or
** greater and the function pointer is not NULL) and will fall back
** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
*/
typedef struct sqlite3_vfs sqlite3_vfs;
typedef struct sqlite3_shm sqlite3_shm;
struct sqlite3_vfs {
int iVersion; /* Structure version number (currently 2) */
int szOsFile; /* Size of subclassed sqlite3_file */
@@ -843,13 +870,6 @@ struct sqlite3_vfs {
** The methods above are in version 1 of the sqlite_vfs object
** definition. Those that follow are added in version 2 or later
*/
int (*xShmOpen)(sqlite3_vfs*, const char *zName, sqlite3_shm**);
int (*xShmSize)(sqlite3_shm*, int reqSize, int *pNewSize);
int (*xShmGet)(sqlite3_shm*, int reqMapSize, int *pMapSize, void**);
int (*xShmRelease)(sqlite3_shm*);
int (*xShmLock)(sqlite3_shm*, int desiredLock, int *gotLock);
int (*xShmClose)(sqlite3_shm*, int deleteFlag);
int (*xRename)(sqlite3_vfs*, const char *zOld, const char *zNew, int dirSync);
int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
/*
** The methods above are in versions 1 and 2 of the sqlite_vfs object.
@@ -867,31 +887,58 @@ struct sqlite3_vfs {
** With SQLITE_ACCESS_EXISTS, the xAccess method
** simply checks whether the file exists.
** With SQLITE_ACCESS_READWRITE, the xAccess method
** checks whether the file is both readable and writable.
** checks whether the named directory is both readable and writable
** (in other words, if files can be added, removed, and renamed within
** the directory).
** The SQLITE_ACCESS_READWRITE constant is currently used only by the
** [temp_store_directory pragma], though this could change in a future
** release of SQLite.
** With SQLITE_ACCESS_READ, the xAccess method
** checks whether the file is readable.
** checks whether the file is readable. The SQLITE_ACCESS_READ constant is
** currently unused, though it might be used in a future release of
** SQLite.
*/
#define SQLITE_ACCESS_EXISTS 0
#define SQLITE_ACCESS_READWRITE 1
#define SQLITE_ACCESS_READ 2
#define SQLITE_ACCESS_READWRITE 1 /* Used by PRAGMA temp_store_directory */
#define SQLITE_ACCESS_READ 2 /* Unused */
/*
** CAPI3REF: Flags for the xShmLock VFS method
**
** These integer constants define the various locking states that
** an sqlite3_shm object can be in. The SQLITE_SHM_QUERY integer
** is not a valid data - it is a constant pasted to the
** sqlite3_vfs.xShmLock() method for querying the current lock
** state.
** These integer constants define the various locking operations
** allowed by the xShmLock method of [sqlite3_io_methods]. The
** following are the only legal combinations of flags to the
** xShmLock method:
**
** <ul>
** <li> SQLITE_SHM_LOCK | SQLITE_SHM_SHARED
** <li> SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE
** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
** </ul>
**
** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
** was given no the corresponding lock.
**
** The xShmLock method can transition between unlocked and SHARED or
** between unlocked and EXCLUSIVE. It cannot transition between SHARED
** and EXCLUSIVE.
*/
#define SQLITE_SHM_UNLOCK 0
#define SQLITE_SHM_READ 1
#define SQLITE_SHM_READ_FULL 2
#define SQLITE_SHM_WRITE 3
#define SQLITE_SHM_PENDING 4
#define SQLITE_SHM_CHECKPOINT 5
#define SQLITE_SHM_RECOVER 6
#define SQLITE_SHM_QUERY (-1)
#define SQLITE_SHM_UNLOCK 1
#define SQLITE_SHM_LOCK 2
#define SQLITE_SHM_SHARED 4
#define SQLITE_SHM_EXCLUSIVE 8
/*
** CAPI3REF: Maximum xShmLock index
**
** The xShmLock method on [sqlite3_io_methods] may use values
** between 0 and this upper bound as its "offset" argument.
** The SQLite core will never attempt to acquire or release a
** lock outside of this range
*/
#define SQLITE_SHM_NLOCK 8
/*
** CAPI3REF: Initialize The SQLite Library
@@ -5025,7 +5072,8 @@ int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_RESERVE 14
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
#define SQLITE_TESTCTRL_ISKEYWORD 16
#define SQLITE_TESTCTRL_LAST 16
#define SQLITE_TESTCTRL_PGHDRSZ 17
#define SQLITE_TESTCTRL_LAST 17
/*
** CAPI3REF: SQLite Runtime Status
@@ -5187,7 +5235,7 @@ int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
** <dd>^This parameter returns the approximate number of of bytes of heap
** memory used by all pager caches associated with the database connection.
** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
** checked out.</dd>)^
** </dd>
** </dl>
*/
#define SQLITE_DBSTATUS_LOOKASIDE_USED 0
@@ -5489,10 +5537,14 @@ typedef struct sqlite3_backup sqlite3_backup;
** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an
** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code.
**
** ^The sqlite3_backup_step() might return [SQLITE_READONLY] if the destination
** database was opened read-only or if
** the destination is an in-memory database with a different page size
** from the source database.
** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if
** <ol>
** <li> the destination database was opened read-only, or
** <li> the destination database is using write-ahead-log journaling
** and the destination and source page sizes differ, or
** <li> The destination database is an in-memory database and the
** destination and source page sizes differ.
** </ol>)^
**
** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then
** the [sqlite3_busy_handler | busy-handler function]
@@ -5763,30 +5815,37 @@ void sqlite3_log(int iErrCode, const char *zFormat, ...);
/*
** CAPI3REF: Write-Ahead Log Commit Hook
**
** The [sqlite3_wal_hook()] function is used to register a callback that
** ^The [sqlite3_wal_hook()] function is used to register a callback that
** will be invoked each time a database connection commits data to a
** write-ahead-log (i.e. whenever a transaction is committed in
** journal_mode=WAL mode).
** [write-ahead log] (i.e. whenever a transaction is committed in
** [journal_mode | journal_mode=WAL mode]).
**
** The callback is invoked by SQLite after the commit has taken place and
** ^The callback is invoked by SQLite after the commit has taken place and
** the associated write-lock on the database released, so the implementation
** may read, write or checkpoint the database as required.
** may read, write or [checkpoint] the database as required.
**
** The first parameter passed to the callback function when it is invoked
** ^The first parameter passed to the callback function when it is invoked
** is a copy of the third parameter passed to sqlite3_wal_hook() when
** registering the callback. The second is a copy of the database handle.
** The third parameter is the name of the database that was written to -
** either "main" or the name of an ATTACHed database. The fourth parameter
** is the number of pages currently in the log file, including those that
** were just committed.
** registering the callback. ^The second is a copy of the database handle.
** ^The third parameter is the name of the database that was written to -
** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter
** is the number of pages currently in the write-ahead log file,
** including those that were just committed.
**
** If an invocation of the callback function returns non-zero, then a
** checkpoint is automatically run on the database. If zero is returned,
** no special action is taken.
** The callback function should normally return [SQLITE_OK]. ^If an error
** code is returned, that error will propagate back up through the
** SQLite code base to cause the statement that provoked the callback
** to report an error, though the commit will have still occurred. If the
** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value
** that does not correspond to any valid SQLite error code, the results
** are undefined.
**
** A single database handle may have at most a single log callback
** registered at one time. Calling [sqlite3_wal_hook()] replaces any
** previously registered log callback.
** A single database handle may have at most a single write-ahead log callback
** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
** previously registered write-ahead log callback. ^Note that the
** [sqlite3_wal_autocheckpoint()] interface and the
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
** those overwrite any prior [sqlite3_wal_hook()] settings.
*/
void *sqlite3_wal_hook(
sqlite3*,
@@ -5796,11 +5855,43 @@ void *sqlite3_wal_hook(
/*
** CAPI3REF: Configure an auto-checkpoint
**
** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around
** [sqlite3_wal_hook()] that causes any database on [database connection] D
** to automatically [checkpoint]
** after committing a transaction if there are N or
** more frames in the [write-ahead log] file. ^Passing zero or
** a negative value as the nFrame parameter disables automatic
** checkpoints entirely.
**
** ^The callback registered by this function replaces any existing callback
** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback
** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism
** configured by this function.
**
** ^The [wal_autocheckpoint pragma] can be used to invoke this interface
** from SQL.
**
** ^Every new [database connection] defaults to having the auto-checkpoint
** enabled with a threshold of 1000 pages. The use of this interface
** is only necessary if the default setting is found to be suboptimal
** for a particular application.
*/
int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
/*
** CAPI3REF: Checkpoint a database
**
** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X
** on [database connection] D to be [checkpointed]. ^If X is NULL or an
** empty string, then a checkpoint is run on all databases of
** connection D. ^If the database connection D is not in
** [WAL | write-ahead log mode] then this interface is a harmless no-op.
**
** ^The [wal_checkpoint pragma] can be used to invoke this interface
** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the
** [wal_autocheckpoint pragma] can be used to cause this interface to be
** run whenever the WAL reaches a certain size threshold.
*/
int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
+13 -2
View File
@@ -272,6 +272,13 @@
# define NEVER(X) (X)
#endif
/*
** Return true (non-zero) if the input is a integer that is too large
** to fit in 32-bits. This macro is used inside of various testcase()
** macros to verify that we have tested SQLite for large-file support.
*/
#define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0)
/*
** The macro unlikely() is a hint that surrounds a boolean
** expression that is usually false. Macro likely() surrounds
@@ -790,7 +797,6 @@ struct sqlite3 {
u8 temp_store; /* 1: file 2: memory 0: default */
u8 mallocFailed; /* True if we have seen a malloc failure */
u8 dfltLockMode; /* Default locking-mode for attached dbs */
u8 dfltJournalMode; /* Default journal mode for attached dbs */
signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */
u8 suppressErr; /* Do not issue error messages if true */
int nextPagesize; /* Pagesize after VACUUM if >0 */
@@ -2536,7 +2542,8 @@ const sqlite3_mem_methods *sqlite3MemGetMemsys5(void);
#ifndef SQLITE_MUTEX_OMIT
sqlite3_mutex_methods *sqlite3DefaultMutex(void);
sqlite3_mutex_methods const *sqlite3DefaultMutex(void);
sqlite3_mutex_methods const *sqlite3NoopMutex(void);
sqlite3_mutex *sqlite3MutexAlloc(int);
int sqlite3MutexInit(void);
int sqlite3MutexEnd(void);
@@ -2668,6 +2675,7 @@ void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int);
WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**, u16);
void sqlite3WhereEnd(WhereInfo*);
int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int);
void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int);
void sqlite3ExprCodeMove(Parse*, int, int, int);
void sqlite3ExprCodeCopy(Parse*, int, int, int);
void sqlite3ExprCacheStore(Parse*, int, int, int);
@@ -2882,10 +2890,13 @@ void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
extern const unsigned char sqlite3OpcodeProperty[];
extern const unsigned char sqlite3UpperToLower[];
extern const unsigned char sqlite3CtypeMap[];
extern const Token sqlite3IntTokens[];
extern SQLITE_WSD struct Sqlite3Config sqlite3Config;
extern SQLITE_WSD FuncDefHash sqlite3GlobalFunctions;
#ifndef SQLITE_OMIT_WSD
extern int sqlite3PendingByte;
#endif
#endif
void sqlite3RootPageMoved(Db*, int, int);
void sqlite3Reindex(Parse*, Token*, Token*);
void sqlite3AlterFunctions(void);
+82 -23
View File
@@ -123,7 +123,7 @@ struct SqliteDb {
SqlFunc *pFunc; /* List of SQL functions */
Tcl_Obj *pUpdateHook; /* Update hook script (if any) */
Tcl_Obj *pRollbackHook; /* Rollback hook script (if any) */
Tcl_Obj *pLogHook; /* WAL hook script (if any) */
Tcl_Obj *pWalHook; /* WAL hook script (if any) */
Tcl_Obj *pUnlockNotify; /* Unlock notify script (if any) */
SqlCollate *pCollate; /* List of SQL collation functions */
int rc; /* Return code of most recent sqlite3_exec() */
@@ -486,8 +486,8 @@ static void DbDeleteCmd(void *db){
if( pDb->pRollbackHook ){
Tcl_DecrRefCount(pDb->pRollbackHook);
}
if( pDb->pLogHook ){
Tcl_DecrRefCount(pDb->pLogHook);
if( pDb->pWalHook ){
Tcl_DecrRefCount(pDb->pWalHook);
}
if( pDb->pCollateNeeded ){
Tcl_DecrRefCount(pDb->pCollateNeeded);
@@ -593,19 +593,22 @@ static void DbRollbackHandler(void *clientData){
}
}
static int DbLogHandler(
/*
** This procedure handles wal_hook callbacks.
*/
static int DbWalHandler(
void *clientData,
sqlite3 *db,
const char *zDb,
int nEntry
){
int ret = 0;
int ret = SQLITE_OK;
Tcl_Obj *p;
SqliteDb *pDb = (SqliteDb*)clientData;
Tcl_Interp *interp = pDb->interp;
assert(pDb->pLogHook);
assert(pDb->pWalHook);
p = Tcl_DuplicateObj(pDb->pLogHook);
p = Tcl_DuplicateObj(pDb->pWalHook);
Tcl_IncrRefCount(p);
Tcl_ListObjAppendElement(interp, p, Tcl_NewStringObj(zDb, -1));
Tcl_ListObjAppendElement(interp, p, Tcl_NewIntObj(nEntry));
@@ -2775,7 +2778,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
if( choice==DB_UPDATE_HOOK ){
ppHook = &pDb->pUpdateHook;
}else if( choice==DB_WAL_HOOK ){
ppHook = &pDb->pLogHook;
ppHook = &pDb->pWalHook;
}else{
ppHook = &pDb->pRollbackHook;
}
@@ -2801,7 +2804,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
sqlite3_update_hook(pDb->db, (pDb->pUpdateHook?DbUpdateHandler:0), pDb);
sqlite3_rollback_hook(pDb->db,(pDb->pRollbackHook?DbRollbackHandler:0),pDb);
sqlite3_wal_hook(pDb->db,(pDb->pLogHook?DbLogHandler:0),pDb);
sqlite3_wal_hook(pDb->db,(pDb->pWalHook?DbWalHandler:0),pDb);
break;
}
@@ -2894,8 +2897,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
if( strcmp(zArg,"-key")==0 ){
pKey = Tcl_GetByteArrayFromObj(objv[i+1], &nKey);
}else if( strcmp(zArg, "-vfs")==0 ){
i++;
zVfs = Tcl_GetString(objv[i]);
zVfs = Tcl_GetString(objv[i+1]);
}else if( strcmp(zArg, "-readonly")==0 ){
int b;
if( Tcl_GetBooleanFromObj(interp, objv[i+1], &b) ) return TCL_ERROR;
@@ -3486,22 +3488,55 @@ static char zMainloop[] =
"}\n"
;
#endif
#if TCLSH==2
static char zMainloop[] =
#include "spaceanal_tcl.h"
;
#endif
#define TCLSH_MAIN main /* Needed to fake out mktclapp */
int TCLSH_MAIN(int argc, char **argv){
Tcl_Interp *interp;
/* Call sqlite3_shutdown() once before doing anything else. This is to
** test that sqlite3_shutdown() can be safely called by a process before
** sqlite3_initialize() is. */
sqlite3_shutdown();
#ifdef SQLITE_TEST
static void init_all(Tcl_Interp *);
static int init_all_cmd(
ClientData cd,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
Tcl_FindExecutable(argv[0]);
interp = Tcl_CreateInterp();
Tcl_Interp *slave;
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "SLAVE");
return TCL_ERROR;
}
slave = Tcl_GetSlave(interp, Tcl_GetString(objv[1]));
if( !slave ){
return TCL_ERROR;
}
init_all(slave);
return TCL_OK;
}
#endif
/*
** Configure the interpreter passed as the first argument to have access
** to the commands and linked variables that make up:
**
** * the [sqlite3] extension itself,
**
** * If SQLITE_TCLMD5 or SQLITE_TEST is defined, the Md5 commands, and
**
** * If SQLITE_TEST is set, the various test interfaces used by the Tcl
** test suite.
*/
static void init_all(Tcl_Interp *interp){
Sqlite3_Init(interp);
#if defined(SQLITE_TEST) || defined(SQLITE_TCLMD5)
Md5_Init(interp);
#endif
#ifdef SQLITE_TEST
{
extern int Sqliteconfig_Init(Tcl_Interp*);
@@ -3530,6 +3565,8 @@ int TCLSH_MAIN(int argc, char **argv){
extern int SqlitetestOsinst_Init(Tcl_Interp*);
extern int Sqlitetestbackup_Init(Tcl_Interp*);
extern int Sqlitetestintarray_Init(Tcl_Interp*);
extern int Sqlitetestvfs_Init(Tcl_Interp *);
extern int SqlitetestStat_Init(Tcl_Interp*);
Sqliteconfig_Init(interp);
Sqlitetest1_Init(interp);
@@ -3556,12 +3593,34 @@ int TCLSH_MAIN(int argc, char **argv){
SqlitetestOsinst_Init(interp);
Sqlitetestbackup_Init(interp);
Sqlitetestintarray_Init(interp);
Sqlitetestvfs_Init(interp);
SqlitetestStat_Init(interp);
Tcl_CreateObjCommand(interp,"load_testfixture_extensions",init_all_cmd,0,0);
#ifdef SQLITE_SSE
Sqlitetestsse_Init(interp);
#endif
}
#endif
}
#define TCLSH_MAIN main /* Needed to fake out mktclapp */
int TCLSH_MAIN(int argc, char **argv){
Tcl_Interp *interp;
/* Call sqlite3_shutdown() once before doing anything else. This is to
** test that sqlite3_shutdown() can be safely called by a process before
** sqlite3_initialize() is. */
sqlite3_shutdown();
#if TCLSH==2
sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
#endif
Tcl_FindExecutable(argv[0]);
interp = Tcl_CreateInterp();
init_all(interp);
if( argc>=2 ){
int i;
char zArgc[32];
@@ -3573,14 +3632,14 @@ int TCLSH_MAIN(int argc, char **argv){
Tcl_SetVar(interp, "argv", argv[i],
TCL_GLOBAL_ONLY | TCL_LIST_ELEMENT | TCL_APPEND_VALUE);
}
if( Tcl_EvalFile(interp, argv[1])!=TCL_OK ){
if( TCLSH==1 && Tcl_EvalFile(interp, argv[1])!=TCL_OK ){
const char *zInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
if( zInfo==0 ) zInfo = Tcl_GetStringResult(interp);
fprintf(stderr,"%s: %s\n", *argv, zInfo);
return 1;
}
}
if( argc<=1 ){
if( TCLSH==2 || argc<=1 ){
Tcl_GlobalEval(interp, zMainloop);
}
return 0;
+26 -14
View File
@@ -1901,6 +1901,13 @@ static int sqlite_abort(
int argc, /* Number of arguments */
char **argv /* Text of each argument */
){
#if defined(_MSC_VER)
/* We do this, otherwise the test will halt with a popup message
* that we have to click away before the test will continue.
*/
_set_abort_behavior( 0, _CALL_REPORTFAULT );
#endif
exit(255);
assert( interp==0 ); /* This will always fail */
return TCL_OK;
}
@@ -2626,7 +2633,7 @@ bad_args:
}
/*
** Usage: test_errstr <err code>
** Usage: sqlite3_test_errstr <err code>
**
** Test that the english language string equivalents for sqlite error codes
** are sane. The parameter is an integer representing an sqlite error code.
@@ -3900,7 +3907,6 @@ static int test_global_recover(
int objc,
Tcl_Obj *CONST objv[]
){
#ifndef SQLITE_OMIT_GLOBALRECOVER
#ifndef SQLITE_OMIT_DEPRECATED
int rc;
if( objc!=1 ){
@@ -3909,7 +3915,6 @@ static int test_global_recover(
}
rc = sqlite3_global_recover();
Tcl_SetResult(interp, (char *)t1ErrorName(rc), TCL_STATIC);
#endif
#endif
return TCL_OK;
}
@@ -4609,7 +4614,7 @@ static int file_control_lasterrno_test(
}
/*
** tclcmd: file_control_lockproxy_test DB
** tclcmd: file_control_lockproxy_test DB PWD
**
** This TCL command runs the sqlite3_file_control interface and
** verifies correct operation of the SQLITE_GET_LOCKPROXYFILE and
@@ -4622,15 +4627,18 @@ static int file_control_lockproxy_test(
Tcl_Obj *CONST objv[] /* Command arguments */
){
sqlite3 *db;
const char *zPwd;
int nPwd;
if( objc!=2 ){
if( objc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetStringFromObj(objv[0], 0), " DB", 0);
Tcl_GetStringFromObj(objv[0], 0), " DB PWD", 0);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
return TCL_ERROR;
}
zPwd = Tcl_GetStringFromObj(objv[2], &nPwd);
#if !defined(SQLITE_ENABLE_LOCKING_STYLE)
# if defined(__APPLE__)
@@ -4641,9 +4649,15 @@ static int file_control_lockproxy_test(
#endif
#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)
{
char *proxyPath = "test.proxy";
char *testPath;
int rc;
char proxyPath[400];
if( sizeof(proxyPath)<nPwd+20 ){
Tcl_AppendResult(interp, "PWD too big", (void*)0);
return TCL_ERROR;
}
sprintf(proxyPath, "%s/test.proxy", zPwd);
rc = sqlite3_file_control(db, NULL, SQLITE_SET_LOCKPROXYFILE, proxyPath);
if( rc ){
Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
@@ -5129,9 +5143,6 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
extern int sqlite3_pager_readdb_count;
extern int sqlite3_pager_writedb_count;
extern int sqlite3_pager_writej_count;
#if defined(__linux__) && defined(SQLITE_TEST) && SQLITE_THREADSAFE
extern int threadsOverrideEachOthersLocks;
#endif
#if SQLITE_OS_WIN
extern int sqlite3_os_type;
#endif
@@ -5139,6 +5150,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
extern int sqlite3WhereTrace;
extern int sqlite3OSTrace;
extern int sqlite3VdbeAddopTrace;
extern int sqlite3WalTrace;
#endif
#ifdef SQLITE_TEST
extern char sqlite3_query_plan[];
@@ -5187,10 +5199,6 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
Tcl_LinkVar(interp, "unaligned_string_counter",
(char*)&unaligned_string_counter, TCL_LINK_INT);
#endif
#if defined(__linux__) && defined(SQLITE_TEST) && SQLITE_THREADSAFE
Tcl_LinkVar(interp, "threadsOverrideEachOthersLocks",
(char*)&threadsOverrideEachOthersLocks, TCL_LINK_INT);
#endif
#ifndef SQLITE_OMIT_UTF16
Tcl_LinkVar(interp, "sqlite_last_needed_collation",
(char*)&pzNeededCollation, TCL_LINK_STRING|TCL_LINK_READ_ONLY);
@@ -5210,6 +5218,10 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
(char*)&sqlite3WhereTrace, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_os_trace",
(char*)&sqlite3OSTrace, TCL_LINK_INT);
#ifndef SQLITE_OMIT_WAL
Tcl_LinkVar(interp, "sqlite_wal_trace",
(char*)&sqlite3WalTrace, TCL_LINK_INT);
#endif
#endif
#ifndef SQLITE_OMIT_DISKIO
Tcl_LinkVar(interp, "sqlite_opentemp_count",
+3
View File
@@ -581,6 +581,7 @@ static int testPendingByte(
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
" PENDING-BYTE\"", (void*)0);
return TCL_ERROR;
}
if( Tcl_GetInt(interp, argv[1], &pbyte) ) return TCL_ERROR;
rc = sqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, pbyte);
@@ -674,7 +675,9 @@ int Sqlitetest2_Init(Tcl_Interp *interp){
(char*)&sqlite3_diskfull_pending, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_diskfull",
(char*)&sqlite3_diskfull, TCL_LINK_INT);
#ifndef SQLITE_OMIT_WSD
Tcl_LinkVar(interp, "sqlite_pending_byte",
(char*)&sqlite3PendingByte, TCL_LINK_INT | TCL_LINK_READ_ONLY);
#endif
return TCL_OK;
}
+32 -4
View File
@@ -171,7 +171,7 @@ static void *crash_realloc(void *p, int n){
** 512 byte block begining at offset PENDING_BYTE.
*/
static int writeDbFile(CrashFile *p, u8 *z, i64 iAmt, i64 iOff){
int rc;
int rc = SQLITE_OK;
int iSkip = 0;
if( iOff==PENDING_BYTE && (p->flags&SQLITE_OPEN_MAIN_DB) ){
iSkip = 512;
@@ -520,8 +520,30 @@ static int cfDeviceCharacteristics(sqlite3_file *pFile){
return g.iDeviceCharacteristics;
}
/*
** Pass-throughs for WAL support.
*/
static int cfShmLock(sqlite3_file *pFile, int ofst, int n, int flags){
return sqlite3OsShmLock(((CrashFile*)pFile)->pRealFile, ofst, n, flags);
}
static void cfShmBarrier(sqlite3_file *pFile){
sqlite3OsShmBarrier(((CrashFile*)pFile)->pRealFile);
}
static int cfShmUnmap(sqlite3_file *pFile, int delFlag){
return sqlite3OsShmUnmap(((CrashFile*)pFile)->pRealFile, delFlag);
}
static int cfShmMap(
sqlite3_file *pFile, /* Handle open on database file */
int iRegion, /* Region to retrieve */
int sz, /* Size of regions */
int w, /* True to extend file if necessary */
void volatile **pp /* OUT: Mapped memory */
){
return sqlite3OsShmMap(((CrashFile*)pFile)->pRealFile, iRegion, sz, w, pp);
}
static const sqlite3_io_methods CrashFileVtab = {
1, /* iVersion */
2, /* iVersion */
cfClose, /* xClose */
cfRead, /* xRead */
cfWrite, /* xWrite */
@@ -533,7 +555,11 @@ static const sqlite3_io_methods CrashFileVtab = {
cfCheckReservedLock, /* xCheckReservedLock */
cfFileControl, /* xFileControl */
cfSectorSize, /* xSectorSize */
cfDeviceCharacteristics /* xDeviceCharacteristics */
cfDeviceCharacteristics, /* xDeviceCharacteristics */
cfShmMap, /* xShmMap */
cfShmLock, /* xShmLock */
cfShmBarrier, /* xShmBarrier */
cfShmUnmap /* xShmUnmap */
};
/*
@@ -764,7 +790,7 @@ static int crashEnableCmd(
){
int isEnable;
static sqlite3_vfs crashVfs = {
1, /* iVersion */
2, /* iVersion */
0, /* szOsFile */
0, /* mxPathname */
0, /* pNext */
@@ -782,6 +808,8 @@ static int crashEnableCmd(
cfRandomness, /* xRandomness */
cfSleep, /* xSleep */
cfCurrentTime, /* xCurrentTime */
0, /* xGetlastError */
0, /* xCurrentTimeInt64 */
};
if( objc!=2 ){
+2 -1
View File
@@ -84,6 +84,7 @@ static Tcl_ThreadCreateType tclWriterThread(ClientData pIsStarted){
*((int *)pIsStarted) = 1;
sqlite3async_run();
Tcl_MutexUnlock(&testasync_g_writerMutex);
Tcl_ExitThread(0);
TCL_THREAD_CREATE_RETURN;
}
@@ -228,7 +229,7 @@ static int testAsyncControl(
** of this module.
*/
int Sqlitetestasync_Init(Tcl_Interp *interp){
#if SQLITE_ENABLE_ASYNCIO
#ifdef SQLITE_ENABLE_ASYNCIO
Tcl_CreateObjCommand(interp,"sqlite3async_start",testAsyncStart,0,0);
Tcl_CreateObjCommand(interp,"sqlite3async_wait",testAsyncWait,0,0);
+1 -7
View File
@@ -285,12 +285,6 @@ static void set_options(Tcl_Interp *interp){
Tcl_SetVar2(interp, "sqlite_options", "gettable", "1", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_OMIT_GLOBALRECOVER
Tcl_SetVar2(interp, "sqlite_options", "globalrecover", "0", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "globalrecover", "1", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_ENABLE_ICU
Tcl_SetVar2(interp, "sqlite_options", "icu", "1", TCL_GLOBAL_ONLY);
#else
@@ -469,7 +463,7 @@ Tcl_SetVar2(interp, "sqlite_options", "long_double",
Tcl_SetVar2(interp, "sqlite_options", "trigger", "1", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_OMIT_TRUCATE_OPTIMIZATION
#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "0", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY);
+40 -52
View File
@@ -50,6 +50,10 @@ static int devsymCheckReservedLock(sqlite3_file*, int *);
static int devsymFileControl(sqlite3_file*, int op, void *pArg);
static int devsymSectorSize(sqlite3_file*);
static int devsymDeviceCharacteristics(sqlite3_file*);
static int devsymShmLock(sqlite3_file*,int,int,int);
static int devsymShmMap(sqlite3_file*,int,int,int, void volatile **);
static void devsymShmBarrier(sqlite3_file*);
static int devsymShmUnmap(sqlite3_file*,int);
/*
** Method declarations for devsym_vfs.
@@ -68,13 +72,6 @@ static int devsymRandomness(sqlite3_vfs*, int nByte, char *zOut);
static int devsymSleep(sqlite3_vfs*, int microseconds);
static int devsymCurrentTime(sqlite3_vfs*, double*);
static int devsymShmOpen(sqlite3_vfs *, const char *, sqlite3_shm **);
static int devsymShmSize(sqlite3_shm *, int , int *);
static int devsymShmGet(sqlite3_shm *, int , int *, void **);
static int devsymShmRelease(sqlite3_shm *);
static int devsymShmLock(sqlite3_shm *, int , int *);
static int devsymShmClose(sqlite3_shm *, int);
static sqlite3_vfs devsym_vfs = {
2, /* iVersion */
sizeof(devsym_file), /* szOsFile */
@@ -101,18 +98,11 @@ static sqlite3_vfs devsym_vfs = {
devsymSleep, /* xSleep */
devsymCurrentTime, /* xCurrentTime */
0, /* xGetLastError */
devsymShmOpen,
devsymShmSize,
devsymShmGet,
devsymShmRelease,
devsymShmLock,
devsymShmClose,
0,
0,
0 /* xCurrentTimeInt64 */
};
static sqlite3_io_methods devsym_io_methods = {
1, /* iVersion */
2, /* iVersion */
devsymClose, /* xClose */
devsymRead, /* xRead */
devsymWrite, /* xWrite */
@@ -124,7 +114,11 @@ static sqlite3_io_methods devsym_io_methods = {
devsymCheckReservedLock, /* xCheckReservedLock */
devsymFileControl, /* xFileControl */
devsymSectorSize, /* xSectorSize */
devsymDeviceCharacteristics /* xDeviceCharacteristics */
devsymDeviceCharacteristics, /* xDeviceCharacteristics */
devsymShmMap, /* xShmMap */
devsymShmLock, /* xShmLock */
devsymShmBarrier, /* xShmBarrier */
devsymShmUnmap /* xShmUnmap */
};
struct DevsymGlobal {
@@ -238,6 +232,34 @@ static int devsymDeviceCharacteristics(sqlite3_file *pFile){
return g.iDeviceChar;
}
/*
** Shared-memory methods are all pass-thrus.
*/
static int devsymShmLock(sqlite3_file *pFile, int ofst, int n, int flags){
devsym_file *p = (devsym_file *)pFile;
return sqlite3OsShmLock(p->pReal, ofst, n, flags);
}
static int devsymShmMap(
sqlite3_file *pFile,
int iRegion,
int szRegion,
int isWrite,
void volatile **pp
){
devsym_file *p = (devsym_file *)pFile;
return sqlite3OsShmMap(p->pReal, iRegion, szRegion, isWrite, pp);
}
static void devsymShmBarrier(sqlite3_file *pFile){
devsym_file *p = (devsym_file *)pFile;
sqlite3OsShmBarrier(p->pReal);
}
static int devsymShmUnmap(sqlite3_file *pFile, int delFlag){
devsym_file *p = (devsym_file *)pFile;
return sqlite3OsShmUnmap(p->pReal, delFlag);
}
/*
** Open an devsym file handle.
*/
@@ -346,38 +368,10 @@ static int devsymSleep(sqlite3_vfs *pVfs, int nMicro){
** Return the current time as a Julian Day number in *pTimeOut.
*/
static int devsymCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
return sqlite3OsCurrentTime(g.pVfs, pTimeOut);
return g.pVfs->xCurrentTime(g.pVfs, pTimeOut);
}
static int devsymShmOpen(
sqlite3_vfs *pVfs,
const char *zName,
sqlite3_shm **pp
){
return g.pVfs->xShmOpen(g.pVfs, zName, pp);
}
static int devsymShmSize(sqlite3_shm *p, int reqSize, int *pNewSize){
return g.pVfs->xShmSize(p, reqSize, pNewSize);
}
static int devsymShmGet(
sqlite3_shm *p,
int reqMapSize,
int *pMapSize,
void **pp
){
return g.pVfs->xShmGet(p, reqMapSize, pMapSize, pp);
}
static int devsymShmRelease(sqlite3_shm *p){
return g.pVfs->xShmRelease(p);
}
static int devsymShmLock(sqlite3_shm *p, int desiredLock, int *gotLock){
return g.pVfs->xShmLock(p, desiredLock, gotLock);
}
static int devsymShmClose(sqlite3_shm *p, int deleteFlag){
return g.pVfs->xShmClose(p, deleteFlag);
}
/*
** This procedure registers the devsym vfs with SQLite. If the argument is
** true, the devsym vfs becomes the new default vfs. It is the only publicly
@@ -387,12 +381,6 @@ void devsym_register(int iDeviceChar, int iSectorSize){
if( g.pVfs==0 ){
g.pVfs = sqlite3_vfs_find(0);
devsym_vfs.szOsFile += g.pVfs->szOsFile;
devsym_vfs.xShmOpen = (g.pVfs->xShmOpen ? devsymShmOpen : 0);
devsym_vfs.xShmSize = (g.pVfs->xShmSize ? devsymShmSize : 0);
devsym_vfs.xShmGet = (g.pVfs->xShmGet ? devsymShmGet : 0);
devsym_vfs.xShmRelease = (g.pVfs->xShmRelease ? devsymShmRelease : 0);
devsym_vfs.xShmLock = (g.pVfs->xShmLock ? devsymShmLock : 0);
devsym_vfs.xShmClose = (g.pVfs->xShmClose ? devsymShmClose : 0);
sqlite3_vfs_register(&devsym_vfs, 0);
}
if( iDeviceChar>=0 ){
+16 -2
View File
@@ -161,9 +161,10 @@ static void jtDlClose(sqlite3_vfs*, void*);
static int jtRandomness(sqlite3_vfs*, int nByte, char *zOut);
static int jtSleep(sqlite3_vfs*, int microseconds);
static int jtCurrentTime(sqlite3_vfs*, double*);
static int jtCurrentTimeInt64(sqlite3_vfs*, sqlite3_int64*);
static sqlite3_vfs jt_vfs = {
1, /* iVersion */
2, /* iVersion */
sizeof(jt_file), /* szOsFile */
JT_MAX_PATHNAME, /* mxPathname */
0, /* pNext */
@@ -180,6 +181,8 @@ static sqlite3_vfs jt_vfs = {
jtRandomness, /* xRandomness */
jtSleep, /* xSleep */
jtCurrentTime, /* xCurrentTime */
0, /* xGetLastError */
jtCurrentTimeInt64 /* xCurrentTimeInt64 */
};
static sqlite3_io_methods jt_io_methods = {
@@ -801,7 +804,13 @@ static int jtSleep(sqlite3_vfs *pVfs, int nMicro){
** Return the current time as a Julian Day number in *pTimeOut.
*/
static int jtCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
return sqlite3OsCurrentTime(g.pVfs, pTimeOut);
return g.pVfs->xCurrentTime(g.pVfs, pTimeOut);
}
/*
** Return the current time as a Julian Day number in *pTimeOut.
*/
static int jtCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){
return g.pVfs->xCurrentTimeInt64(g.pVfs, pTimeOut);
}
/**************************************************************************
@@ -821,6 +830,11 @@ int jt_register(char *zWrap, int isDefault){
return SQLITE_ERROR;
}
jt_vfs.szOsFile = sizeof(jt_file) + g.pVfs->szOsFile;
if( g.pVfs->iVersion==1 ){
jt_vfs.iVersion = 1;
}else if( g.pVfs->xCurrentTimeInt64==0 ){
jt_vfs.xCurrentTimeInt64 = 0;
}
sqlite3_vfs_register(&jt_vfs, isDefault);
return SQLITE_OK;
}
+20
View File
@@ -1359,6 +1359,25 @@ static int test_install_memsys3(
return TCL_OK;
}
static int test_vfs_oom_test(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
extern int sqlite3_memdebug_vfs_oom_test;
if( objc>2 ){
Tcl_WrongNumArgs(interp, 1, objv, "?INTEGER?");
return TCL_ERROR;
}else if( objc==2 ){
int iNew;
if( Tcl_GetIntFromObj(interp, objv[1], &iNew) ) return TCL_ERROR;
sqlite3_memdebug_vfs_oom_test = iNew;
}
Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_memdebug_vfs_oom_test));
return TCL_OK;
}
/*
** Register commands with the TCL interpreter.
*/
@@ -1396,6 +1415,7 @@ int Sqlitetest_malloc_Init(Tcl_Interp *interp){
{ "sqlite3_dump_memsys3", test_dump_memsys3 ,3 },
{ "sqlite3_dump_memsys5", test_dump_memsys3 ,5 },
{ "sqlite3_install_memsys3", test_install_memsys3 ,0 },
{ "sqlite3_memdebug_vfs_oom_test", test_vfs_oom_test ,0 },
};
int i;
for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
+10 -8
View File
@@ -199,12 +199,6 @@ static fs_vfs_t fs_vfs = {
fsRandomness, /* xRandomness */
fsSleep, /* xSleep */
fsCurrentTime, /* xCurrentTime */
0, /* xShmOpen */
0, /* xShmSize */
0, /* xShmLock */
0, /* xShmClose */
0, /* xShmDelete */
0, /* xRename */
0 /* xCurrentTimeInt64 */
},
0, /* pFileList */
@@ -224,7 +218,11 @@ static sqlite3_io_methods fs_io_methods = {
fsCheckReservedLock, /* xCheckReservedLock */
fsFileControl, /* xFileControl */
fsSectorSize, /* xSectorSize */
fsDeviceCharacteristics /* xDeviceCharacteristics */
fsDeviceCharacteristics, /* xDeviceCharacteristics */
0, /* xShmMap */
0, /* xShmLock */
0, /* xShmBarrier */
0 /* xShmUnmap */
};
@@ -241,7 +239,11 @@ static sqlite3_io_methods tmp_io_methods = {
tmpCheckReservedLock, /* xCheckReservedLock */
tmpFileControl, /* xFileControl */
tmpSectorSize, /* xSectorSize */
tmpDeviceCharacteristics /* xDeviceCharacteristics */
tmpDeviceCharacteristics, /* xDeviceCharacteristics */
0, /* xShmMap */
0, /* xShmLock */
0, /* xShmBarrier */
0 /* xShmUnmap */
};
/* Useful macros used in several places */
+886 -742
View File
File diff suppressed because it is too large Load Diff
+609
View File
@@ -0,0 +1,609 @@
/*
** 2010 July 12
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains an implementation of the "dbstat" virtual table.
**
** The dbstat virtual table is used to extract low-level formatting
** information from an SQLite database in order to implement the
** "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script
** for an example implementation.
*/
#include "sqliteInt.h"
#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
** Page paths:
**
** The value of the 'path' column describes the path taken from the
** root-node of the b-tree structure to each page. The value of the
** root-node path is '/'.
**
** The value of the path for the left-most child page of the root of
** a b-tree is '/000/'. (Btrees store content ordered from left to right
** so the pages to the left have smaller keys than the pages to the right.)
** The next to left-most child of the root page is
** '/001', and so on, each sibling page identified by a 3-digit hex
** value. The children of the 451st left-most sibling have paths such
** as '/1c2/000/, '/1c2/001/' etc.
**
** Overflow pages are specified by appending a '+' character and a
** six-digit hexadecimal value to the path to the cell they are linked
** from. For example, the three overflow pages in a chain linked from
** the left-most cell of the 450th child of the root page are identified
** by the paths:
**
** '/1c2/000+000000' // First page in overflow chain
** '/1c2/000+000001' // Second page in overflow chain
** '/1c2/000+000002' // Third page in overflow chain
**
** If the paths are sorted using the BINARY collation sequence, then
** the overflow pages associated with a cell will appear earlier in the
** sort-order than its child page:
**
** '/1c2/000/' // Left-most child of 451st child of root
*/
#define VTAB_SCHEMA \
"CREATE TABLE xx( " \
" name STRING, /* Name of table or index */" \
" path INTEGER, /* Path to page from root */" \
" pageno INTEGER, /* Page number */" \
" pagetype STRING, /* 'internal', 'leaf' or 'overflow' */" \
" ncell INTEGER, /* Cells on page (0 for overflow) */" \
" payload INTEGER, /* Bytes of payload on this page */" \
" unused INTEGER, /* Bytes of unused space on this page */" \
" mx_payload INTEGER /* Largest payload size of all cells */" \
");"
#if 0
#define VTAB_SCHEMA2 \
"CREATE TABLE yy( " \
" pageno INTEGER, /* B-tree page number */" \
" cellno INTEGER, /* Cell number within page */" \
" local INTEGER, /* Bytes of content stored locally */" \
" payload INTEGER, /* Total cell payload size */" \
" novfl INTEGER /* Number of overflow pages */" \
");"
#endif
typedef struct StatTable StatTable;
typedef struct StatCursor StatCursor;
typedef struct StatPage StatPage;
typedef struct StatCell StatCell;
struct StatCell {
int nLocal; /* Bytes of local payload */
u32 iChildPg; /* Child node (or 0 if this is a leaf) */
int nOvfl; /* Entries in aOvfl[] */
u32 *aOvfl; /* Array of overflow page numbers */
int nLastOvfl; /* Bytes of payload on final overflow page */
int iOvfl; /* Iterates through aOvfl[] */
};
struct StatPage {
u32 iPgno;
DbPage *pPg;
int iCell;
char *zPath; /* Path to this page */
/* Variables populated by statDecodePage(): */
u8 flags; /* Copy of flags byte */
int nCell; /* Number of cells on page */
int nUnused; /* Number of unused bytes on page */
StatCell *aCell; /* Array of parsed cells */
u32 iRightChildPg; /* Right-child page number (or 0) */
int nMxPayload; /* Largest payload of any cell on this page */
};
struct StatCursor {
sqlite3_vtab_cursor base;
sqlite3_stmt *pStmt; /* Iterates through set of root pages */
int isEof; /* After pStmt has returned SQLITE_DONE */
StatPage aPage[32];
int iPage; /* Current entry in aPage[] */
/* Values to return. */
char *zName; /* Value of 'name' column */
char *zPath; /* Value of 'path' column */
u32 iPageno; /* Value of 'pageno' column */
char *zPagetype; /* Value of 'pagetype' column */
int nCell; /* Value of 'ncell' column */
int nPayload; /* Value of 'payload' column */
int nUnused; /* Value of 'unused' column */
int nMxPayload; /* Value of 'mx_payload' column */
};
struct StatTable {
sqlite3_vtab base;
sqlite3 *db;
};
#ifndef get2byte
# define get2byte(x) ((x)[0]<<8 | (x)[1])
#endif
/*
** Connect to or create a statvfs virtual table.
*/
static int statConnect(
sqlite3 *db,
void *pAux,
int argc, const char *const*argv,
sqlite3_vtab **ppVtab,
char **pzErr
){
StatTable *pTab;
pTab = (StatTable *)sqlite3_malloc(sizeof(StatTable));
memset(pTab, 0, sizeof(StatTable));
pTab->db = db;
sqlite3_declare_vtab(db, VTAB_SCHEMA);
*ppVtab = &pTab->base;
return SQLITE_OK;
}
/*
** Disconnect from or destroy a statvfs virtual table.
*/
static int statDisconnect(sqlite3_vtab *pVtab){
sqlite3_free(pVtab);
return SQLITE_OK;
}
/*
** There is no "best-index". This virtual table always does a linear
** scan of the binary VFS log file.
*/
static int statBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
/* Records are always returned in ascending order of (name, path).
** If this will satisfy the client, set the orderByConsumed flag so that
** SQLite does not do an external sort.
*/
if( ( pIdxInfo->nOrderBy==1
&& pIdxInfo->aOrderBy[0].iColumn==0
&& pIdxInfo->aOrderBy[0].desc==0
) ||
( pIdxInfo->nOrderBy==2
&& pIdxInfo->aOrderBy[0].iColumn==0
&& pIdxInfo->aOrderBy[0].desc==0
&& pIdxInfo->aOrderBy[1].iColumn==1
&& pIdxInfo->aOrderBy[1].desc==0
)
){
pIdxInfo->orderByConsumed = 1;
}
pIdxInfo->estimatedCost = 10.0;
return SQLITE_OK;
}
/*
** Open a new statvfs cursor.
*/
static int statOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
StatTable *pTab = (StatTable *)pVTab;
StatCursor *pCsr;
int rc;
pCsr = (StatCursor *)sqlite3_malloc(sizeof(StatCursor));
memset(pCsr, 0, sizeof(StatCursor));
pCsr->base.pVtab = pVTab;
rc = sqlite3_prepare_v2(pTab->db,
"SELECT 'sqlite_master' AS name, 1 AS rootpage, 'table' AS type"
" UNION ALL "
"SELECT name, rootpage, type FROM sqlite_master WHERE rootpage!=0"
" ORDER BY name", -1,
&pCsr->pStmt, 0
);
if( rc!=SQLITE_OK ){
sqlite3_free(pCsr);
return rc;
}
*ppCursor = (sqlite3_vtab_cursor *)pCsr;
return SQLITE_OK;
}
static void statClearPage(StatPage *p){
int i;
for(i=0; i<p->nCell; i++){
sqlite3_free(p->aCell[i].aOvfl);
}
sqlite3PagerUnref(p->pPg);
sqlite3_free(p->aCell);
sqlite3_free(p->zPath);
memset(p, 0, sizeof(StatPage));
}
static void statResetCsr(StatCursor *pCsr){
int i;
sqlite3_reset(pCsr->pStmt);
for(i=0; i<ArraySize(pCsr->aPage); i++){
statClearPage(&pCsr->aPage[i]);
}
pCsr->iPage = 0;
sqlite3_free(pCsr->zPath);
pCsr->zPath = 0;
}
/*
** Close a statvfs cursor.
*/
static int statClose(sqlite3_vtab_cursor *pCursor){
StatCursor *pCsr = (StatCursor *)pCursor;
statResetCsr(pCsr);
sqlite3_finalize(pCsr->pStmt);
sqlite3_free(pCsr);
return SQLITE_OK;
}
static void getLocalPayload(
int nUsable, /* Usable bytes per page */
u8 flags, /* Page flags */
int nTotal, /* Total record (payload) size */
int *pnLocal /* OUT: Bytes stored locally */
){
int nLocal;
int nMinLocal;
int nMaxLocal;
if( flags==0x0D ){ /* Table leaf node */
nMinLocal = (nUsable - 12) * 32 / 255 - 23;
nMaxLocal = nUsable - 35;
}else{ /* Index interior and leaf nodes */
nMinLocal = (nUsable - 12) * 32 / 255 - 23;
nMaxLocal = (nUsable - 12) * 64 / 255 - 23;
}
nLocal = nMinLocal + (nTotal - nMinLocal) % (nUsable - 4);
if( nLocal>nMaxLocal ) nLocal = nMinLocal;
*pnLocal = nLocal;
}
static int statDecodePage(Btree *pBt, StatPage *p){
int nUnused;
int iOff;
int nHdr;
int isLeaf;
u8 *aData = sqlite3PagerGetData(p->pPg);
u8 *aHdr = &aData[p->iPgno==1 ? 100 : 0];
p->flags = aHdr[0];
p->nCell = get2byte(&aHdr[3]);
p->nMxPayload = 0;
isLeaf = (p->flags==0x0A || p->flags==0x0D);
nHdr = 12 - isLeaf*4 + (p->iPgno==1)*100;
nUnused = get2byte(&aHdr[5]) - nHdr - 2*p->nCell;
nUnused += (int)aHdr[7];
iOff = get2byte(&aHdr[1]);
while( iOff ){
nUnused += get2byte(&aData[iOff+2]);
iOff = get2byte(&aData[iOff]);
}
p->nUnused = nUnused;
p->iRightChildPg = isLeaf ? 0 : sqlite3Get4byte(&aHdr[8]);
if( p->nCell ){
int i; /* Used to iterate through cells */
int nUsable = sqlite3BtreeGetPageSize(pBt) - sqlite3BtreeGetReserve(pBt);
p->aCell = sqlite3_malloc((p->nCell+1) * sizeof(StatCell));
memset(p->aCell, 0, (p->nCell+1) * sizeof(StatCell));
for(i=0; i<p->nCell; i++){
StatCell *pCell = &p->aCell[i];
iOff = get2byte(&aData[nHdr+i*2]);
if( !isLeaf ){
pCell->iChildPg = sqlite3Get4byte(&aData[iOff]);
iOff += 4;
}
if( p->flags==0x05 ){
/* A table interior node. nPayload==0. */
}else{
u32 nPayload; /* Bytes of payload total (local+overflow) */
int nLocal; /* Bytes of payload stored locally */
iOff += getVarint32(&aData[iOff], nPayload);
if( p->flags==0x0D ){
u64 dummy;
iOff += sqlite3GetVarint(&aData[iOff], &dummy);
}
if( nPayload>p->nMxPayload ) p->nMxPayload = nPayload;
getLocalPayload(nUsable, p->flags, nPayload, &nLocal);
pCell->nLocal = nLocal;
assert( nPayload>=nLocal );
assert( nLocal<=(nUsable-35) );
if( nPayload>nLocal ){
int j;
int nOvfl = ((nPayload - nLocal) + nUsable-4 - 1) / (nUsable - 4);
pCell->nLastOvfl = (nPayload-nLocal) - (nOvfl-1) * (nUsable-4);
pCell->nOvfl = nOvfl;
pCell->aOvfl = sqlite3_malloc(sizeof(u32)*nOvfl);
pCell->aOvfl[0] = sqlite3Get4byte(&aData[iOff+nLocal]);
for(j=1; j<nOvfl; j++){
int rc;
u32 iPrev = pCell->aOvfl[j-1];
DbPage *pPg = 0;
rc = sqlite3PagerGet(sqlite3BtreePager(pBt), iPrev, &pPg);
if( rc!=SQLITE_OK ){
assert( pPg==0 );
return rc;
}
pCell->aOvfl[j] = sqlite3Get4byte(sqlite3PagerGetData(pPg));
sqlite3PagerUnref(pPg);
}
}
}
}
}
return SQLITE_OK;
}
/*
** Move a statvfs cursor to the next entry in the file.
*/
static int statNext(sqlite3_vtab_cursor *pCursor){
int rc;
int nPayload;
StatCursor *pCsr = (StatCursor *)pCursor;
StatTable *pTab = (StatTable *)pCursor->pVtab;
Btree *pBt = pTab->db->aDb[0].pBt;
Pager *pPager = sqlite3BtreePager(pBt);
sqlite3_free(pCsr->zPath);
pCsr->zPath = 0;
if( pCsr->aPage[0].pPg==0 ){
rc = sqlite3_step(pCsr->pStmt);
if( rc==SQLITE_ROW ){
u32 iRoot = sqlite3_column_int64(pCsr->pStmt, 1);
rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg);
pCsr->aPage[0].iPgno = iRoot;
pCsr->aPage[0].iCell = 0;
pCsr->aPage[0].zPath = sqlite3_mprintf("/");
pCsr->iPage = 0;
}else{
pCsr->isEof = 1;
return sqlite3_reset(pCsr->pStmt);
}
}else{
/* Page p itself has already been visited. */
StatPage *p = &pCsr->aPage[pCsr->iPage];
while( p->iCell<p->nCell ){
StatCell *pCell = &p->aCell[p->iCell];
if( pCell->iOvfl<pCell->nOvfl ){
int nUsable = sqlite3BtreeGetPageSize(pBt)-sqlite3BtreeGetReserve(pBt);
pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0);
pCsr->iPageno = pCell->aOvfl[pCell->iOvfl];
pCsr->zPagetype = "overflow";
pCsr->nCell = 0;
pCsr->nMxPayload = 0;
pCsr->zPath = sqlite3_mprintf(
"%s%.3x+%.6x", p->zPath, p->iCell, pCell->iOvfl
);
if( pCell->iOvfl<pCell->nOvfl-1 ){
pCsr->nUnused = 0;
pCsr->nPayload = nUsable - 4;
}else{
pCsr->nPayload = pCell->nLastOvfl;
pCsr->nUnused = nUsable - 4 - pCsr->nPayload;
}
pCell->iOvfl++;
return SQLITE_OK;
}
if( p->iRightChildPg ) break;
p->iCell++;
}
while( !p->iRightChildPg || p->iCell>p->nCell ){
statClearPage(p);
if( pCsr->iPage==0 ) return statNext(pCursor);
pCsr->iPage--;
p = &pCsr->aPage[pCsr->iPage];
}
pCsr->iPage++;
assert( p==&pCsr->aPage[pCsr->iPage-1] );
if( p->iCell==p->nCell ){
p[1].iPgno = p->iRightChildPg;
}else{
p[1].iPgno = p->aCell[p->iCell].iChildPg;
}
rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg);
p[1].iCell = 0;
p[1].zPath = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
p->iCell++;
}
/* Populate the StatCursor fields with the values to be returned
** by the xColumn() and xRowid() methods.
*/
if( rc==SQLITE_OK ){
int i;
StatPage *p = &pCsr->aPage[pCsr->iPage];
pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0);
pCsr->iPageno = p->iPgno;
statDecodePage(pBt, p);
switch( p->flags ){
case 0x05: /* table internal */
case 0x02: /* index internal */
pCsr->zPagetype = "internal";
break;
case 0x0D: /* table leaf */
case 0x0A: /* index leaf */
pCsr->zPagetype = "leaf";
break;
default:
pCsr->zPagetype = "corrupted";
break;
}
pCsr->nCell = p->nCell;
pCsr->nUnused = p->nUnused;
pCsr->nMxPayload = p->nMxPayload;
pCsr->zPath = sqlite3_mprintf("%s", p->zPath);
nPayload = 0;
for(i=0; i<p->nCell; i++){
nPayload += p->aCell[i].nLocal;
}
pCsr->nPayload = nPayload;
}
return rc;
}
static int statEof(sqlite3_vtab_cursor *pCursor){
StatCursor *pCsr = (StatCursor *)pCursor;
return pCsr->isEof;
}
static int statFilter(
sqlite3_vtab_cursor *pCursor,
int idxNum, const char *idxStr,
int argc, sqlite3_value **argv
){
sqlite3 *db = ((StatTable *)(pCursor->pVtab))->db;
StatCursor *pCsr = (StatCursor *)pCursor;
int nPage = 0;
statResetCsr((StatCursor *)pCursor);
sqlite3PagerPagecount(sqlite3BtreePager(db->aDb[0].pBt), &nPage);
if( nPage==0 ){
pCsr->isEof = 1;
return SQLITE_OK;
}
return statNext(pCursor);
}
static int statColumn(
sqlite3_vtab_cursor *pCursor,
sqlite3_context *ctx,
int i
){
StatCursor *pCsr = (StatCursor *)pCursor;
switch( i ){
case 0: /* name */
sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_STATIC);
break;
case 1: /* path */
sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT);
break;
case 2: /* pageno */
sqlite3_result_int64(ctx, pCsr->iPageno);
break;
case 3: /* pagetype */
sqlite3_result_text(ctx, pCsr->zPagetype, -1, SQLITE_STATIC);
break;
case 4: /* ncell */
sqlite3_result_int(ctx, pCsr->nCell);
break;
case 5: /* payload */
sqlite3_result_int(ctx, pCsr->nPayload);
break;
case 6: /* unused */
sqlite3_result_int(ctx, pCsr->nUnused);
break;
case 7: /* mx_payload */
sqlite3_result_int(ctx, pCsr->nMxPayload);
break;
}
return SQLITE_OK;
}
static int statRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){
StatCursor *pCsr = (StatCursor *)pCursor;
*pRowid = pCsr->iPageno;
return SQLITE_OK;
}
int sqlite3_dbstat_register(sqlite3 *db){
static sqlite3_module dbstat_module = {
0, /* iVersion */
statConnect, /* xCreate */
statConnect, /* xConnect */
statBestIndex, /* xBestIndex */
statDisconnect, /* xDisconnect */
statDisconnect, /* xDestroy */
statOpen, /* xOpen - open a cursor */
statClose, /* xClose - close a cursor */
statFilter, /* xFilter - configure scan constraints */
statNext, /* xNext - advance a cursor */
statEof, /* xEof - check for end of scan */
statColumn, /* xColumn - read data */
statRowid, /* xRowid - read data */
0, /* xUpdate */
0, /* xBegin */
0, /* xSync */
0, /* xCommit */
0, /* xRollback */
0, /* xFindMethod */
0, /* xRename */
};
sqlite3_create_module(db, "dbstat", &dbstat_module, 0);
return SQLITE_OK;
}
#endif
#ifdef SQLITE_TEST
#include <tcl.h>
static int test_dbstat(
void *clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
#ifdef SQLITE_OMIT_VIRTUALTABLE
Tcl_AppendResult(interp, "dbstat not available because of "
"SQLITE_OMIT_VIRTUALTABLE", (void*)0);
return TCL_ERROR;
#else
struct SqliteDb { sqlite3 *db; };
char *zDb;
Tcl_CmdInfo cmdInfo;
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "DB");
return TCL_ERROR;
}
zDb = Tcl_GetString(objv[1]);
if( Tcl_GetCommandInfo(interp, zDb, &cmdInfo) ){
sqlite3* db = ((struct SqliteDb*)cmdInfo.objClientData)->db;
sqlite3_dbstat_register(db);
}
return TCL_OK;
#endif
}
int SqlitetestStat_Init(Tcl_Interp *interp){
Tcl_CreateObjCommand(interp, "register_dbstat_vtab", test_dbstat, 0, 0);
return TCL_OK;
}
#endif
+2
View File
@@ -150,6 +150,8 @@ static Tcl_ThreadCreateType tclScriptThread(ClientData pSqlThread){
Tcl_DecrRefCount(pList);
Tcl_DecrRefCount(pRes);
Tcl_DeleteInterp(interp);
while( Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT) );
Tcl_ExitThread(0);
TCL_THREAD_CREATE_RETURN;
}
+1408
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -496,6 +496,7 @@ void sqlite3DropTrigger(Parse *pParse, SrcList *pName, int noErr){
if( !noErr ){
sqlite3ErrorMsg(pParse, "no such trigger: %S", pName, 0);
}
pParse->checkSchema = 1;
goto drop_trigger_cleanup;
}
sqlite3DropTriggerPtr(pParse, pTrigger);
+3 -3
View File
@@ -8,7 +8,7 @@
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
sqlite*************************************************************************
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
*/
@@ -212,6 +212,7 @@ void sqlite3Update(
pRowidExpr = pChanges->a[i].pExpr;
}else{
sqlite3ErrorMsg(pParse, "no such column: %s", pChanges->a[i].zName);
pParse->checkSchema = 1;
goto update_cleanup;
}
}
@@ -396,8 +397,7 @@ void sqlite3Update(
);
for(i=0; i<pTab->nCol; i++){
if( aXRef[i]<0 || oldmask==0xffffffff || (oldmask & (1<<i)) ){
sqlite3VdbeAddOp3(v, OP_Column, iCur, i, regOld+i);
sqlite3ColumnDefault(v, pTab, i, regOld+i);
sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, i, regOld+i);
}else{
sqlite3VdbeAddOp2(v, OP_Null, 0, regOld+i);
}
+14 -3
View File
@@ -103,7 +103,8 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){
void (*saved_xTrace)(void*,const char*); /* Saved db->xTrace */
Db *pDb = 0; /* Database to detach at end of vacuum */
int isMemDb; /* True if vacuuming a :memory: database */
int nRes;
int nRes; /* Bytes of reserved space at the end of each page */
int nDb; /* Number of attached databases */
if( !db->autoCommit ){
sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction");
@@ -138,15 +139,18 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){
** time to parse and run the PRAGMA to turn journalling off than it does
** to write the journal header file.
*/
nDb = db->nDb;
if( sqlite3TempInMemory(db) ){
zSql = "ATTACH ':memory:' AS vacuum_db;";
}else{
zSql = "ATTACH '' AS vacuum_db;";
}
rc = execSql(db, pzErrMsg, zSql);
if( db->nDb>nDb ){
pDb = &db->aDb[db->nDb-1];
assert( strcmp(pDb->zName,"vacuum_db")==0 );
}
if( rc!=SQLITE_OK ) goto end_of_vacuum;
pDb = &db->aDb[db->nDb-1];
assert( strcmp(db->aDb[db->nDb-1].zName,"vacuum_db")==0 );
pTemp = db->aDb[db->nDb-1].pBt;
/* The call to execSql() to attach the temp database has left the file
@@ -168,6 +172,12 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){
}
#endif
/* Do not attempt to change the page size for a WAL database */
if( sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain))
==PAGER_JOURNALMODE_WAL ){
db->nextPagesize = 0;
}
if( sqlite3BtreeSetPageSize(pTemp, sqlite3BtreeGetPageSize(pMain), nRes, 0)
|| (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0))
|| NEVER(db->mallocFailed)
@@ -304,6 +314,7 @@ end_of_vacuum:
db->nChange = saved_nChange;
db->nTotalChange = saved_nTotalChange;
db->xTrace = saved_xTrace;
sqlite3BtreeSetPageSize(pMain, -1, -1, 1);
/* Currently there is an SQL level transaction open on the vacuum
** database. No locks are held on any other files (since the main file
+78 -95
View File
@@ -480,22 +480,6 @@ static void registerTrace(FILE *out, int iReg, Mem *p){
#define CHECK_FOR_INTERRUPT \
if( db->u1.isInterrupted ) goto abort_due_to_interrupt;
#ifdef SQLITE_DEBUG
static int fileExists(sqlite3 *db, const char *zFile){
int res = 0;
int rc = SQLITE_OK;
#ifdef SQLITE_TEST
/* If we are currently testing IO errors, then do not call OsAccess() to
** test for the presence of zFile. This is because any IO error that
** occurs here will not be reported, causing the test to fail.
*/
extern int sqlite3_io_error_pending;
if( sqlite3_io_error_pending<=0 )
#endif
rc = sqlite3OsAccess(db->pVfs, zFile, SQLITE_ACCESS_EXISTS, &res);
return (res && rc==SQLITE_OK);
}
#endif
#ifndef NDEBUG
/*
@@ -594,9 +578,7 @@ int sqlite3VdbeExec(
#endif
#ifdef SQLITE_DEBUG
sqlite3BeginBenignMalloc();
if( p->pc==0
&& ((p->db->flags & SQLITE_VdbeListing) || fileExists(db, "vdbe_explain"))
){
if( p->pc==0 && (p->db->flags & SQLITE_VdbeListing)!=0 ){
int i;
printf("VDBE Program Listing:\n");
sqlite3VdbePrintSql(p);
@@ -604,9 +586,6 @@ int sqlite3VdbeExec(
sqlite3VdbePrintOp(stdout, i, &aOp[i]);
}
}
if( fileExists(db, "vdbe_trace") ){
p->trace = stdout;
}
sqlite3EndBenignMalloc();
#endif
for(pc=p->pc; rc==SQLITE_OK; pc++){
@@ -628,13 +607,6 @@ int sqlite3VdbeExec(
}
sqlite3VdbePrintOp(p->trace, pc, pOp);
}
if( p->trace==0 && pc==0 ){
sqlite3BeginBenignMalloc();
if( fileExists(db, "vdbe_sqltrace") ){
sqlite3VdbePrintSql(p);
}
sqlite3EndBenignMalloc();
}
#endif
@@ -989,38 +961,23 @@ case OP_Blob: { /* out2-prerelease */
break;
}
/* Opcode: Variable P1 P2 P3 P4 *
/* Opcode: Variable P1 P2 * P4 *
**
** Transfer the values of bound parameters P1..P1+P3-1 into registers
** P2..P2+P3-1.
** Transfer the values of bound parameter P1 into register P2
**
** If the parameter is named, then its name appears in P4 and P3==1.
** The P4 value is used by sqlite3_bind_parameter_name().
*/
case OP_Variable: {
int p1; /* Variable to copy from */
int p2; /* Register to copy to */
int n; /* Number of values left to copy */
case OP_Variable: { /* out2-prerelease */
Mem *pVar; /* Value being transferred */
p1 = pOp->p1 - 1;
p2 = pOp->p2;
n = pOp->p3;
assert( p1>=0 && p1+n<=p->nVar );
assert( p2>=1 && p2+n-1<=p->nMem );
assert( pOp->p4.z==0 || pOp->p3==1 || pOp->p3==0 );
while( n-- > 0 ){
pVar = &p->aVar[p1++];
if( sqlite3VdbeMemTooBig(pVar) ){
goto too_big;
}
pOut = &aMem[p2++];
sqlite3VdbeMemReleaseExternal(pOut);
pOut->flags = MEM_Null;
sqlite3VdbeMemShallowCopy(pOut, pVar, MEM_Static);
UPDATE_MAX_BLOBSIZE(pOut);
assert( pOp->p1>0 && pOp->p1<=p->nVar );
pVar = &p->aVar[pOp->p1 - 1];
if( sqlite3VdbeMemTooBig(pVar) ){
goto too_big;
}
sqlite3VdbeMemShallowCopy(pOut, pVar, MEM_Static);
UPDATE_MAX_BLOBSIZE(pOut);
break;
}
@@ -4181,14 +4138,13 @@ case OP_Rewind: { /* jump */
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
pC = p->apCsr[pOp->p1];
assert( pC!=0 );
res = 1;
if( (pCrsr = pC->pCursor)!=0 ){
rc = sqlite3BtreeFirst(pCrsr, &res);
pC->atFirst = res==0 ?1:0;
pC->deferredMoveto = 0;
pC->cacheStatus = CACHE_STALE;
pC->rowidIsValid = 0;
}else{
res = 1;
}
pC->nullRow = (u8)res;
assert( pOp->p2>0 && pOp->p2<p->nOp );
@@ -5198,7 +5154,8 @@ case OP_Checkpoint: {
};
#endif
/* Opcode: JournalMode P1 P2 P3 * *
#ifndef SQLITE_OMIT_PRAGMA
/* Opcode: JournalMode P1 P2 P3 * P5
**
** Change the journal mode of database P1 to P3. P3 must be one of the
** PAGER_JOURNALMODE_XXX values. If changing between the various rollback
@@ -5214,7 +5171,6 @@ case OP_JournalMode: { /* out2-prerelease */
Pager *pPager; /* Pager associated with pBt */
int eNew; /* New journal mode */
int eOld; /* The old journal mode */
const sqlite3_vfs *pVfs; /* The VFS of pPager */
const char *zFilename; /* Name of database file for pPager */
eNew = pOp->p3;
@@ -5227,63 +5183,89 @@ case OP_JournalMode: { /* out2-prerelease */
|| eNew==PAGER_JOURNALMODE_QUERY
);
assert( pOp->p1>=0 && pOp->p1<db->nDb );
assert( (p->btreeMask & (1<<pOp->p1))!=0 );
/* This opcode is used in two places: PRAGMA journal_mode and ATTACH.
** In PRAGMA journal_mode, the sqlite3VdbeUsesBtree() routine is called
** when the statment is prepared and so p->aMutex.nMutex>0. All mutexes
** are already acquired. But when used in ATTACH, sqlite3VdbeUsesBtree()
** is not called when the statement is prepared because it requires the
** iDb index of the database as a parameter, and the database has not
** yet been attached so that index is unavailable. We have to wait
** until runtime (now) to get the mutex on the newly attached database.
** No other mutexes are required by the ATTACH command so this is safe
** to do.
*/
assert( (p->btreeMask & (1<<pOp->p1))!=0 || p->aMutex.nMutex==0 );
if( p->aMutex.nMutex==0 ){
/* This occurs right after ATTACH. Get a mutex on the newly ATTACHed
** database. */
sqlite3VdbeUsesBtree(p, pOp->p1);
sqlite3VdbeMutexArrayEnter(p);
}
pBt = db->aDb[pOp->p1].pBt;
pPager = sqlite3BtreePager(pBt);
eOld = sqlite3PagerGetJournalMode(pPager);
if( eNew==PAGER_JOURNALMODE_QUERY ) eNew = eOld;
if( !sqlite3PagerOkToChangeJournalMode(pPager) ) eNew = eOld;
#ifndef SQLITE_OMIT_WAL
zFilename = sqlite3PagerFilename(pPager);
pVfs = sqlite3PagerVfs(pPager);
/* Do not allow a transition to journal_mode=WAL for a database
** in temporary storage or if the VFS does not support xShmOpen.
** in temporary storage or if the VFS does not support shared memory
*/
if( eNew==PAGER_JOURNALMODE_WAL
&& (zFilename[0]==0 /* Temp file */
|| pVfs->iVersion<2 || pVfs->xShmOpen==0) /* No xShmOpen support */
&& (zFilename[0]==0 /* Temp file */
|| !sqlite3PagerWalSupported(pPager)) /* No shared-memory support */
){
eNew = PAGER_JOURNALMODE_QUERY;
eNew = eOld;
}
if( eNew!=PAGER_JOURNALMODE_QUERY ){
eOld = sqlite3PagerJournalMode(pPager, PAGER_JOURNALMODE_QUERY);
if( (eNew!=eOld)
&& (eOld==PAGER_JOURNALMODE_WAL || eNew==PAGER_JOURNALMODE_WAL)
){
if( !db->autoCommit || db->activeVdbeCnt>1 ){
rc = SQLITE_ERROR;
sqlite3SetString(&p->zErrMsg, db,
"cannot change %s wal mode from within a transaction",
(eNew==PAGER_JOURNALMODE_WAL ? "into" : "out of")
);
}else{
if( eOld==PAGER_JOURNALMODE_WAL ){
/* If leaving WAL mode, close the log file. If successful, the call
** to PagerCloseWal() checkpoints and deletes the write-ahead-log
** file. An EXCLUSIVE lock may still be held on the database file
** after a successful return.
*/
rc = sqlite3PagerCloseWal(pPager);
if( rc!=SQLITE_OK ) goto abort_due_to_error;
sqlite3PagerJournalMode(pPager, eNew);
}else{
sqlite3PagerJournalMode(pPager, PAGER_JOURNALMODE_DELETE);
}
/* Open a transaction on the database file. Regardless of the journal
** mode, this transaction always uses a rollback journal.
if( (eNew!=eOld)
&& (eOld==PAGER_JOURNALMODE_WAL || eNew==PAGER_JOURNALMODE_WAL)
){
if( !db->autoCommit || db->activeVdbeCnt>1 ){
rc = SQLITE_ERROR;
sqlite3SetString(&p->zErrMsg, db,
"cannot change %s wal mode from within a transaction",
(eNew==PAGER_JOURNALMODE_WAL ? "into" : "out of")
);
break;
}else{
if( eOld==PAGER_JOURNALMODE_WAL ){
/* If leaving WAL mode, close the log file. If successful, the call
** to PagerCloseWal() checkpoints and deletes the write-ahead-log
** file. An EXCLUSIVE lock may still be held on the database file
** after a successful return.
*/
assert( sqlite3BtreeIsInTrans(pBt)==0 );
rc = sqlite3PagerCloseWal(pPager);
if( rc==SQLITE_OK ){
sqlite3PagerSetJournalMode(pPager, eNew);
}
}else if( eOld==PAGER_JOURNALMODE_MEMORY ){
/* Cannot transition directly from MEMORY to WAL. Use mode OFF
** as an intermediate */
sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF);
}
/* Open a transaction on the database file. Regardless of the journal
** mode, this transaction always uses a rollback journal.
*/
assert( sqlite3BtreeIsInTrans(pBt)==0 );
if( rc==SQLITE_OK ){
rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1));
if( rc!=SQLITE_OK ) goto abort_due_to_error;
}
}
}
#endif /* ifndef SQLITE_OMIT_WAL */
eNew = sqlite3PagerJournalMode(pPager, eNew);
if( rc ){
eNew = eOld;
}
eNew = sqlite3PagerSetJournalMode(pPager, eNew);
pOut = &aMem[pOp->p2];
pOut->flags = MEM_Str|MEM_Static|MEM_Term;
pOut->z = (char *)sqlite3JournalModename(eNew);
@@ -5291,7 +5273,8 @@ case OP_JournalMode: { /* out2-prerelease */
pOut->enc = SQLITE_UTF8;
sqlite3VdbeChangeEncoding(pOut, encoding);
break;
};
};
#endif /* SQLITE_OMIT_PRAGMA */
#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)
/* Opcode: Vacuum * * * * *
+6 -14
View File
@@ -318,10 +318,8 @@ static int doWalCallbacks(sqlite3 *db){
Btree *pBt = db->aDb[i].pBt;
if( pBt ){
int nEntry = sqlite3PagerWalCallback(sqlite3BtreePager(pBt));
if( db->xWalCallback && nEntry>0 && rc==SQLITE_OK
&& db->xWalCallback(db->pWalArg, db, db->aDb[i].zName, nEntry)
){
rc = sqlite3Checkpoint(db, i);
if( db->xWalCallback && nEntry>0 && rc==SQLITE_OK ){
rc = db->xWalCallback(db->pWalArg, db, db->aDb[i].zName, nEntry);
}
}
}
@@ -377,9 +375,7 @@ static int sqlite3Step(Vdbe *p){
#ifndef SQLITE_OMIT_TRACE
if( db->xProfile && !db->init.busy ){
double rNow;
sqlite3OsCurrentTime(db->pVfs, &rNow);
p->startTime = (u64)((rNow - (int)rNow)*3600.0*24.0*1000000000.0);
sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime);
}
#endif
@@ -400,13 +396,9 @@ static int sqlite3Step(Vdbe *p){
/* Invoke the profile callback if there is one
*/
if( rc!=SQLITE_ROW && db->xProfile && !db->init.busy && p->zSql ){
double rNow;
u64 elapseTime;
sqlite3OsCurrentTime(db->pVfs, &rNow);
elapseTime = (u64)((rNow - (int)rNow)*3600.0*24.0*1000000000.0);
elapseTime -= p->startTime;
db->xProfile(db->pProfileArg, p->zSql, elapseTime);
sqlite3_int64 iNow;
sqlite3OsCurrentTimeInt64(db->pVfs, &iNow);
db->xProfile(db->pProfileArg, p->zSql, iNow - p->startTime);
}
#endif
+27 -10
View File
@@ -814,9 +814,12 @@ void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){
**
** If a memory allocation error has occurred prior to the calling of this
** routine, then a pointer to a dummy VdbeOp will be returned. That opcode
** is readable and writable, but it has no effect. The return of a dummy
** opcode allows the call to continue functioning after a OOM fault without
** having to check to see if the return from this routine is a valid pointer.
** is readable but not writable, though it is cast to a writable value.
** The return of a dummy opcode allows the call to continue functioning
** after a OOM fault without having to check to see if the return from
** this routine is a valid pointer. But because the dummy.opcode is 0,
** dummy will never be written to. This is verified by code inspection and
** by running with Valgrind.
**
** About the #ifdef SQLITE_OMIT_TRACE: Normally, this routine is never called
** unless p->nOp>0. This is because in the absense of SQLITE_OMIT_TRACE,
@@ -827,17 +830,19 @@ void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){
** check the value of p->nOp-1 before continuing.
*/
VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
static VdbeOp dummy;
/* C89 specifies that the constant "dummy" will be initialized to all
** zeros, which is correct. MSVC generates a warning, nevertheless. */
static const VdbeOp dummy; /* Ignore the MSVC warning about no initializer */
assert( p->magic==VDBE_MAGIC_INIT );
if( addr<0 ){
#ifdef SQLITE_OMIT_TRACE
if( p->nOp==0 ) return &dummy;
if( p->nOp==0 ) return (VdbeOp*)&dummy;
#endif
addr = p->nOp - 1;
}
assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed );
if( p->db->mallocFailed ){
return &dummy;
return (VdbeOp*)&dummy;
}else{
return &p->aOp[addr];
}
@@ -950,6 +955,11 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){
/*
** Declare to the Vdbe that the BTree object at db->aDb[i] is used.
**
** The prepared statement has to know in advance which Btree objects
** will be used so that it can acquire mutexes on them all in sorted
** order (via sqlite3VdbeMutexArrayEnter(). Mutexes are acquired
** in order (and released in reverse order) to avoid deadlocks.
*/
void sqlite3VdbeUsesBtree(Vdbe *p, int i){
int mask;
@@ -2138,10 +2148,17 @@ int sqlite3VdbeHalt(Vdbe *p){
*/
if( eStatementOp ){
rc = sqlite3VdbeCloseStatement(p, eStatementOp);
if( rc && (NEVER(p->rc==SQLITE_OK) || p->rc==SQLITE_CONSTRAINT) ){
p->rc = rc;
sqlite3DbFree(db, p->zErrMsg);
p->zErrMsg = 0;
if( rc ){
assert( eStatementOp==SAVEPOINT_ROLLBACK );
if( NEVER(p->rc==SQLITE_OK) || p->rc==SQLITE_CONSTRAINT ){
p->rc = rc;
sqlite3DbFree(db, p->zErrMsg);
p->zErrMsg = 0;
}
invalidateCursorsOnModifiedBtrees(db);
sqlite3RollbackAll(db);
sqlite3CloseSavepoints(db);
db->autoCommit = 1;
}
}
+4
View File
@@ -191,10 +191,14 @@ int sqlite3_blob_open(
sqlite3VdbeUsesBtree(v, iDb);
/* Configure the OP_TableLock instruction */
#ifdef SQLITE_OMIT_SHARED_CACHE
sqlite3VdbeChangeToNoop(v, 2, 1);
#else
sqlite3VdbeChangeP1(v, 2, iDb);
sqlite3VdbeChangeP2(v, 2, pTab->tnum);
sqlite3VdbeChangeP3(v, 2, flags);
sqlite3VdbeChangeP4(v, 2, pTab->zName, P4_TRANSIENT);
#endif
/* Remove either the OP_OpenWrite or OpenRead. Set the P2
** parameter of the other to pTab->tnum. */
+10 -3
View File
@@ -1015,9 +1015,16 @@ int sqlite3ValueFromExpr(
return SQLITE_OK;
}
op = pExpr->op;
if( op==TK_REGISTER ){
op = pExpr->op2; /* This only happens with SQLITE_ENABLE_STAT2 */
}
/* op can only be TK_REGISTER is we have compiled with SQLITE_ENABLE_STAT2.
** The ifdef here is to enable us to achieve 100% branch test coverage even
** when SQLITE_ENABLE_STAT2 is omitted.
*/
#ifdef SQLITE_ENABLE_STAT2
if( op==TK_REGISTER ) op = pExpr->op2;
#else
if( NEVER(op==TK_REGISTER) ) op = pExpr->op2;
#endif
if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){
pVal = sqlite3ValueNew(db);
+2235 -890
View File
File diff suppressed because it is too large Load Diff
+32 -24
View File
@@ -20,29 +20,33 @@
#include "sqliteInt.h"
#ifdef SQLITE_OMIT_WAL
# define sqlite3WalOpen(x,y,z) 0
# define sqlite3WalClose(w,x,y,z) 0
# define sqlite3WalOpenSnapshot(y,z) 0
# define sqlite3WalCloseSnapshot(z)
# define sqlite3WalRead(w,x,y,z) 0
# define sqlite3WalOpen(x,y,z) 0
# define sqlite3WalClose(w,x,y,z) 0
# define sqlite3WalBeginReadTransaction(y,z) 0
# define sqlite3WalEndReadTransaction(z)
# define sqlite3WalRead(v,w,x,y,z) 0
# define sqlite3WalDbsize(y,z)
# define sqlite3WalWriteLock(y,z) 0
# define sqlite3WalUndo(x,y,z) 0
# define sqlite3WalSavepoint(z) 0
# define sqlite3WalSavepointUndo(y,z) 0
# define sqlite3WalFrames(u,v,w,x,y,z) 0
# define sqlite3WalCheckpoint(u,v,w,x,y,z) 0
# define sqlite3WalCallback(z) 0
# define sqlite3WalBeginWriteTransaction(y) 0
# define sqlite3WalEndWriteTransaction(x) 0
# define sqlite3WalUndo(x,y,z) 0
# define sqlite3WalSavepoint(y,z)
# define sqlite3WalSavepointUndo(y,z) 0
# define sqlite3WalFrames(u,v,w,x,y,z) 0
# define sqlite3WalCheckpoint(u,v,w,x) 0
# define sqlite3WalCallback(z) 0
# define sqlite3WalExclusiveMode(y,z) 0
#else
#define WAL_SAVEPOINT_NDATA 4
/* Connection to a write-ahead log (WAL) file.
** There is one object of this type for each pager.
*/
typedef struct Wal Wal;
/* Open and close a connection to a write-ahead log. */
int sqlite3WalOpen(sqlite3_vfs*, const char *zDb, Wal **ppWal);
int sqlite3WalClose(Wal *pWal, sqlite3_file *pFd, int sync_flags, u8 *zBuf);
int sqlite3WalOpen(sqlite3_vfs*, sqlite3_file*, const char *zName, Wal**);
int sqlite3WalClose(Wal *pWal, int sync_flags, int, u8 *);
/* Used by readers to open (lock) and close (unlock) a snapshot. A
** snapshot is like a read-transaction. It is the state of the database
@@ -51,29 +55,30 @@ int sqlite3WalClose(Wal *pWal, sqlite3_file *pFd, int sync_flags, u8 *zBuf);
** write to or checkpoint the WAL. sqlite3WalCloseSnapshot() closes the
** transaction and releases the lock.
*/
int sqlite3WalOpenSnapshot(Wal *pWal, int *);
void sqlite3WalCloseSnapshot(Wal *pWal);
int sqlite3WalBeginReadTransaction(Wal *pWal, int *);
void sqlite3WalEndReadTransaction(Wal *pWal);
/* Read a page from the write-ahead log, if it is present. */
int sqlite3WalRead(Wal *pWal, Pgno pgno, int *pInWal, u8 *pOut);
int sqlite3WalRead(Wal *pWal, Pgno pgno, int *pInWal, int nOut, u8 *pOut);
/* Return the size of the database as it existed at the beginning
** of the snapshot */
void sqlite3WalDbsize(Wal *pWal, Pgno *pPgno);
/* Obtain or release the WRITER lock. */
int sqlite3WalWriteLock(Wal *pWal, int op);
int sqlite3WalBeginWriteTransaction(Wal *pWal);
int sqlite3WalEndWriteTransaction(Wal *pWal);
/* Undo any frames written (but not committed) to the log */
int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx);
/* Return an integer that records the current (uncommitted) write
** position in the WAL */
u32 sqlite3WalSavepoint(Wal *pWal);
void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData);
/* Move the write position of the WAL back to iFrame. Called in
** response to a ROLLBACK TO command. */
int sqlite3WalSavepointUndo(Wal *pWal, u32 iFrame);
int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData);
/* Write a frame or frames to the log. */
int sqlite3WalFrames(Wal *pWal, int, PgHdr *, Pgno, int, int);
@@ -81,11 +86,9 @@ int sqlite3WalFrames(Wal *pWal, int, PgHdr *, Pgno, int, int);
/* Copy pages from the log to the database file */
int sqlite3WalCheckpoint(
Wal *pWal, /* Write-ahead log connection */
sqlite3_file *pFd, /* File descriptor open on db file */
int sync_flags, /* Flags to sync db file with (or 0) */
u8 *zBuf, /* Temporary buffer to use */
int (*xBusyHandler)(void *), /* Pointer to busy-handler function */
void *pBusyHandlerArg /* Argument to pass to xBusyHandler */
int nBuf, /* Size of buffer nBuf */
u8 *zBuf /* Temporary buffer to use */
);
/* Return the value to pass to a sqlite3_wal_hook callback, the
@@ -95,5 +98,10 @@ int sqlite3WalCheckpoint(
*/
int sqlite3WalCallback(Wal *pWal);
/* Tell the wal layer that an EXCLUSIVE lock has been obtained (or released)
** by the pager layer on the database file.
*/
int sqlite3WalExclusiveMode(Wal *pWal, int op);
#endif /* ifndef SQLITE_OMIT_WAL */
#endif /* _WAL_H_ */
+21 -18
View File
@@ -1841,7 +1841,7 @@ static void constructAutomaticIndex(
}
}
}
assert( n==pLevel->plan.nEq );
assert( (u32)n==pLevel->plan.nEq );
/* Add additional columns needed to make the automatic index into
** a covering index */
@@ -2622,7 +2622,7 @@ static void bestBtreeIndex(
if( ExprHasProperty(pExpr, EP_xIsSelect) ){
nInMul *= 25;
bInEst = 1;
}else if( pExpr->x.pList ){
}else if( ALWAYS(pExpr->x.pList) ){
nInMul *= pExpr->x.pList->nExpr + 1;
}
}else if( pTerm->eOperator & WO_ISNULL ){
@@ -3384,7 +3384,8 @@ static Bitmask codeOneLoopStart(
int iIdxCur; /* The VDBE cursor for the index */
int nExtraReg = 0; /* Number of extra registers needed */
int op; /* Instruction opcode */
char *zAff;
char *zStartAff; /* Affinity for start of range constraint */
char *zEndAff; /* Affinity for end of range constraint */
pIdx = pLevel->plan.u.pIdx;
iIdxCur = pLevel->iIdxCur;
@@ -3425,15 +3426,16 @@ static Bitmask codeOneLoopStart(
** starting at regBase.
*/
regBase = codeAllEqualityTerms(
pParse, pLevel, pWC, notReady, nExtraReg, &zAff
pParse, pLevel, pWC, notReady, nExtraReg, &zStartAff
);
zEndAff = sqlite3DbStrDup(pParse->db, zStartAff);
addrNxt = pLevel->addrNxt;
/* If we are doing a reverse order scan on an ascending index, or
** a forward order scan on a descending index, interchange the
** start and end terms (pRangeStart and pRangeEnd).
*/
if( bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC) ){
if( nEq<pIdx->nColumn && bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC) ){
SWAP(WhereTerm *, pRangeEnd, pRangeStart);
}
@@ -3451,15 +3453,15 @@ static Bitmask codeOneLoopStart(
Expr *pRight = pRangeStart->pExpr->pRight;
sqlite3ExprCode(pParse, pRight, regBase+nEq);
sqlite3ExprCodeIsNullJump(v, pRight, regBase+nEq, addrNxt);
if( zAff ){
if( sqlite3CompareAffinity(pRight, zAff[nConstraint])==SQLITE_AFF_NONE){
if( zStartAff ){
if( sqlite3CompareAffinity(pRight, zStartAff[nEq])==SQLITE_AFF_NONE){
/* Since the comparison is to be performed with no conversions
** applied to the operands, set the affinity to apply to pRight to
** SQLITE_AFF_NONE. */
zAff[nConstraint] = SQLITE_AFF_NONE;
zStartAff[nEq] = SQLITE_AFF_NONE;
}
if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[nConstraint]) ){
zAff[nConstraint] = SQLITE_AFF_NONE;
if( sqlite3ExprNeedsNoAffinityChange(pRight, zStartAff[nEq]) ){
zStartAff[nEq] = SQLITE_AFF_NONE;
}
}
nConstraint++;
@@ -3469,7 +3471,7 @@ static Bitmask codeOneLoopStart(
startEq = 0;
start_constraints = 1;
}
codeApplyAffinity(pParse, regBase, nConstraint, zAff);
codeApplyAffinity(pParse, regBase, nConstraint, zStartAff);
op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
assert( op!=0 );
testcase( op==OP_Rewind );
@@ -3489,21 +3491,22 @@ static Bitmask codeOneLoopStart(
sqlite3ExprCacheRemove(pParse, regBase+nEq, 1);
sqlite3ExprCode(pParse, pRight, regBase+nEq);
sqlite3ExprCodeIsNullJump(v, pRight, regBase+nEq, addrNxt);
if( zAff ){
if( sqlite3CompareAffinity(pRight, zAff[nConstraint])==SQLITE_AFF_NONE){
if( zEndAff ){
if( sqlite3CompareAffinity(pRight, zEndAff[nEq])==SQLITE_AFF_NONE){
/* Since the comparison is to be performed with no conversions
** applied to the operands, set the affinity to apply to pRight to
** SQLITE_AFF_NONE. */
zAff[nConstraint] = SQLITE_AFF_NONE;
zEndAff[nEq] = SQLITE_AFF_NONE;
}
if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[nConstraint]) ){
zAff[nConstraint] = SQLITE_AFF_NONE;
if( sqlite3ExprNeedsNoAffinityChange(pRight, zEndAff[nEq]) ){
zEndAff[nEq] = SQLITE_AFF_NONE;
}
}
codeApplyAffinity(pParse, regBase, nEq+1, zAff);
codeApplyAffinity(pParse, regBase, nEq+1, zEndAff);
nConstraint++;
}
sqlite3DbFree(pParse->db, zAff);
sqlite3DbFree(pParse->db, zStartAff);
sqlite3DbFree(pParse->db, zEndAff);
/* Top of the loop body */
pLevel->p2 = sqlite3VdbeCurrentAddr(v);
+26 -121
View File
@@ -10,135 +10,40 @@
#***********************************************************************
# This file runs all tests.
#
# $Id: all.test,v 1.62 2009/01/06 18:43:51 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
rename finish_test really_finish_test
proc finish_test {} {
catch {db close}
show_memstats
}
if {[file exists ./sqlite_test_count]} {
set COUNT [exec cat ./sqlite_test_count]
} else {
set COUNT 1
}
if {[llength $argv]>0} {
foreach {name value} $argv {
switch -- $name {
-count {
set COUNT $value
}
-quick {
set ISQUICK $value
}
-soak {
set SOAKTEST $value
}
default {
puts stderr "Unknown option: $name"
exit
}
}
}
}
set argv {}
# LeakList will hold a list of the number of unfreed mallocs after
# each round of the test. This number should be constant. If it
# grows, it may mean there is a memory leak in the library.
#
set LeakList {}
set EXCLUDE {}
lappend EXCLUDE all.test ;# This file
lappend EXCLUDE async.test
lappend EXCLUDE crash.test ;# Run seperately later.
lappend EXCLUDE crash2.test ;# Run seperately later.
lappend EXCLUDE quick.test ;# Alternate test driver script
lappend EXCLUDE veryquick.test ;# Alternate test driver script
lappend EXCLUDE malloc.test ;# Run seperately later.
lappend EXCLUDE misuse.test ;# Run seperately later.
lappend EXCLUDE memleak.test ;# Alternate test driver script
lappend EXCLUDE permutations.test ;# Run seperately later.
lappend EXCLUDE soak.test ;# Takes a very long time (default 1 hr)
lappend EXCLUDE fts3.test ;# Wrapper for muliple fts3*.tests
lappend EXCLUDE mallocAll.test ;# Wrapper for running all malloc tests
# Files to include in the test. If this list is empty then everything
# that is not in the EXCLUDE list is run.
#
set INCLUDE {
}
for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} {
foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
set tail [file tail $testfile]
if {[lsearch -exact $EXCLUDE $tail]>=0} continue
if {[llength $INCLUDE]>0 && [lsearch -exact $INCLUDE $tail]<0} continue
reset_prng_state
source $testfile
catch {db close}
if {$sqlite_open_file_count>0} {
puts "$tail did not close all files: $sqlite_open_file_count"
incr nErr
lappend ::failList $tail
set sqlite_open_file_count 0
}
}
if {[info exists Leak]} {
lappend LeakList $Leak
}
}
set argv all
source $testdir/permutations.test
set argv ""
# Do one last test to look for a memory leak in the library. This will
# only work if SQLite is compiled with the -DSQLITE_DEBUG=1 flag.
#
if {$LeakList!=""} {
puts -nonewline memory-leak-test...
incr ::nTest
foreach x $LeakList {
if {$x!=[lindex $LeakList 0]} {
puts " failed!"
puts "Expected: all values to be the same"
puts " Got: $LeakList"
incr ::nErr
lappend ::failList memory-leak-test
break
}
}
puts " Ok"
}
run_test_suite full
run_test_suite memsubsys1
run_test_suite memsubsys2
run_test_suite singlethread
run_test_suite multithread
run_test_suite onefile
run_test_suite utf16
run_test_suite exclusive
run_test_suite persistent_journal
run_test_suite persistent_journal_error
run_test_suite no_journal
run_test_suite no_journal_error
run_test_suite autovacuum_ioerr
run_test_suite no_mutex_try
run_test_suite fullmutex
run_test_suite journaltest
run_test_suite inmemory_journal
run_test_suite pcache0
run_test_suite pcache10
run_test_suite pcache50
run_test_suite pcache90
run_test_suite pcache100
# Run the crashtest only on unix and only once. If the library does not
# always create auto-vacuum databases, also run autovacuum_crash.test.
#
if {$::tcl_platform(platform)=="unix"} {
source $testdir/crash.test
source $testdir/crash2.test
ifcapable !default_autovacuum {
set argv autovacuum_crash
source $testdir/permutations.test
set argv ""
run_test_suite autovacuum_crash
}
}
# Run the malloc tests and the misuse test after memory leak detection.
# Both tests leak memory. Currently, misuse.test also leaks a handful of
# file descriptors. This is not considered a problem, but can cause tests
# in malloc.test to fail. So set the open-file count to zero before running
# malloc.test to get around this.
#
catch {source $testdir/misuse.test}
set sqlite_open_file_count 0
catch {source $testdir/malloc.test}
finish_test
catch {db close}
set sqlite_open_file_count 0
really_finish_test
+8 -1
View File
@@ -22,9 +22,15 @@ source $testdir/tester.tcl
# We have to have pragmas in order to do this test
ifcapable {!pragma} return
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts. See proc [set_file_format].
#
do_not_use_codec
# These tests do not work if there is a codec.
#
#if {[catch {sqlite3 -has_codec} r] || $r} return
#
# The file format change affects the way row-records stored in tables (but
# not indices) are interpreted. Before version 3.1.3, a row-record for a
@@ -248,7 +254,8 @@ ifcapable trigger {
do_test alter2-4.1 {
db close
set_file_format 5
sqlite3 db test.db
catch { sqlite3 db test.db }
set {} {}
} {}
do_test alter2-4.2 {
# We have to run two queries here because the Tcl interface uses
+1 -1
View File
@@ -296,7 +296,7 @@ do_test analyze-99.1 {
UPDATE sqlite_master SET sql='nonsense' WHERE name='sqlite_stat1';
}
db close
sqlite3 db test.db
catch { sqlite3 db test.db }
catchsql {
ANALYZE
}
+5
View File
@@ -22,6 +22,11 @@ ifcapable !stat2 {
return
}
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
#--------------------------------------------------------------------
# Test organization:
#
+18 -15
View File
@@ -23,8 +23,8 @@ proc finish_test {} {
catch {db2 close}
catch {db3 close}
}
if {[info exists ISQUICK]} { set ASYNC_SAVE_ISQUICK $ISQUICK }
set ISQUICK 1
if {[info exists G(isquick)]} { set ASYNC_SAVE_ISQUICK $G(isquick) }
set G(isquick) 1
set ASYNC_INCLUDE {
insert.test
@@ -43,13 +43,22 @@ set ASYNC_INCLUDE {
# Enable asynchronous IO.
sqlite3async_initialize "" 1
# This proc flushes the contents of the async-IO queue through to the
# underlying VFS. A couple of the test scripts identified in $ASYNC_INCLUDE
# above contain lines like "catch flush_async_queue" in places where
# this is required for the tests to work in async mode.
#
proc flush_async_queue {} {
sqlite3async_control halt idle
sqlite3async_start
sqlite3async_wait
sqlite3async_control halt never
}
rename do_test async_really_do_test
proc do_test {name args} {
uplevel async_really_do_test async_io-$name $args
sqlite3async_start
sqlite3async_control halt idle
sqlite3async_wait
sqlite3async_control halt never
flush_async_queue
}
foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
@@ -62,19 +71,13 @@ foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
# [file delete]). If the asynchronous backend still has the file
# open, it will become confused.
#
sqlite3async_control halt idle
sqlite3async_start
sqlite3async_wait
sqlite3async_control halt never
flush_async_queue
}
# Flush the write-queue and disable asynchronous IO. This should ensure
# all allocated memory is cleaned up.
set sqlite3async_trace 1
sqlite3async_control halt idle
sqlite3async_start
sqlite3async_wait
sqlite3async_control halt never
flush_async_queue
sqlite3async_shutdown
set sqlite3async_trace 0
@@ -83,5 +86,5 @@ rename async_really_do_test do_test
rename finish_test {}
rename async_really_finish_test finish_test
if {[info exists ASYNC_SAVE_ISQUICK]} { set ISQUICK $ASYNC_SAVE_ISQUICK }
if {[info exists ASYNC_SAVE_ISQUICK]} { set G(isquick) $ASYNC_SAVE_ISQUICK }
finish_test
+5
View File
@@ -14,6 +14,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
# These tests only work for Tcl version 8.5 and later on Windows (for now)
#
if {$tcl_platform(platform)=="windows"} {
+8 -6
View File
@@ -654,12 +654,14 @@ do_test autovacuum-8.1 {
sqlite3 db2 test.db
db eval {PRAGMA auto_vacuum}
} {1}
do_test autovacuum-8.2 {
db eval {BEGIN EXCLUSIVE}
catchsql {PRAGMA auto_vacuum} db2
} {1 {database is locked}}
catch {db2 close}
catch {db eval {COMMIT}}
if {[permutation] == ""} {
do_test autovacuum-8.2 {
db eval {BEGIN EXCLUSIVE}
catchsql {PRAGMA auto_vacuum} db2
} {1 {database is locked}}
catch {db2 close}
catch {db eval {COMMIT}}
}
do_test autovacuum-9.1 {
execsql {
+2 -2
View File
@@ -165,7 +165,7 @@ do_test avtrans-3.14 {
} db} msg]
lappend v $msg
} {0 {1 2 3 4}}
sqlite3_soft_heap_limit $soft_limit
sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)
integrity_check avtrans-3.15
do_test avtrans-4.1 {
@@ -857,7 +857,7 @@ proc signature {} {
# t3 a little larger, and thus takes a little longer, so doing 40 tests
# is more than 2.0 times slower than doing 20 tests. Considerably more.
#
if {[info exists ISQUICK]} {
if {[info exists G(isquick)]} {
set limit 20
} else {
set limit 40
+2
View File
@@ -16,6 +16,8 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_not_use_codec
#---------------------------------------------------------------------
# Test organization:
#
+2
View File
@@ -18,6 +18,8 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_not_use_codec
ifcapable !trigger||!view { finish_test ; return }
# Fill a database with test data.
+2 -1
View File
@@ -68,9 +68,10 @@ do_malloc_test backup_malloc-1 -tclprep {
B finish
} -cleanup {
catch { B finish }
catch { db2 close }
}
do_malloc_test backup_malloc-1 -tclprep {
do_malloc_test backup_malloc-2 -tclprep {
sqlite3 db2 test2.db
} -tclbody {
set rc [catch {sqlite3_backup B db2 temp db main}]
+5
View File
@@ -18,6 +18,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for this file, as the database is manipulated using
# external methods (the [fake_big_file] and [hexio_write] commands).
#
do_not_use_codec
# If SQLITE_DISABLE_LFS is defined, omit this file.
ifcapable !lfs {
finish_test
+4 -4
View File
@@ -28,9 +28,9 @@ proc pager_cache_size {db} {
return $stats(page)
}
do_test cache-1.1 {
pager_cache_size db
} {0}
if {[permutation] == ""} {
do_test cache-1.1 { pager_cache_size db } {0}
}
do_test cache-1.2 {
execsql {
@@ -58,6 +58,6 @@ for {set ii 0} {$ii < 10} {incr ii} {
} $::cache_size
}
sqlite3_soft_heap_limit $soft_limit
sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)
finish_test
+9 -4
View File
@@ -17,6 +17,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
# Return the UTF-16 representation of the supplied UTF-8 string $str.
# If $nt is true, append two 0x00 bytes as a nul terminator.
proc utf16 {str {nt 1}} {
@@ -635,7 +640,7 @@ db close
do_test capi3-6.0 {
sqlite3 db test.db
set DB [sqlite3_connection_pointer db]
sqlite3_key $DB xyzzy
if {[sqlite3 -has-codec]==0} { sqlite3_key $DB xyzzy }
set sql {SELECT a FROM t1 order by rowid}
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
expr 0
@@ -680,7 +685,7 @@ if {![sqlite3 -has-codec]} {
set_file_format 5
} {}
do_test capi3-7.2 {
sqlite3 db test.db
catch { sqlite3 db test.db }
catchsql {
SELECT * FROM sqlite_master;
}
@@ -708,7 +713,7 @@ if {![sqlite3 -has-codec]} {
db close
} {}
do_test capi3-8.3 {
sqlite3 db test.db
catch { sqlite3 db test.db }
catchsql {
SELECT * FROM sqlite_master;
}
@@ -727,7 +732,7 @@ if {![sqlite3 -has-codec]} {
db close
} {};
do_test capi3-8.5 {
sqlite3 db test.db
catch { sqlite3 db test.db }
catchsql {
SELECT * FROM sqlite_master;
}
+1 -1
View File
@@ -141,5 +141,5 @@ do_test capi3b-2.12 {
catch {db2 close}
sqlite3_soft_heap_limit $soft_limit
sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)
finish_test
+9 -4
View File
@@ -19,6 +19,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
# Return the UTF-16 representation of the supplied UTF-8 string $str.
# If $nt is true, append two 0x00 bytes as a nul terminator.
proc utf16 {str {nt 1}} {
@@ -606,7 +611,7 @@ db close
do_test capi3c-6.0 {
sqlite3 db test.db
set DB [sqlite3_connection_pointer db]
sqlite3_key $DB xyzzy
if {[sqlite3 -has-codec]==0} { sqlite3_key $DB xyzzy }
set sql {SELECT a FROM t1 order by rowid}
set STMT [sqlite3_prepare_v2 $DB $sql -1 TAIL]
expr 0
@@ -653,7 +658,7 @@ if {![sqlite3 -has-codec]} {
set_file_format 5
} {}
do_test capi3c-7.2 {
sqlite3 db test.db
catch { sqlite3 db test.db }
catchsql {
SELECT * FROM sqlite_master;
}
@@ -681,7 +686,7 @@ if {![sqlite3 -has-codec]} {
db close
} {}
do_test capi3c-8.3 {
sqlite3 db test.db
catch { sqlite3 db test.db }
catchsql {
SELECT * FROM sqlite_master;
}
@@ -700,7 +705,7 @@ if {![sqlite3 -has-codec]} {
db close
} {};
do_test capi3c-8.5 {
sqlite3 db test.db
catch { sqlite3 db test.db }
catchsql {
SELECT * FROM sqlite_master;
}
+5
View File
@@ -20,6 +20,11 @@ catch {file delete -force test.db test.db-journal test.bu}
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
# Construct a large database for testing.
#
do_test corrupt-1.1 {
+52 -31
View File
@@ -18,6 +18,15 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
set presql ""
catch { set presql "$::G(perm:presql);" }
unset -nocomplain ::G(perm:presql)
# The following tests - corrupt2-1.* - create some databases corrupted in
# specific ways and ensure that SQLite detects them as corrupt.
#
@@ -41,9 +50,10 @@ do_test corrupt2-1.2 {
close $f
sqlite3 db2 corrupt.db
catchsql {
catchsql "
$::presql
SELECT * FROM sqlite_master;
} db2
" db2
} {1 {file is encrypted or is not a database}}
do_test corrupt2-1.3 {
@@ -60,9 +70,10 @@ do_test corrupt2-1.3 {
close $f
sqlite3 db2 corrupt.db
catchsql {
catchsql "
$::presql
SELECT * FROM sqlite_master;
} db2
" db2
} {1 {file is encrypted or is not a database}}
do_test corrupt2-1.4 {
@@ -79,9 +90,10 @@ do_test corrupt2-1.4 {
close $f
sqlite3 db2 corrupt.db
catchsql {
catchsql "
$::presql
SELECT * FROM sqlite_master;
} db2
" db2
} {1 {database disk image is malformed}}
do_test corrupt2-1.5 {
@@ -101,9 +113,10 @@ do_test corrupt2-1.5 {
close $f
sqlite3 db2 corrupt.db
catchsql {
catchsql "
$::presql
SELECT * FROM sqlite_master;
} db2
" db2
} {1 {database disk image is malformed}}
db2 close
@@ -115,7 +128,8 @@ do_test corrupt2-2.1 {
copy_file test.db corrupt.db
sqlite3 db2 corrupt.db
execsql {
execsql "
$::presql
CREATE INDEX a1 ON abc(a);
CREATE INDEX a2 ON abc(b);
PRAGMA writable_schema = 1;
@@ -123,13 +137,14 @@ do_test corrupt2-2.1 {
SET name = 'a3', sql = 'CREATE INDEX a3' || substr(sql, 16, 10000)
WHERE type = 'index';
PRAGMA writable_schema = 0;
} db2
" db2
db2 close
sqlite3 db2 corrupt.db
catchsql {
catchsql "
$::presql
SELECT * FROM sqlite_master;
} db2
" db2
} {1 {malformed database schema (a3) - index a3 already exists}}
db2 close
@@ -139,7 +154,8 @@ do_test corrupt2-3.1 {
file delete -force corrupt.db-journal
sqlite3 db2 corrupt.db
execsql {
execsql "
$::presql
PRAGMA auto_vacuum = 1;
PRAGMA page_size = 1024;
CREATE TABLE t1(a, b, c);
@@ -149,7 +165,7 @@ do_test corrupt2-3.1 {
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t2 SELECT * FROM t2;
} db2
" db2
db2 close
@@ -168,9 +184,10 @@ do_test corrupt2-3.1 {
close $fd
sqlite3 db2 corrupt.db
catchsql {
catchsql "
$::presql
DROP TABLE t1;
} db2
" db2
} {1 {database disk image is malformed}}
do_test corrupt2-4.1 {
@@ -187,7 +204,8 @@ do_test corrupt2-5.1 {
file delete -force corrupt.db-journal
sqlite3 db2 corrupt.db
execsql {
execsql "
$::presql
PRAGMA auto_vacuum = 0;
PRAGMA page_size = 1024;
CREATE TABLE t1(a, b, c);
@@ -198,7 +216,7 @@ do_test corrupt2-5.1 {
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t2 SELECT * FROM t2;
INSERT INTO t1 SELECT * FROM t2;
} db2
" db2
db2 close
@@ -219,6 +237,7 @@ do_test corrupt2-5.1 {
close $fd
sqlite3 db2 corrupt.db
db2 eval $::presql
db2 eval {SELECT rowid FROM t1} {
set result [db2 eval {pragma integrity_check}]
break
@@ -242,6 +261,7 @@ proc corruption_test {args} {
file delete -force corrupt.db-journal
sqlite3 db corrupt.db
db eval $::presql
eval $A(-tclprep)
db eval $A(-sqlprep)
db close
@@ -276,7 +296,7 @@ ifcapable autovacuum {
hexio_write corrupt.db [expr 1024*5] 00000008
} -test {
do_test corrupt2-6.1 {
catchsql { pragma incremental_vacuum = 1 }
catchsql " $::presql pragma incremental_vacuum = 1 "
} {1 {database disk image is malformed}}
}
@@ -297,7 +317,7 @@ ifcapable autovacuum {
hexio_write corrupt.db [expr 1024*2 + 8] 00000009
} -test {
do_test corrupt2-6.2 {
catchsql { pragma incremental_vacuum = 1 }
catchsql " $::presql pragma incremental_vacuum = 1 "
} {1 {database disk image is malformed}}
}
@@ -318,7 +338,7 @@ ifcapable autovacuum {
hexio_write corrupt.db [expr 1024 + ($nPage-3)*5] 010000000
} -test {
do_test corrupt2-6.3 {
catchsql { pragma incremental_vacuum = 1 }
catchsql " $::presql pragma incremental_vacuum = 1 "
} {1 {database disk image is malformed}}
}
@@ -337,10 +357,11 @@ ifcapable autovacuum {
hexio_write corrupt.db 28 00000000
} -test {
do_test corrupt2-6.4 {
catchsql {
catchsql "
$::presql
BEGIN EXCLUSIVE;
COMMIT;
}
"
} {1 {database disk image is malformed}}
}
}
@@ -374,7 +395,7 @@ corruption_test -sqlprep $sqlprep -corrupt {
close $fd
} -test {
do_test corrupt2-7.1 {
catchsql { SELECT b FROM t1 ORDER BY b ASC }
catchsql " $::presql SELECT b FROM t1 ORDER BY b ASC "
} {1 {database disk image is malformed}}
}
@@ -395,7 +416,7 @@ corruption_test -sqlprep $sqlprep -corrupt {
close $fd
} -test {
do_test corrupt2-7.1 {
catchsql { SELECT b FROM t1 ORDER BY b DESC }
catchsql " $::presql SELECT b FROM t1 ORDER BY b DESC "
} {1 {database disk image is malformed}}
}
@@ -413,7 +434,7 @@ corruption_test -sqlprep $sqlprep -corrupt {
close $fd
} -test {
do_test corrupt2-8.1 {
catchsql { SELECT * FROM t1 WHERE rowid=1000 }
catchsql " $::presql SELECT * FROM t1 WHERE rowid=1000 "
} {1 {database disk image is malformed}}
}
@@ -441,7 +462,7 @@ corruption_test -sqlprep {
close $fd
} -test {
do_test corrupt2-9.1 {
catchsql { SELECT sql FROM sqlite_master }
catchsql " $::presql SELECT sql FROM sqlite_master "
} {1 {database disk image is malformed}}
}
@@ -452,7 +473,7 @@ corruption_test -sqlprep {
UPDATE sqlite_master SET rootpage = NULL WHERE name = 't2';
} -test {
do_test corrupt2-10.1 {
catchsql { SELECT * FROM t2 }
catchsql " $::presql SELECT * FROM t2 "
} {1 {malformed database schema (t2)}}
do_test corrupt2-10.2 {
sqlite3_errcode db
@@ -477,7 +498,7 @@ corruption_test -sqlprep {
hexio_write corrupt.db 24 12345678
} -test {
do_test corrupt2-11.1 {
catchsql { PRAGMA incremental_vacuum }
catchsql " $::presql PRAGMA incremental_vacuum "
} {1 {database disk image is malformed}}
}
corruption_test -sqlprep {
@@ -498,7 +519,7 @@ corruption_test -sqlprep {
hexio_write corrupt.db 24 12345678
} -test {
do_test corrupt2-12.1 {
catchsql { PRAGMA incremental_vacuum }
catchsql " $::presql PRAGMA incremental_vacuum "
} {1 {database disk image is malformed}}
}
@@ -516,7 +537,7 @@ ifcapable autovacuum {
INSERT INTO t1 VALUES(NULL, randstr(50,50));
}
for {set ii 0} {$ii < 10} {incr ii} {
db eval { INSERT INTO t1 SELECT NULL, randstr(50,50) FROM t1 }
db eval " $::presql INSERT INTO t1 SELECT NULL, randstr(50,50) FROM t1 "
}
} -corrupt {
do_test corrupt2-13.1 {
+2
View File
@@ -18,6 +18,8 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
if {[sqlite3 -has-codec]} { finish_test ; return }
# We must have the page_size pragma for these tests to work.
#
ifcapable !pager_pragmas {
+5
View File
@@ -18,6 +18,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
# We must have the page_size pragma for these tests to work.
#
ifcapable !pager_pragmas {
+5
View File
@@ -19,6 +19,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
# We must have the page_size pragma for these tests to work.
#
ifcapable !pager_pragmas {
+5
View File
@@ -19,6 +19,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
# We must have the page_size pragma for these tests to work.
#
ifcapable !pager_pragmas {
+5
View File
@@ -19,6 +19,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
# We must have the page_size pragma for these tests to work.
#
ifcapable !pager_pragmas||!autovacuum {
+5
View File
@@ -19,6 +19,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
# We must have the page_size pragma for these tests to work.
#
ifcapable !pager_pragmas {
+5
View File
@@ -25,6 +25,11 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts (using the [hexio_write] command).
#
do_not_use_codec
do_test corruptB-1.1 {
execsql {

Some files were not shown because too many files have changed in this diff Show More