Commit Graph

18477 Commits

Author SHA1 Message Date
drh 908cc6207f Merge recent enhancements from trunk.
FossilOrigin-Name: 76373091354f27577e5235e96cfaa4b31429a38d1e0e1d6e094c4cc323b92a0a
2017-12-27 19:27:26 +00:00
drh 2c804becea Enhance the Lemon parser generator so that it creates a faster parser at the
cost of slightly larger parser tables.  Add the ability to measure coverage
of the generated state machine when compiling with the -DYYCONVERGE option.
In SQLite, add the SQLITE_TESTCTRL_PARSER_COVERAGE test-control to query the
new parser coverage feature.

FossilOrigin-Name: 1b22b42e59793af19c69a2e5f6822883cc2687d4a0d9b9280bbff885276c6baa
2017-12-27 18:19:06 +00:00
drh cf8e0e9cb7 The previous check-in had an error in the coverage reporting logic.
FossilOrigin-Name: ec9b19eb652e81cd3c8a5595eb39aac3aca4abe72136c4b65c9cc257594a9c92
2017-12-27 17:36:58 +00:00
drh 7038a991b0 Change the coverage measurement logic in the lemon-generated parser so that
it only checks for coverage of state/lookahead pairs that are valid syntax.
It turns out that some states are unreachable if the lookahead is not valid
syntax, because the states are only reachable through a shift following a
reduce, and the reduce does not happen if the lookahead is a syntax error.

FossilOrigin-Name: 9dce46508772bd0f9e940c4d44933154044bb58c1b3511dd0143287bf795dd6b
2017-12-27 17:14:50 +00:00
drh 7e7b753158 In the lemon-generated parser, do not report the End-of-input character and
the wildcard character as missed coverage.

FossilOrigin-Name: 3fe964873da16c0e0b1c4f1945f965d4137df7a307acd6a3eb6585ffbaa2afd1
2017-12-27 16:13:22 +00:00
drh 4396c61959 In LEMON, fix an off-by-one error that can make the lookahead table one
byte too smal.

FossilOrigin-Name: 93792bc58a2eccc7e07b14307388350bb376db32c5055b79a44e4fa8ff91d58e
2017-12-27 15:21:16 +00:00
drh 22716cbb0b Change the lemon-parser coverage report format to report all state/lookahead
pairs and indicate on each whether it is hit or missed.

FossilOrigin-Name: 86e30fc284c740b55f75884b67988fe837b28878f586f6ec8850ecf80164e700
2017-12-26 18:32:06 +00:00
drh 4fb5c2dcc1 Merge bug fixes from trunk.
FossilOrigin-Name: d76e12066fa6950f877cbe33b1892e2b0afa948978815d5b9a90cde1fff8ec98
2017-12-26 18:14:53 +00:00
drh 0d9de99c5c Add support for measuring and reporting coverage of the parser state machine
using the SQLITE_TESTCTRL_PARSER_COVERAGE test-control.

FossilOrigin-Name: 1253a872dbf48656d4efd588ab61223a5ac550d9b2b932249d6ba585276ba573
2017-12-26 18:04:23 +00:00
drh 02a43f6def Faster and smaller implementation of sqlite3AtoF() based on a suggestion
from Cezary H. Noweta.

FossilOrigin-Name: fd2e0e7a770c2ce9355068aad1024c3d2861c104fd3be304a91c55ca742155fa
2017-12-26 14:46:20 +00:00
dan c8f44d245c Fix crashes that could occur if SQL NULL values were passed to the built-in
FTS5 snippet function. Edit: breaks amalgamation builds.

FossilOrigin-Name: 6a790b67a0a5c698526db16ea262b13ecdd1b6ca74e80bdccfcad88ddbdc933a
2017-12-26 14:32:25 +00:00
dan f6c37dbc8c Add options to speedtest1.c and speed-check.sh for testing performance of
floating-point computatations.

FossilOrigin-Name: ebfea8728fec955b1d74b1d0a3de498fd1a32e8b39572a8fdab606ed87b169b4
2017-12-26 14:30:44 +00:00
drh 5060a67c4d Fix an assertion fault on a syntax error input caused by check-in
[6b2ff26c25bb9da3].  Problem discovered by OSSFuzz.

