1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00
Commit Graph

14444 Commits

Author SHA1 Message Date
drh
f10c535fa5 The fts3_tokenizer() function returns NULL if the
SQLITE_DBCONFIG_ENABLE_FTS_TOKENIZER setting is disabled, which is is
by default.

FossilOrigin-Name: f5732f4caf7a37a6445c61ae0d0ac14cc9deb897376e73aa36a1ead025b92c69
2019-03-01 21:33:29 +00:00
drh
10cc16c954 Fix a minor comment typo. No code changes.
FossilOrigin-Name: 9a0a93c89d3fdd0f9000a9226388e2e53f299165e043913f40b83bf597bfea04
2019-03-01 21:12:40 +00:00
drh
b531aa8fd9 In a query that uses a partial index, the expression that is the WHERE clause
of the partial index must always be true.  Use this fact to avoid evaluating
identical terms in the WHERE clause of the query.

FossilOrigin-Name: 9b2879629c34fc0a8e99d94648903eb93aabbc7a3682c80cb7382f9a9ca5ffb7
2019-03-01 18:07:05 +00:00
drh
9cb0264041 Add the ".parameter" command to the CLI.
FossilOrigin-Name: 1f9fa58541dc974989eee9c9a5d453956f7dbcf42965ece2db2cb5dee3f3f5e2
2019-02-28 20:10:52 +00:00
drh
c06ede105d Add the new "bind_fallback" method to the "sqlite3" object in the TCL
interface.

FossilOrigin-Name: c7f70b6d96338dba201e005104e7f7148c1a8cd767ab05e35b44617c4c797bc5
2019-02-28 17:29:19 +00:00
drh
45616c7f75 Add an "|| CORRUPT_DB" term to an assert() statement in the btree defragmenter.
FossilOrigin-Name: 6bfd8655f006e031c0d4c988356c4b9206efa6bfdb034fde8ffa3361521a4844
2019-02-28 13:21:36 +00:00
drh
8e0f794d17 Enable the LIKE optimization when the ESCAPE keyword is present and the
PRAGMA case_sensitive_like pragma is ON.

FossilOrigin-Name: 6ae4b8c525f446ddb0e0bdd5e4e01e06e2ab975e3effa42fce6a1102b3a39830
2019-02-27 23:05:14 +00:00
dan
89d249364e Add the "-returntype" option to the "db function" Tcl method.
FossilOrigin-Name: 789a492b68c353e2b763d67d399722b7ab61bfe09b472466df2821f65cab1be9
2019-02-27 16:38:19 +00:00
drh
5cb1ffc1bd Allocate a few extra bytes for the pager temp page as an overrun buffer while
processing corrupt database files.

FossilOrigin-Name: e7aca0714bc475e04b16e9db78722ce025d2a1382f80cfc0a49cff2af904eae5
2019-02-26 17:49:07 +00:00
drh
eaac9996ed Use unsigned integers to count the number of pages in a freelist during
an integrity_check, to avoid any possibility of a signed integer overflow.

FossilOrigin-Name: 05b87e0755638d31f6d8918f8758362f8c3981661449b5171180a8498f66bd9d
2019-02-26 16:17:06 +00:00
drh
2b454e0335 Fix a harmless compiler warning that only comes up during debug builds.
FossilOrigin-Name: 848869ced988ca4d0ac76d43f984360fd11997a580719cccf8d55becea4e8fb1
2019-02-26 16:11:46 +00:00
drh
8b738d0865 Enhance the command-line shell to accept bound parameters, using the
TEMP table named "$Parameters" to look up the values for bound parameters.

FossilOrigin-Name: 7c941ce5bcc872ec92cbe0e409fd773f44a5ab1f814e689ad57f756b911e2b96
2019-02-25 18:43:54 +00:00
drh
7edcb11ca7 Fix a typo in the documentation for sqlite3_total_changes().
FossilOrigin-Name: 8474c1560e0c3a28c6a7ed360202a8e7caae3c8259f60bbfa6d2948ab7876f51
2019-02-25 14:16:19 +00:00
drh
4bdd26dfab Remove a testcase() macro which is now unreachable due to the contraction of
the use of IN_INDEX_ROWID.

FossilOrigin-Name: 90c5a17cd526b256753f876e575f3e731d5e8b9dd6e196cf8d8f7306e099b91c
2019-02-23 00:08:09 +00:00
drh
50ef6716d2 Make all ephemeral tables built to hold the RHS of an IN operator be
index-btrees, never table-btrees, regardless of whether or not they are
used as IN_INDEX_LOOP or IN_INDEX_MEMBERSHIP.  That way, the same ephmerial
table can be reused for both cases.

FossilOrigin-Name: c2d50df8fd1a1fdae6226a3e77296ded09b53a74540caedd4868e686a93cbc10
2019-02-22 23:29:56 +00:00
drh
bc0a55cf0b Check-in [fa792714ae62fa980] is not a valid fix for ticket
[df46dfb631f75694], as the new test case in this check-in demonstrates.
The fix here causes test cases for the [df46dfb631f75694] bug to fail
again, so this check-in is on a branch.  A new fix is needed for
[df46dfb631f75694].

FossilOrigin-Name: 0d456456da6e25b20d9d27ca95f1013082bca52ee74ee9bf91732a9fa843ea45
2019-02-22 21:33:56 +00:00
dan
f030b37682 Internally, remove all references to a Window object that belongs to an expression in an ORDER BY clause if that expression is converted to an alias of a result-set expression. Fix for [4feb3159c6].
FossilOrigin-Name: 579b66eaa0816561c6e47ea116b46f229188f0fc84c1173bfe0d21df2dff9a9a
2019-02-22 19:24:16 +00:00
drh
480c572f2d In sqlite3NestedParse() be sure to detect all SQLITE_NOMEM and SQLITE_TOOBIG
errors and to distinguish between them.

FossilOrigin-Name: 73056b314bd63288c662752e9bd469b70264c38031c1c857460e64fdb1ed4e2e
2019-02-22 16:18:12 +00:00
drh
255a81f10a Modify sqlite3_str_finish() and sqlite3VMPrintf() so that they always
return NULL on any OOM or SQLITE_LIMIT_LENGTH error.

FossilOrigin-Name: e7144ffd21294d7aebbfa6aa5a262797a6d16de11193f1bf6b75f5f27b04c940
2019-02-22 15:42:10 +00:00
drh
dbdddc99d8 Detect oversized strings in the OP_String opcode even if the P4 argument
is originally UTF8 and has to be converted to UTF16 to match the database
file and that conversion causes the string to become shorter and cross
below SQLITE_LIMIT_LENGTH threshold.  This might fix an OSSFuzz problem
that we have been so far unable to reproduce.

FossilOrigin-Name: c13d563925db12bc2c91ff9432050261e5bd39d960e2739777a66bf804df2e31
2019-02-21 16:41:34 +00:00
drh
6a1bfc9a6d Changes to the unix VFS that allegedly enable it to build of Fuchsia.
We have no way of testing this.

FossilOrigin-Name: be21a6416d47ff7db995006a0422b745044d9b8bb5bad3c53342aa6e2e524771
2019-02-20 19:20:16 +00:00
drh
8cf92890f2 Avoid the use of function pointers in columnName(), as function pointers
appear to be a source of consternation to LLVM.

FossilOrigin-Name: c48f6f39c5f89a338fed7153553a27a5d882d4d8db8221e911b96e0dd57c53d9
2019-02-20 18:13:57 +00:00
drh
b1af9c603c Progress handler improvements:
(1) Invoke the callback after OP_Program opcodes
(2) Invoke the callback multiple times in a row to catch up after a
long run of no progress checks.

FossilOrigin-Name: 0c5db18d79366d9c23925ce3ed835500311f32a10aa7dbfdd09148b1e8a2507b
2019-02-20 13:55:45 +00:00
drh
042666e4fa When an IN operator drives a query loop, mark it as "CODED" so that it
will not be used afterwards for a (pointless) membership test.  This is
a better fix for ticket [df46dfb631f75694] than the previous fix that is
now on a branch as it preserves the full optimization of
check-in [e130319317e76119].