FossilOrigin-Name: 90d6e4f10d3055a776d24854c442a2a68e726af8fc382cdb6241a834082e4c4c
2017-12-25 13:43:54 +00:00
drh 3a9d6c7156 Enhance LEMON so that it generates the action table in such a way that no
range check is needed on the lookahead table to verify that the next input
token is valid.  This makes the lookahead table slightly larger (about 120
bytes) but helps the parser to run faster.

FossilOrigin-Name: 7eb0198d0102e97e4b7ad9e359d95985e55e09c510ea4b360265ac8feb9ed814
2017-12-25 04:15:38 +00:00
drh ef53a9f0af In the LEMON-generated parser, avoid unnecessary tests for the acceptance
state.

FossilOrigin-Name: fdbb35c54f2b6cb65d04ac295f207ff3e69360e0558348c77eb5e62691807046
2017-12-25 00:10:05 +00:00
drh 5c8241b875 In the LEMON-generated parser, rearrange the meanings of integer action codes
so that reduce actions occur last.  This means that the most common case
(reduce actions) can be recognized with a single comparison operation, thus
speeding up the main parser loop, slightly.

FossilOrigin-Name: 7bfe7a360261ac7227840db49487c2f0fe338a2f1b868fcaada1e04a8d2b8f7a
2017-12-24 23:38:10 +00:00
drh 512795dfea Fix a NULL pointer dereference after a syntax error that can occur as a
result of check-in [6b2ff26c25bb9da3] yesterday.  This problem was
discovered by the OSSFuzz.

FossilOrigin-Name: d49afb8f9804e96662d1e3cadc4c6643908706d848a53d5ed019919c98f2ccba
2017-12-24 18:56:28 +00:00
drh e58f74f680 Improved parser tracing output.
FossilOrigin-Name: 25be5750545b7b0ed9e1a1baca31611b354519688f875aa1590b21bb6ff42f1b
2017-12-24 17:06:41 +00:00
drh d3f5d6110b Grammar changes: the sclp non-terminal should always be followed by a scanpt.
FossilOrigin-Name: 74a0181fc016fb0b7934188cfcc2ec26c689f0d33cc42453875f4392b7240d3a
2017-12-24 17:01:54 +00:00
drh ec64c6cfd2 Improved parser tracing output.
FossilOrigin-Name: c4951833c2b976223c2393d82fd2606068c71cd19612ca9df4e26debab980e32
2017-12-24 14:14:21 +00:00
drh 1be266ba08 Remove the ExprSpan object. Instead, keep track of the test of subphrases in
the parse using the "scanpt" non-terminal.

FossilOrigin-Name: 3eab7bdc44e0878b83dc86f27058a40c2ffafeacadc566f03693f6dc7e40a504
2017-12-24 00:18:47 +00:00
drh 88a921ce60 Simplification to the error handling logic in the extension loader.
FossilOrigin-Name: 07c773148d8db185fa54991df09298b64f4fef28879e6c9395759265e8183977
2017-12-23 14:39:36 +00:00
drh ab42a2fe8e Improve the error message that comes back when sqlite3_load_extension()
fails because the named file exists but is not a valid shared library.

FossilOrigin-Name: 05fee1a21ea398f1e4d6f1cf361657eff25ed6cd8f85ab398262dcfd30da57e9
2017-12-23 13:55:43 +00:00
drh 755b0fd358 Move the generation of output column names earlier in the case of a
CREATE TABLE AS.  This is a fix for ticket [3b4450072511e62] and a
continuation of check-in [ade7ddf1998190b2b63] that fixes cases of
ticket [de3403bf5ae5f72ed6] that were missed previously.

FossilOrigin-Name: 6b2ff26c25bb9da344add79c93fb3e49fa034a89b38ef56e08e18d21de61f707
2017-12-23 12:33:40 +00:00
drh 07859486c6 Add a SELECTTRACE() macro to indicate when column names are assigned to
a SELECT statement.  This helps with debugging for tickets like
[de3403bf5ae5f72e] and [3b4450072511e621].

FossilOrigin-Name: 8f194008c3aaa4ef287200e37bc5278ba9c377a7091ee3f95bad66513226b083
2017-12-23 11:51:40 +00:00
drh 5a699a01ca In the sqlite3TreeViewExprList() routine, show the "AS" alias name for
each expression in the list, if it exists.

FossilOrigin-Name: 5efd854fe21470336ba4140294b6c90ef39af32e103b92c664438d7485c50f9a
2017-12-22 19:53:02 +00:00
drh efc88d020c Modify the new sqlite3_vtab_collation() interface so that it takes a
pointer to the sqlite3_index_info object passed into xBestIndex rather than
an sqlite3 connection pointer, which the xBestIndex method might not have
access to.

FossilOrigin-Name: 5c1fe6666019147a26480b5db1bf2f474a5d072c234c736f16ed5d2a9a040b3f
2017-12-22 00:52:50 +00:00
drh ef7231b865 Fix SQLITE_DBCONFIG_TRIGGER_EQP so that it works even if SQLITE_DEBUG is
not defined.

FossilOrigin-Name: afbbfff72002089fa73b5473cc98360df14288d489e93e667332d6e884ef60da
2017-12-21 21:41:13 +00:00
drh ada7045eab Add the ".eqp trigger" option to the ".eqp" command in the command-line
shell.  Implemented using the new SQLITE_DBCONFIG_TRIGGER_EQP control.

FossilOrigin-Name: 2c51644a12a638d89e4f7cc3fd561236ce424f2d4e1db31f1e8388f77add02b8
2017-12-21 21:02:27 +00:00
dan 2e1ea57f8b Add the ".expert" command to the shell tool's ".help" output.
FossilOrigin-Name: fc6193af5d216b4066fbc47e75a7d0538fd5fda40b94ee15e2ff4037ea89221b
2017-12-21 18:55:24 +00:00
drh 36e31c6915 Change the name of SQLITE_DBCONFIG_FULL_EQP to be SQLITE_DBCONFIG_TRIGGER_EQP
(which we can do without breaking compatibility because the former name has
not yet appeared in an official release) and streamline its implementation.

FossilOrigin-Name: fffc7685d19f78ec322a4e834ad727af20a17e2e1c35680e4b1c4162c4786f60
2017-12-21 18:23:26 +00:00
drh 3c5d285762 Add the SQLITE_DBCONFIG_MAX preprocessor macro which will always be equal to
the largest SQLITE_DECONFIG value.

FossilOrigin-Name: 95d4103348d14f9d4c3fee30bd1d882f717b047b2b92f8fef52bec4878281907
2017-12-21 14:46:11 +00:00
drh fafd6fbb49 Add the experimental ".expert" command to the sqlite3.exe shell.
FossilOrigin-Name: 0821bae7afefed98102c81104b4a477e81816bb1f43353c80865411771e3c5a7
2017-12-21 02:17:02 +00:00
drh 0872e268ab Lowercase local variable names in the SHA3 extension in order to avoid
collisions with macros in termios.h.

FossilOrigin-Name: 3ec7371161bd617e40328aa015b09acc2b37b0b5d269a87050a0c57163f92801
2017-12-20 23:46:29 +00:00
dan e42e1bc594 Fix crash in sqlite3_vtab_collation() when called for an IS NOT NULL
constraint.

FossilOrigin-Name: ad38d2c4f073705c02c7b38675e8ae86fe4a794d54eb796e7ed51a905824d5f5
2017-12-19 18:56:28 +00:00
dan 43efc18669 Experimentally add the SQLite expert functionality to the shell tool.
FossilOrigin-Name: 51068dbaeaef13bb80af8126b8c4f3a454dee63de5127d706db50bf789533e60
2017-12-19 17:42:13 +00:00
dan ebeffef36c Add the sqlite3_vtab_collation() function, which allows an xBestIndex callback
to determine the collation sequence that SQLite will use for a comparison. And
the SQLITE_DBCONFIG_FULL_EQP configuration option, which enhances the output
of "EXPLAIN QUERY PLAN" so that it includes statements run by triggers. And
the code for the sqlite3_expert extension and command line application.