FossilOrigin-Name: fa792714ae62fa980f1767acc6d622a6727ceb677870243c88548423795dcb5b
2019-02-20 12:52:47 +00:00
drh
12fe9a0d25 Fix an assert() that might not be true if the database file is corrupt.
FossilOrigin-Name: f2d400db4dbfb05e2540178ed3662f97f8c57a95f8129886c7081c35e53adf0d
2019-02-19 16:42:54 +00:00
drh
3cbd2b7245 New assert() to verify the TF_HasprimaryKey flag.
FossilOrigin-Name: 0abace8a7aecca01c8677d07f3ec1bafb289ceffe5bcd60284701a7bf813f415
2019-02-19 13:51:58 +00:00
drh
9df385ec3d Always use the symbolic name SQLITE_IDXTYPE_PRIMARYKEY rather than a hard-coded
magic number 2.

FossilOrigin-Name: 55d43adc894a6b1e0f77bf481dad6dd604a0dc0022e72bbf2e3037f97351971e
2019-02-19 13:08:35 +00:00
drh
56785a0a80 Fix an assert() that might be false for a corrupt database.
FossilOrigin-Name: 0cfb888723fb8ff0763bbc23acb7d21a53f6d1c40661d8468248644281b29d85
2019-02-16 22:45:55 +00:00
dan
e7c9ca41b2 Add support for chaining of WINDOW definitions.
FossilOrigin-Name: c155125fd5dddb438c09d40f5137c47d88defb7a6ede4261f09d7bdaad250d37
2019-02-16 17:27:51 +00:00
drh
9c7e44cddd Improved oversized cell detection when updating ptrmap pages in
balance_nonroot().

FossilOrigin-Name: aa61435a4c3800f023788081c1342ad6a05a41449a424fa6c039d5ca46072256
2019-02-14 15:27:12 +00:00
drh
82642f815b Ensure that the nProgressLimit variable is always initialized in
sqlite3VdbeExec(), even if the routine jumps to its exit processing early.

FossilOrigin-Name: 167b91df77fff1a84791f6ab5f72239b90475475be690a838248119b6dd312f0
2019-02-12 22:58:32 +00:00
drh
c332e04310 Enhancement the progress callback mechanism so that the progress callback
is always invoked at least once at the end of a prepared statement if the 
opcode count has been exceeded.  This makes the progress callback more
effective at limiting run times.  This check-in also includes and unrelated
performance enhancement to OP_Column.

FossilOrigin-Name: 68cce272e7f7cbc0c319ee8b7ff674d652cb1e95e903d99d848c41dff2b5d304
2019-02-12 21:04:33 +00:00
drh
5860a61d59 Further performance improvements to btreeInitPage().
FossilOrigin-Name: 93ae382e97c23c90312739481e47ef7f9bc475a8382c063a2de2986c950c0aec
2019-02-12 16:58:26 +00:00
drh
3e7800a9db Defer computing the number of bytes of free space on a btree page until that
value is actually needed.

FossilOrigin-Name: 177f5f40eabfcfd229ac7f291dfed9e9ee35762e86923a0f356915f389da177d
2019-02-12 01:04:49 +00:00
drh
a941ff712d Change an assert() into a NEVER(), since the condition is difficult to prove
with certainty.  Improved comment on the MemPage.nFree field.

FossilOrigin-Name: fec071b89df2cbafda365077bb54bc9999e12086f36d6cea8d125662b36638dc
2019-02-12 00:58:10 +00:00
drh
8357c662b3 Do not invoke btreeComputeFreeSpace() when not necessary.
FossilOrigin-Name: f11b0ed47402034378ded2c60b82841b81cd1319cdb72d1ef052faef29a5294d
2019-02-11 22:50:01 +00:00
drh
d4a6744b50 Improvements to comments. No changes to code.
FossilOrigin-Name: 16eb0fc8f8cce51eaa5305ebc9f3bd8c8d935dd3ebebab6820e5629f9292eec2
2019-02-11 19:27:36 +00:00
drh
6813350966 Fix test cases. Avoid unnecessary tests for MemPage.nFree less than zero.
FossilOrigin-Name: 480a5090befdc29eaeb6f0b22831c980d6ee92438d9b2e766de68b037ded38b8
2019-02-11 17:22:30 +00:00
drh
c01f41cfa6 Updates to a comment to keep it in alignment to the changes on this branch.
FossilOrigin-Name: 7499f74351415e601eb48eff6b6fccd3a78d137f5ea9cd7cac46b904772966de
2019-02-11 12:51:39 +00:00
dan
8cd2e4ae03 Build and test fixes for SQLITE_OMIT_WINDOWFUNC builds.
FossilOrigin-Name: 8824115a9776e876a3677f0cb479e311ee65584d43872b37766a146afec72d8f
2019-02-11 11:34:01 +00:00
dan
3fd7eaf3f2 Avoid using non-ANSI return statement in void function sqlite3WalSnapshotUnlock().
FossilOrigin-Name: 4a4952d38e8177ed8d59aaa575410bebf76787dd6d801fdbdb809d4f8c670da0
2019-02-11 11:04:17 +00:00
drh
f0c48b1cd8 Add an assert() in an attempt to repro an ASAN warning from OSSFuzz.
FossilOrigin-Name: 7b41222428dcebaae2e9a0e8192e091b6fdee5b1163a5fa14ca1cd4f06354983
2019-02-11 01:58:34 +00:00
drh
85a379b74b Fix a page-cache reference leak in the btree balancer when there is a corrupt
database.

FossilOrigin-Name: 9285899120dec24ff2944431ad455d7ae217ef408ae2f1a3e7bdfb897099028c
2019-02-09 22:33:44 +00:00
drh
b0ea9432a1 Defer computing the MemPage.nFree value of an in-memory btree page
until it is actually needed, since for many pages it is never needed.
This checkin works sufficiently to prove the concept, but still has issues
with exception handling.

FossilOrigin-Name: 1d43ee4000b71f5c6d49244dee96358c567f09ba3451b9d22895a796d3f61ad6
2019-02-09 21:06:40 +00:00
drh
298f45c641 Small performance improvement and size reduction for pageFindSlot() - the
routine in btree.c that locates a free slot for a cell on a btree page.

FossilOrigin-Name: 1969372ac72d25cc642a0268f4bb0ae4b59f2dca568c119ef61b67183b3a8bd9
2019-02-08 22:34:59 +00:00
drh
16d7e87caa Further simplifications to sqlite3VdbeMemSetStr().
FossilOrigin-Name: 1d212957079a2caa30f3c9d80f43464781bc9634c2b5181a5814efbddae31711
2019-02-08 17:28:20 +00:00
drh
6ff7427733 Change the sqlite3VdbeMemGrow() routine so that it no longer guarantees a
minimum size of 32 bytes.  That minimum is no longer required, and without
the extra check for the minimum size, the routine runs faster.

FossilOrigin-Name: 5c499da8a4d0babc56883aa362ae124772fd9214a51169a88a5dee523d051658
2019-02-08 15:59:20 +00:00
drh
1cf197583d Give the sqlite3 object a pointer to the current Parse so that if an OOM
occurs, it can automatically set the Parse.rc value to SQLITE_NOMEM.  This
avoids a frequent extra test of db.mallocFailed in the innermost parser loop.

FossilOrigin-Name: 5c6638040b3017c6be016441422d965a3ca00dd6ae1f78cadc0b54562978f64e
2019-02-08 14:55:30 +00:00
drh
8851e10017 Do not do the optimization that attempts to pull expression values from
an index on that expression when processing a multi-index OR
(see check-in [a47efb7c8520a0111]) because the expression transformations
that are applied become invalid when the processing moves off of the current
index and on to the next index.  Fix for ticket [4e8e4857d32d401f].

FossilOrigin-Name: 440a7cda000164d3b46109caf2e1dde80681ba9b0d94ba9be6847d2b917445cf
2019-02-08 04:15:19 +00:00
drh
24bfecab3c Experimental change to VACUUM so that it preserves existing ROWID values.
FossilOrigin-Name: f264015f84de51d74f681ba62a5f26bd859480d93e1eaf9e1018b3e9b4e0bea3
2019-02-07 15:09:44 +00:00