FossilOrigin-Name: 4c782c950204c09c1d8f857c39c4cf476539ec4e7eee6fd86419d47cf0f8b9e0
2017-12-16 19:36:52 +00:00
dan 11546779b7 Merge latest trunk changes into this branch.
FossilOrigin-Name: d5b597b52a1213cdf382d96f4df3535727be0852b25bafd12bbef54da946c5f2
2017-12-16 19:16:24 +00:00
drh 468c649331 Add unnecessary initializations to some local variables in the rtree module
to suppress false-positive compiler warnings coming out of MSVC.

FossilOrigin-Name: 64487d658cb3b6c8c67f1e198c70813c963de52599f3ea974bdc2aa432e74de9
2017-12-16 04:37:15 +00:00
dan 2c44e370f1 Enhance the "swarmvtab" extension. See header comments in ext/misc/unionvtab.c
for details.

FossilOrigin-Name: 01c173651ab22b7b0c139eded6f2ad8504efd09088df8ae6a3471230ebf2306f
2017-12-15 20:21:17 +00:00
drh 087316ceec In the LEMON parser generator, provide reduce actions with access to the
lookahead token.

FossilOrigin-Name: 42af190f4f86ad60de02800054010fafd484ac86ca41e2a13799b2e583eea98c
2017-12-15 12:22:21 +00:00
drh 84a6c85c64 In valueFromExpr() only generate a OOM fault if there have been now prior
faults.

FossilOrigin-Name: 3765aaf712998af5ffb6bc680a0c1419f2b5deb47ecbc1835ba5879127c4dbe3
2017-12-13 23:47:55 +00:00
mistachkin 3384ccb8bb Add support for the 'lsm1.c' target in the MSVC makefile.
FossilOrigin-Name: 6de21deac469ab25378656f6f58115a92f5892428c6f2f3545c9bafac37e4a41
2017-12-13 22:42:55 +00:00
drh 258dfe48cf An improved way of generating the SQLITE_READONLY_DIRECTORY error.
The error message submitted to sqlite3_log() is still correct this way.

FossilOrigin-Name: 1c0aa919ee429cd194820ec9c54084563f39e63fd399b23f859fc6703b429b15
2017-12-13 20:35:34 +00:00
drh a803a2cd98 New result code SQLITE_READONLY_DIRECTORY is returned when an attempt is
made to write on a database file that is in a read-only directory and hence
the journal file could not be created.  This situation formerly returned
SQLITE_CANTOPEN, which less helpful.

FossilOrigin-Name: 3ec73c38f878d73d278fce99ba10c708dcc475835774f1e17769ff7315be6d7c
2017-12-13 20:02:29 +00:00
drh 472e41ea16 Correctly invalidate a column cache line when it is overwritten with NULL.
Fix for ticket [123c9ba32130a6c9d432].

FossilOrigin-Name: 65754dc3b830ef9482655d2e93c2cd4acaa7a8715a58d8309955d04378541f89
2017-12-13 18:01:52 +00:00
dan 34aebb88da Change some LSM code internal typenames from "Blob" and "Pgno" to "LsmBlob"
and "LsmPgno". This allows the LSM code to be compiled as a single unit with
sqlite3.c.

FossilOrigin-Name: 30bf38d589adf0b2eb613e184ffb03ed7e625736cb04fd5c341328f72bc5ef4d
2017-12-13 15:32:33 +00:00
dan 62128540ef Add script to amalgamate all LSM files into "lsm1.c".
FossilOrigin-Name: e32b69d73062e233b0ac853611d10b24546a346a603289ab0e339a3604ae2af4
2017-12-13 14:22:48 +00:00
drh 37874b5f74 Minor enhancement to two assert() statements in the default VFSes.
FossilOrigin-Name: 9cede8a83ca4cd88d504050115e1e89e7b3d3cd3cb2ffb5b8961e311a23ff5e2
2017-12-13 10:11:09 +00:00
dan 2e6ca188c4 Fix a buffer overwrite in fts5 that could occur when processing a prefix
query.

FossilOrigin-Name: 92fc146bc2b781e7e2d7138b00e5ea649c6fee1c2b8449420460a1b3e5c9661b
2017-12-11 17:20:37 +00:00