Commit Graph

11964 Commits

Author SHA1 Message Date
drh
a026b98500 Add tests that verify that keywords WITH, WITHOUT, and RECURSIVE can still
be used as table and column names.

FossilOrigin-Name: 9ca18a0191db6a9b0763e2f0b3b35d23099fb71b
2014-01-17 16:19:01 +00:00
drh
6785bcca58 Fix a compiler warning in selectPopWith().
FossilOrigin-Name: c8eb11635a356182611ce2ccb8f358b6c453486e
2014-01-17 15:27:00 +00:00
dan
718569443d Add support for common table expressions (WITH clauses).
FossilOrigin-Name: 0171e3bb4f663a9414b0e8b64c87b5d0683855b5
2014-01-17 15:15:10 +00:00
dan
b290f11775 Fix some problems to do with WITH clauses and name resolution.
FossilOrigin-Name: 6a549187ed8b5ed50daefa676ff666ae2ed43346
2014-01-17 14:59:27 +00:00
dan
2d4dc5fc60 Remove some code from resolve.c that was only required for recursive cte references in sub-queries. Also a stray "finish_test" command in pagerfault.test.
FossilOrigin-Name: f68c6c4d36481526a9348244adc571ea282dc9eb
2014-01-17 11:48:24 +00:00
drh
65a2aaa633 Add the ability for the authorizer callback to disallow recursive
queries.

FossilOrigin-Name: 9efc120a1548c03f3d8aabbadf1050ff2a119c31
2014-01-16 22:40:02 +00:00
drh
727a99f1e3 Tweaks to error message text.
FossilOrigin-Name: 090a77d97808b86d1e9f5c63c743a2b159a15f5d
2014-01-16 21:59:51 +00:00
dan
f2655fe8b6 Improve the error messages used to report illegal recursive cte references.
FossilOrigin-Name: 54eee9fe99290e59469bd3e1a66bb749887d37ee
2014-01-16 21:02:02 +00:00
dan
eae73fbfb9 Allow only a single recursive reference in a recursive CTE. Also require that this reference is not part of a sub-query.
FossilOrigin-Name: a296b73360d34c9364eceb2cc09a9a92adc4abb8
2014-01-16 18:34:33 +00:00
drh
6ade453cd8 Always use available indices to optimize LIKE operators even if the pattern
of the LIKE operator has a COLLATE modifier.  This fixes an ineffiency that
was introduced into 3.7.15 by check-in [8542e6180d4] on 2012-12-08.

FossilOrigin-Name: 16bd54783a3f5531c55564ddefdada657c078eb0
2014-01-16 15:31:41 +00:00
dan
8290c2ad5a Disable the flattening optimization if the parent query is the recursive part of a recursive CTE and the sub-query is a compound query.
FossilOrigin-Name: 6bfa387e82de47ca1f40225fe28d873e29d6f481
2014-01-16 10:58:39 +00:00
drh
7b19f25247 Merge trunk changes. Fix a possible NULL-pointer deference in WITH clause
name resolution.

FossilOrigin-Name: 7f953b568baa3eede0b9c144be0b9bc86496341a
2014-01-16 04:37:13 +00:00
drh
93c36bb399 Remove an ALWAYS() that is no longer always true.
FossilOrigin-Name: c95823cd451f7721174393817a801403647467db
2014-01-15 20:10:15 +00:00
dan
eede6a538d Fixes so that SQLITE_OMIT_CTE builds work.
FossilOrigin-Name: 3908e2ea2e7e5f466cbbbffdc27e0fe8dc9751ac
2014-01-15 19:42:23 +00:00
drh
c49832c208 Further comments on WITH-clause processing routines in select.c.
FossilOrigin-Name: c948384dfdd9f68a832d5a452af44f35337f66e7
2014-01-15 18:35:52 +00:00
drh
60c1a2f0b5 Add a header comment to the searchWith() routine.
FossilOrigin-Name: d9ae0f5d9f8230ca7ca10ebed300e2f6635a0614
2014-01-15 18:23:00 +00:00
dan
62ba4e418d Disable automatic indices on recursive CTE references.
FossilOrigin-Name: 28aa6db8c878655255dbfb618f8d65be78e3d7e5
2014-01-15 18:21:41 +00:00
dan
f43fe6e9f6 When resolving names, consider a reference to a recursive CTE column as equivalent to a reference to the outermost name-context. This ensures that correlated sub-queries are correctly identified as such.
FossilOrigin-Name: 61be2da0ae623c1572819481508b044e9d32f294
2014-01-15 18:12:00 +00:00
dan
60e7068d75 Return an error if a CTE specifies a different number of columns than its SELECT statement returns.
FossilOrigin-Name: 9a514b50e4b01f109fbdb0aabcbfe1ddab129b44
2014-01-15 15:27:51 +00:00
drh
a379b32f33 Don't try to verify the schema of transient table (such as generated inside
a WITH clause) when generating code for "IN table" operators.

FossilOrigin-Name: 860aa936634a60d68e3954fc408a96a9260394e0
2014-01-15 14:40:41 +00:00
dan
bfe31e7f80 Disable the flattening optimization if the sub-query is a recursive CTE.
FossilOrigin-Name: 9472f6d820a7fb233936d9b8f7a39c9d4c4d6d73
2014-01-15 14:17:31 +00:00
drh
f9db522fee Use the user-supplied table name in WITH RECURSIVE tables as the internal
name of the table and the name of the table in VDBE comments.

FossilOrigin-Name: a29330238be6366444269a0b1b328475b2d01ae2
2014-01-15 02:40:11 +00:00
dan
8ce7184bc2 Add code to handle recursive CTEs.
FossilOrigin-Name: a5c2a54a07d35166911abc792008c05dea897742
2014-01-14 20:14:09 +00:00
mistachkin
7a429658d7 Fix harmless compiler warning in LEMON.
FossilOrigin-Name: f61a70589ac7e05008a362bd9d5b7bde5d07a758
2014-01-14 10:17:21 +00:00
mistachkin
866b53eb5a For the Win32 VFS, defining winShmMutexHeld should be controlled by NDEBUG, not SQLITE_DEBUG.
FossilOrigin-Name: 1e131094b522103a0829f72193b067b04e42ce82
2014-01-14 10:17:02 +00:00
drh
c3d6ba49c6 In the command-line shell, defend against a NULL-pointer dereference in the
case where sqlite3_column_name() returns NULL (as might happen following an
OOM error).

FossilOrigin-Name: ac15455abcb9bdb88b53129348668a1442f6899f
2014-01-13 20:38:35 +00:00
drh
859bc542c6 For statements of just an unadorned VALUES clause, assign column names
as "columnN" for increasing whole numbers N.

FossilOrigin-Name: 260587d2727f66d7fd65ef672ee46c92024f1d30
2014-01-13 20:32:18 +00:00
dan
a9f5c13d0c Fix some memory leaks and crashes that could follow an OOM condition during WITH clause parsing.
FossilOrigin-Name: 8839850c44a8938883e493eacd752fa686e542df
2014-01-13 16:36:40 +00:00
dan
4e9119d9e8 Add code to handle non-recursive CTEs in the same way as SQL views.
FossilOrigin-Name: a26f399ba485e8127c276c5f103ec6c555e11734
2014-01-13 15:12:23 +00:00
dan
7d562dbe02 Update the parser so that sub-queries and CTEs may have WITH clauses.
FossilOrigin-Name: 704d3931b855562a619769955969d439c42ca406
2014-01-11 19:19:36 +00:00
drh
8b4718636c Parse common table expressions. But do not do anything with them (yet).
FossilOrigin-Name: da98b7205eb3d7ec2ddbf8a8e24eee0b2ff499a5
2014-01-11 13:22:17 +00:00
drh
03e1b1f5ff In LEMON, limit the size of the grammar file to 100MB. This ensures that
the program will never experience integer overflow.  To be doubly sure,
use calloc() instead of malloc() when allocating arrays.

FossilOrigin-Name: 29ba458d849ad8864711cbe59fb10447a947e06a
2014-01-11 12:52:25 +00:00
drh
f59b12fbc1 Optimizations to the SQL language grammar that result in a small size
reduction and speed increase.

FossilOrigin-Name: cb5d1f83e0a33d546d4c0cb817ef1f8440d1f738
2014-01-11 03:54:05 +00:00
drh
ecaa9d399c Add the "%token_class" directive to the LEMON parser generator. This opens up
the possibility of simplifying the parser.  Also remove all calls to 
sprintf(), strcpy(), and strcat() from LEMON to avoid compiler warnings
on OpenBSD.  (Aside:  It is this change to avoid harmless compiler warnings
that was the cause of the reason spat of bugs.)

FossilOrigin-Name: 8eb48c04bd0a14031488b3160fde67307eb8b35d
2014-01-11 03:27:37 +00:00
drh
61f92cd045 In LEMON, fix a bug in the text formatter introduced by the previous
commit.  Also add the new "%token_class" directive for defining symbolic
names that stand any one of a collection of tokens.

FossilOrigin-Name: da7890ca6b1d8e511377a469047120220e8c3b2d
2014-01-11 03:06:18 +00:00
drh
898799fa00 Do not use sprintf(), strcpy() or strcat() in the implementation of the
lemon parser generator tool, to avoid compiler warnings in OpenBSD.

FossilOrigin-Name: e43c522dde01e134f1adc94f534d2b3eda74afc2
2014-01-10 23:21:00 +00:00
drh
144ffe7bfb Remove unused structure definition from parse.y.
FossilOrigin-Name: 7f1e7ae313c7625ef2623d78883dce776eecca30
2014-01-10 20:51:16 +00:00
drh
75593d96be Allow a VALUES clause to be used any place that a SELECT statement can be
used.

FossilOrigin-Name: c9ea7d199f06a7801ab639e7ac98ebeb98706f24
2014-01-10 20:46:55 +00:00
drh
c740752470 Fix CREATE TABLE ... AS so that it works with column names that are empty
strings.

FossilOrigin-Name: 632045f21c553e10f59a14c772d50d7824ca0c2c
2014-01-10 20:38:12 +00:00
dan
9871c59a2d Fix another harmless compiler warning in unixUnfetch().
FossilOrigin-Name: 0484549bb82ca5246488330c8d266e429ccd19b9
2014-01-10 16:40:21 +00:00
drh
1bcbc621df Fix harmless compiler warning in unixUnfetch().
FossilOrigin-Name: 618f248f4ea9fb0b6ff019a4c2cd72857389301f
2014-01-09 13:39:07 +00:00
drh
b66e21fda5 Fix an typo that breaks the build when SQLITE_ENABLE_TREE_EXPLAIN is defined.
FossilOrigin-Name: f461e2b3973d0fe6a7b8cb7a3aaab8a30b3e16c0
2014-01-04 20:00:14 +00:00
dan
2e08486a08 Add the usual "fts3" prefix to new static method setEstimatedRows() in fts3.c. This fixes a problem when compiling the amalgamation, as the r-tree module also contains a static method named setEstimatedRows.
FossilOrigin-Name: d6fcfc8890489b942e5b3f1bc271835d77c5ef96
2014-01-04 19:58:29 +00:00
drh
1c2c0b776f Avoid redundant register loads during index key generation when doing a
DELETE or INTEGRITY_CHECK on a table with multiple indices.

FossilOrigin-Name: 8f6e6149a165f516be6395fd753e163d52ffd52e
2014-01-04 19:27:05 +00:00
drh
61019c7883 Omit OP_Close operations that occur immediately prior to OP_Halt and which
cannot be jumped over.

FossilOrigin-Name: 874b7e9999811c288ad41d07709f88e458d2d497
2014-01-04 16:49:02 +00:00
drh
54e2adb5f3 Improvements to the column-cache for nested AND/OR operators.
FossilOrigin-Name: 4e725f53131d3584319c710c8710a068989543c6
2014-01-04 15:17:04 +00:00
dan
8c7d4ddd5a Have FTS assign extremely high costs to plans that feature unusable MATCH constraints. This discourages the planner from choosing such plans, which lead to "unable to use function MATCH in the requested context" errors.
FossilOrigin-Name: fa8be488a3ad290722dae7a1a7396c77277b2149
2014-01-04 14:46:39 +00:00
dan
69014393f8 Instead of having the planner ignore plans with unusable MATCH constraints, have FTS assign extremely high costs to such plans in order to discourage the planner from using them.
FossilOrigin-Name: 24f84b38131866f7b435ffe641bb2f6991a70db2
2014-01-04 14:42:14 +00:00
dan
42899543f8 Have the planner detect cases where a MATCH constraint is applied to a virtual table, and ignore any plans that do not allow the virtual table implementation to implement the MATCH filtering.
FossilOrigin-Name: 19f3208b26597625728d1ef716d4e44407cf96ac
2014-01-04 14:16:06 +00:00
drh
5426d80948 Avoid some unnecessary OP_SCopy operations when inserting into a table
with multiple indices.

FossilOrigin-Name: 429018b19cb525a4bb0843d20955457b53900d4b
2014-01-03 16:03:43 +00:00
drh
759e858811 Try to factor constant subcomponents of the WHERE clause out of the loop.
FossilOrigin-Name: 9d05777fe24e1a5ce71762de38db840931ef0bc8
2014-01-02 21:05:10 +00:00
drh
762c1c4071 Avoid unnecessary affinity transformations when building indices using
data from a table.

FossilOrigin-Name: 10d851353c2abeadbd2852c210a7ff9f7f513e5d
2014-01-02 19:35:30 +00:00
drh
991a198511 Be more aggressive in optimizing constant conditional expressions.
FossilOrigin-Name: b7e39851a75b87ebca747b26a39989560fd6362b
2014-01-02 17:57:16 +00:00
drh
b00d862139 Try to detect process ID changes due to fork() calls in os_unix.c and
reset the PRNG when a process ID change is detected.

FossilOrigin-Name: e1eba1fb09d7db49d77928bd115b27b8002ae640
2014-01-01 15:18:36 +00:00
drh
fe98081e18 Enhance sqlite3_randomness(N,P) such that it resets the internal PRNG
if N is less than 1.  Subsequent calls to sqlite3_randomness() will reinitialize
the internal PRNG by calling the xRandomness() method of the default VFS.

FossilOrigin-Name: a221aa82bb5496885fd0bf76e4601443799511de
2014-01-01 14:00:13 +00:00
drh
3312348cf8 Add -I. to the main.mk makefile for building sqlite3.o and speedtest1.
FossilOrigin-Name: cc72c5aec7fe93d4a1368517aab949dc98d33003
2013-12-24 12:04:24 +00:00
drh
73d5b8f550 Move elements of the Vdbe object that are only used during statement
preparation out into the Parse object.

FossilOrigin-Name: c289a253c0c053ac8fc344efe138262c327d8096
2013-12-23 19:09:07 +00:00
drh
58c960816f Remove a stray tab character.
FossilOrigin-Name: 25b8a1c9ba77df3b7c78cbce922cb593d661696d
2013-12-23 11:33:32 +00:00
drh
eaf4f523a5 Remove a condition that is always in the logic that handles reading
default values for columns.

FossilOrigin-Name: 895af097e71749f423b63ece17c5a4b4dfcd164d
2013-12-22 22:45:14 +00:00
drh
6c1de308f2 Make sure the WhereLoop.aLTerm[] array is large enough when processing
the skip-scan optimization.  Fix for ticket [520070ec7fbaac].

FossilOrigin-Name: 46d040591f27be01b1860344f8a268797fe344f4
2013-12-22 20:44:10 +00:00
drh
25555506df Fix speedtest1.c so that in --explain mode it only outputs non-explain text
for DDL statements.

FossilOrigin-Name: 2d2b3c4951dc2b8317d5ba8b5cf72b1f4a6668f6
2013-12-21 17:14:58 +00:00
drh
685e3c481c Avoid compiler warnings by only enabling sqlite3ErrName() when
SQLITE_TEST is defined.

FossilOrigin-Name: 862228e50534a6b89c9498c4db664610db11485e
2013-12-21 17:07:13 +00:00
drh
c73d0d9dec Fix harmless compiler warnings in FTS4. This involved corrupting
Martin Porter's beautifully written and elegant stemmer code, making it
a little less beautiful and a little less elegant.  Today is a sad
day.  But the warnings from GCC grow increasingly verbose and irksome
with each new release and so something had to be done.

FossilOrigin-Name: df05679838b571c16a7ab7e135f9564cd2d9647c
2013-12-21 16:06:47 +00:00
drh
849a9d92ba Fix the ".echo on" dot-command of the shell so that it echos comments in
addition to SQL statements and dot-commands.  Add the --explain option
to speedtest1 so that the output can be piped into the command-line shell
to show nicely-formated VDBE code for the entire test.

FossilOrigin-Name: 96397263f94256e284aae9506de1fc48fea89193
2013-12-21 15:46:06 +00:00
drh
ae28d6efc6 Add a case to speedtest1.c that demonstrates the need to factor OP_Column
operators out of inner loops.

FossilOrigin-Name: 69a17336fdf4ae891e815914be8942f7222230c2
2013-12-21 00:04:37 +00:00
drh
a47941fe42 Fix compiler harmless warnings in tclsqlite.c that appeared with GCC 4.8.x.
FossilOrigin-Name: d93ae6833a7fca0672caf902a7b48846e54242cd
2013-12-20 18:57:44 +00:00
drh
d42ef839bc Code simplification in sqlite3GenerateIndexKey() by making use of a subroutine
found over in expr.c.

FossilOrigin-Name: 0026d3355340d66687a3fd4cbece28811ef1b505
2013-12-20 18:44:35 +00:00
drh
4eded604ea Combine adjacent single-register OP_Copy instructions into a single
multi-register OP_Copy, where possible.  Fix the Synopsis comment for
multi-register OP_Copy instructions to show the correct register ranges.

FossilOrigin-Name: 2ae22dc0cbed2feca4baf89d02aaace0331971d6
2013-12-20 15:59:20 +00:00
drh
aed1819875 Allow any arbitrary expression as the filename in an ATTACH statement,
including functions and subqueries.

FossilOrigin-Name: df70a1f30393b34146d6b8bf1df5a76aaf362efe
2013-12-20 14:48:12 +00:00
drh
7e61d18eb4 Simplify the accumulator reset for aggregate query processing so that it
uses a single multi-register OP_Null rather than a separate OP_Null for each
register.

FossilOrigin-Name: 2c7fd9b043f5f3d9d8e22dbefa84a9770ca951d0
2013-12-20 13:11:45 +00:00
dan
1001ee8819 Do not inject OOM faults into SQLITE_FCNTL_COMMIT_PHASE_TWO file-control invocations. It causes problems for test scripts.
FossilOrigin-Name: 8eb28d23e353139d24a8af78309d39249ab9eaf0
2013-12-19 17:04:58 +00:00
drh
f6b1a8e1a5 Make sure errors encountered while initializing extensions such as FTS4
get reported out from sqlite3_open().  This fixes a bug introduced by
check-in [9d347f547e7ba9].  Also remove lots of forgotten "breakpoint"
commands left in test scripts over the years.

FossilOrigin-Name: ca3fdfd41961d8d3d1e39d20dc628e8a95dabb2f
2013-12-19 16:26:05 +00:00
drh
a021f121c9 Remove an unneeded column-cache flush in aggregate SELECT
and an unreachable branch in the INSERT logic.

FossilOrigin-Name: ffa092e13b3781677b18418cca40e3dd1e388aed
2013-12-19 14:34:34 +00:00
drh
edfac3456e Omit an unnecessary OP_Null opcode from UPDATE.
FossilOrigin-Name: 72d111336c5016e5b5092dfebcd01253266a7685
2013-12-19 02:56:01 +00:00
drh
46d03fcbfc Omit one or more pointless instructions that occur in between OP_NoConflict
and OP_Halt.

FossilOrigin-Name: 61e2f3575c4a94f9571c28fb2bd19da84b0edceb
2013-12-19 02:23:45 +00:00
drh
935c34711b Remove an unnecessary column-cache flush operation. Add code to trace the
column cache when compiled with SQLITE_DEBUG and using
PRAGMA vdbe_addoptrace=ON.

FossilOrigin-Name: 58704ed1f4cd78bb3b0c095ffd1626906a95a413
2013-12-18 18:44:43 +00:00
drh
039468ef2d Remove an unnecessary column-cache flush. Add another test case to the
speedtest1.c program to accentuate the benefit of not flushing the cache at
that point.

FossilOrigin-Name: 97fdfc6b79833011fc0c506fe5e0985c0fb1906c
2013-12-18 16:27:48 +00:00
drh
9ac7962ace Show changes to the column cache when PRAGMA vdbe_addoptrace=ON is set.
FossilOrigin-Name: 4c6a659c432e4f7c0285f58675a67f967b07bb0d
2013-12-18 15:11:47 +00:00
drh
3a8aec5e13 Add evidence marks and additional test cases for the printf() SQL function.
FossilOrigin-Name: 93121d3097a43997af3c0de65bd9bd7663845fa2
2013-12-17 16:32:56 +00:00
drh
afa5af807c Add the printf() SQL function.
FossilOrigin-Name: a1bb62f91a85af0584100c3ad77877a949c30cca
2013-12-17 16:10:57 +00:00
drh
fc6ee9df22 Fix the formatting of %c in the printf() SQL function.
FossilOrigin-Name: 3375571a5e267744c19a7c310840256cec57a242
2013-12-17 15:58:42 +00:00
drh
a5c1416d64 Add the printf() SQL function.
FossilOrigin-Name: 6db7052eeefafdbf26b3153bc38600fecfb53ae6
2013-12-17 15:03:06 +00:00
drh
4a8ee3dfe2 Allow the SQLITE_DETERMINISTIC flag to be ORed into the preferred text encoding
of application-defined functions, to mark the function as deterministic.

FossilOrigin-Name: 5716fc2341ddd8cf64139e7168597f864da4e10b
2013-12-14 13:44:22 +00:00
drh
5dee6afcac Performance optimizations in the pager_write() routine of pager.c.
FossilOrigin-Name: bc5febef921bd12ca7760e9d07d3be0e67140320
2013-12-13 20:45:50 +00:00
drh
16f9a81125 Reduce the number of calls to the subjRequiresPage() routine inside of pager.
FossilOrigin-Name: e50ff39a93a51b5a5be4f0e82a76104b81c9e2a4
2013-12-13 19:48:04 +00:00
drh
da8a330a03 Create and use a new pager interface sqlite3PagerUnrefNotNull() that works
just like sqlite3PagerUnref() but guarantees that its argument is not a
NULL pointer.

FossilOrigin-Name: e00f37e2333cac5b53e17cf764ab56c4fcd5f617
2013-12-13 19:35:21 +00:00
drh
5d56dd2867 Enhance the pcache1PinPage() routine so that it called much less often and
runs much faster in the cases when it is actually called.

FossilOrigin-Name: a845779cd31aec3204a6a9c776bd9c9f7d47dd24
2013-12-13 18:50:40 +00:00
drh
40f22bed06 Avoid unnecessary calls to sqlite3_free() from within sqlite3VXPrintf().
FossilOrigin-Name: e2a8b280e84c1f8fd6106d9427e1ad6cbcfccd10
2013-12-13 16:42:18 +00:00
drh
a3cc007df4 Simplication and optimization of error message handling.
FossilOrigin-Name: 9d347f547e7ba9590b0c68edf50a14ad94a2bb92
2013-12-13 16:23:55 +00:00
drh
a5f40593be Add the SQLITE_FCNTL_SYNC and SQLITE_FCNTL_COMMIT_PHASETWO file-controls
and have the pager call them at appropriate times.  This is needed in order
to enable ZIPVFS to do multi-file atomic commits.

FossilOrigin-Name: 552f94d50f08cf11f33205730fde52bc2f06cff6
2013-12-11 15:47:39 +00:00
drh
07c5d0a901 Merge in the latest trunk changes.
FossilOrigin-Name: 9ff4dfe1e36b40e386858b03f36cfab8f6806fdd
2013-12-11 14:17:06 +00:00
drh
a81ad1758c Fix a bug in the shell ".import" command: Do not end the field
when an escaped double-quote occurs at the end of a CRNL line.

FossilOrigin-Name: 5e239ecda0f7835ce037b38b04627a574b5854cd
2013-12-11 14:00:04 +00:00
drh
39325bac1b Remove an unreachable conditional inserted by the previous check-in.
FossilOrigin-Name: 3e1d55f0bd84810a035bd6c54583eb373784a9a3
2013-12-11 12:02:55 +00:00
dan
1d8b85bed1 Have the crash-test infrastructure code in test6.c read and write the 512-byte block containing the pending-byte lock as normal. Earlier versions did not access this part of the file in order to avoid triggering an assert in os_unix.c. But the assert() has since been removed. And not reading/writing this part of the file causes problems for multiplexor tests.
FossilOrigin-Name: fdc3f3fa3de1481860e1e2a819db2d6c4eb05658
2013-12-11 11:03:19 +00:00
drh
a9ab481fca Fix harmless compiler warnings.
FossilOrigin-Name: a7e5fcd66659750eb2f4675082df324e7cf35427
2013-12-11 11:00:44 +00:00
mistachkin
53cd964648 Fix harmless compiler warning.
FossilOrigin-Name: 2525296d919245ebb01077aad541e4ae6eab7940
2013-12-11 02:21:19 +00:00
drh
2dc0648a80 Do not run the tool/vdbe-compress.tcl script that generates the
vdbeExecUnion object that reduces the size of the sqlite3VdbeExec()
stack frame unless the SQLITE_SMALL_STACK compile-time option is
specified as on of the OPTS in the makefile.  The vdbeExecUnion object
gets in the way of C-compiler optimizer and results in slightly slower code.

FossilOrigin-Name: 4d0781473a465b4ab0a307914014f3d2ddd0ce33
2013-12-11 00:59:10 +00:00
drh
024045fe6e Avoid unnecessary calls to sqlite3VdbeSerialType() from within
sqlite3VdbeSerialPut().

FossilOrigin-Name: 079c04a5013074b68f7d90f1ce8bf8e7092ad8a2
2013-12-10 21:38:08 +00:00
drh
3e6c060fac In the OP_MakeRecord opcode, factor out affinity changes into separate loop,
for a slight performance advantage.

FossilOrigin-Name: 1c6ee9b85f61e5cdb5d9b7815cddf526dc78aaa7
2013-12-10 20:53:01 +00:00
drh
b0e7704e9f Simplify and improve the performance of the sqlite3VdbeMemGrow() routine.
FossilOrigin-Name: 48ecf18774ba9572d86696c60d87007a619d9f53
2013-12-10 19:49:00 +00:00
dan
6f68f1640d Use SQLITE_FCNTL_SYNC instead of SQLITE_FCNTL_SYNC_OMITTED. Add documentation in for FCNTL_SYNC and FCNTL_COMMIT_PHASETWO.
FossilOrigin-Name: 46231af985a1a872d1dc3418591cbaacb0b7c249
2013-12-10 17:34:53 +00:00
dan
d22d7b4daa Merge changes from the trunk.
FossilOrigin-Name: 3ee736a39d1fc175a297c5fdd0d2e1c5a9b5b18e
2013-12-10 16:35:42 +00:00
dan
a01abc302d Fix handling of errors returned by the SQLITE_FCNTL_OMIT_SYNCED file-control.
FossilOrigin-Name: d9a5f44f4a27336d41e60b6c3791bd018fbbff6f
2013-12-10 16:27:59 +00:00
drh
038b7bc4ef Simplifications to the OP_MakeRecord opcode and the sqlite3VdbeSerialPut()
helper function.

FossilOrigin-Name: 7277a769694787e0332d1a4efc02041834661e2a
2013-12-09 23:17:22 +00:00
mistachkin
401387553d Correct the VFS name as reported by the file control when explicitly using the 'win32-longpath' VFS.
FossilOrigin-Name: c43b59dac1fbb67ec3a9d921005543046ad416ce
2013-12-09 21:48:49 +00:00
drh
a2a3028d5f Reduce the number of times that OP_Column calls sqlite3VdbeMemMakeWriteable().
FossilOrigin-Name: 6b51863553e51334880fb322bdf74e51e35d0e61
2013-12-09 21:06:46 +00:00
drh
2a8d2261ed Simplify the sqlite3BtreeKeyFetch() and sqlite3BtreeDataFetch() interfaces
to the storage engine.

FossilOrigin-Name: bf97598592ff60fab2a06d8b31b0201200b91684
2013-12-09 20:43:22 +00:00
dan
999cd08aae Modify the way some internal file-controls are invoked. In order to support multi-file transactions in the zipvfs extension.
FossilOrigin-Name: 32fb1784af4594161d954343e3787db702000a4d
2013-12-09 20:42:03 +00:00
drh
c65faab2e1 Minor performance optimizations in pager.c.
FossilOrigin-Name: ba9eef5f5293633d1479e1d877bf338edb2a9471
2013-12-09 19:25:28 +00:00
drh
a6353a3f64 Performance optimizations for sqlite3VXPrintf().
FossilOrigin-Name: 9227ad48e1612b32a3a3e9551c49890f93abc0a7
2013-12-09 19:03:26 +00:00
drh
195134c6c3 Fix an incorrect test number in the output of the speedtest1.c program. No
changes to the test algorithms.

FossilOrigin-Name: fbfc075a5a3c9c5c98353f396f9da7f7ec7c1c04
2013-12-09 12:24:23 +00:00
drh
7250c547a5 Avoid unnecessary (no-op) calls to sqlite3DbFree() from sqlite3VdbeMemRelease().
FossilOrigin-Name: 2d6dd7c2eb5a64f8994162b564a99ef0014b7460
2013-12-09 03:07:21 +00:00
drh
8f518837f9 Use memmove() rather than a home-made copy loop in insertCell() too.
FossilOrigin-Name: a3d796b1673ca68ced247d63c22ddcfb1f9d56ea
2013-12-09 02:32:19 +00:00
drh
9bb7c4ff4f Use memmove() rather than a home-made copy loop in dropCell() of btree.c,
for a size reduction and performance improvement.

FossilOrigin-Name: 78e1706804e88a0dd5dc40bee838a3a504cfa53b
2013-12-09 01:58:11 +00:00
drh
29f2bad6f0 Avoid unnecessary no-op calls from getAndInitPage() to btreeInitPage()
in the btree.c logic.

FossilOrigin-Name: 81f5ae13b2e23daee03151d32515387b7f5ba5e5
2013-12-09 01:04:54 +00:00
drh
7599d4aa44 Use putVarint32() instead of putVarint() for a quantity that can never
exceed 2GiB - 1.

FossilOrigin-Name: 6996fb34445adedf463b66ed1f339ee1f27ce6e5
2013-12-09 00:47:11 +00:00
drh
59bf00cb54 Another simplification to the OP_MakeRecord opcode, making it slightly
faster and very slightly smaller.

FossilOrigin-Name: f2f5a3ce9d075c4b1ac586c5db3a623d9035402d
2013-12-08 23:33:28 +00:00
drh
2a24287639 Avoid unnecessary calls to sqlite3VarintLen() from the OP_MakeRecord opcode.
FossilOrigin-Name: 7a234fc3c5e7970ffe0b8d6ac33c26acb64b5c4d
2013-12-08 22:59:29 +00:00
drh
1e98310a14 Interchange two conditions in an "if" statment in sqlite3PagerAcquire() for
very slight (0.06%) overall performance increase.

FossilOrigin-Name: fbcc1a3ebb016225c3580181c908a2904cc184a5
2013-12-08 19:54:52 +00:00
drh
9dcc7cd527 Increase the version number to 3.8.3.
FossilOrigin-Name: 23d00f22872a907a8ebf5b80689ff7aa66686a07
2013-12-07 17:01:23 +00:00
drh
689156fdbc At the start of each write transaction, check to see if the database file has
been moved, and if it has refuse to start the transaction, returning an
SQLITE_READONLY_DBMOVED error code.

FossilOrigin-Name: 369a23e00644f3ff8b6a2d2ed73b8cb65e9f124b
2013-12-07 16:56:09 +00:00
drh
a9c19f935c Back out the new device capability. The determination of whether or not a
file has moved is now done strictly using a file-control.

FossilOrigin-Name: 9c59f5af7ac4908583fab85d37241f200c40f02d
2013-12-07 16:45:05 +00:00
drh
b959a017b6 Actually look at i-node numbers to determine whether or not the database
file has moved.

FossilOrigin-Name: 2b1884dc14f9a04a04eebb3245fbe0daaff399eb
2013-12-07 12:29:22 +00:00
drh
4e8fe3ff91 Performance optimization to the moveToRoot() subroutine in btree.c.
FossilOrigin-Name: b5842a70f8e26456a8f0d39539bc266f097480a4
2013-12-06 23:25:27 +00:00
drh
b8a9bb4fb9 Use memcmp() instead of the BINARY collating function where possible, for
a performance boost.

FossilOrigin-Name: c5a3a1af3c7bd34886e944a1fef2f6340ded24a0
2013-12-06 22:45:31 +00:00
drh
72b8ef6ce3 Remove some commented-out code from sqlite3BtreeMovetoUnpacked() to try to make
it more readable.

FossilOrigin-Name: 2d62d1131f8bbc4e1f8f7aeaf0d91e3237fe3b7c
2013-12-06 22:44:51 +00:00
mistachkin
091a81b91d Add the SQLITE_READONLY_DBMOVED error code to the sqlite3ErrName() function.
FossilOrigin-Name: 7789f801d720db5394117e764675cd4bbe6b2da1
2013-12-06 19:58:32 +00:00
drh
3fee8a63c8 Only error out on a database file move when attempting to start a write
transaction.  Assume read transactions are still safe.  And make the error
SQLITE_READONLY_DBMOVED instead of SQLITE_IOERR_NODB.

FossilOrigin-Name: 28348f2ada98c616241a51aecb70b63e87e6ddbb
2013-12-06 17:23:38 +00:00
drh
1b1f30bb5e Add code to detect if the database file is moved or deleted out from under
SQLite and return an SQLITE_IOERR_NODB.

FossilOrigin-Name: 8759a8e4d83b163e315eff316cf163f6ea42f2bb
2013-12-06 15:37:35 +00:00
dan
6f04b95f02 Version 3.8.2
FossilOrigin-Name: 27392118af4c38c5203a04b8013e1afdb1cebd0d
2013-12-06 14:53:30 +00:00
drh
224f66fba3 Fix harmless compiler warnings and improve the MSVC makefile.
FossilOrigin-Name: c632567063d81c4be404ce58cbac0eff7412f565
2013-12-05 17:12:47 +00:00
drh
47676fedf6 Fix two potential (and apparently harmless) shift overflows discovered by
the -fcatch-undefined-behavior option of clang.

FossilOrigin-Name: e19eead8c9977ed4f00eac54c5bc7e90db78caa8
2013-12-05 16:41:55 +00:00
mistachkin
5fac42002a Make use of the CC nmake macro even when cross-compiling (with MSVC).
FossilOrigin-Name: aae7b30ebd9601882a02fe8cf46fbf0390ec3fac
2013-12-03 23:33:29 +00:00
mistachkin
3f9cd2ae75 Fix harmless compiler warnings.
FossilOrigin-Name: a12d214ecccc5d3372dbcedc88705b0092363971
2013-12-03 22:33:35 +00:00
mistachkin
1fa85a15df Add memory subsystem related defines to the compile-time options list.
FossilOrigin-Name: 52a44146dd7c5a7662545042045e23deab302c96
2013-12-03 22:32:48 +00:00
drh
7f59475fda Remove a branch in STAT4 logic that is no longer reachable after
the previous change.

FossilOrigin-Name: eca7d3f1612c7a009a9e4ef89f76f9b7e275d1e6
2013-12-03 19:49:55 +00:00
drh
7190e07fc0 Fix a possible (and probably harmless) uninitialized variable in STAT3/4.
FossilOrigin-Name: 33ad4f91477907b7b3e5808c7ba11aacc9a83ba6
2013-12-03 19:16:06 +00:00
dan
b5f68b0c8c Fix an alignment problem in the stat3/stat4 code affecting 32-bit platforms.
FossilOrigin-Name: 14f9bc79014e5762b88b9f0b98f4d47a8092d127
2013-12-03 18:26:56 +00:00
dan
1868cbc78c Fix a typo in fts3varint.test preventing the valgrind permutation test from running.
FossilOrigin-Name: b654a4ec729c86c6e94365fb0d3f83c598d4461a
2013-12-03 17:09:53 +00:00
dan
070865da8d Modify test file conflict2.test so that it works with the "inmemory_journal" permutation.
FossilOrigin-Name: e4164fd8f75ce1c8d63bec70db7049b68208c12c
2013-12-03 10:35:00 +00:00
drh
9a01c16df8 Remove an unnecessary branch from the UPDATE logic - one that was also
unreachable except following an OOM on x64.

FossilOrigin-Name: 72f972771457b8c8d9f859238d6a72b43f41d2c3
2013-12-03 10:14:28 +00:00
dan
89bc021850 Add a "database_may_be_corrupt" directive to test file fuzz3.test. Reformat an assert() statement in vdbeaux.c to make its intent clearer.
FossilOrigin-Name: 9d8a0e132163f7adeaabbf6baba119e159addd41
2013-12-03 09:49:52 +00:00
drh
d5e4547084 Change some unreachable test conditions to NEVER().
FossilOrigin-Name: 7d99858bec699dface548c77649dfc50e7fb50d8
2013-12-03 02:52:11 +00:00
drh
47b927d2c3 Fix a harmless compiler warning on MacOS.
FossilOrigin-Name: 74328de1d720fb35a97b476034406ca17d35ff5f
2013-12-03 00:11:40 +00:00
drh
2a702db1cf Another #if SQLITE_VERSION_NUMBER macro in speedtest1.c for compatibility
with older versions of SQLite.

FossilOrigin-Name: bc8eacc7f71413184ef5be1412e51f8fd7174cd1
2013-12-02 21:25:40 +00:00
drh
d79e9c5802 Still more #if SQLITE_VERSION_NUMBER macros in test/speedtest1.c to enable
compilation against older versions of SQLite.

FossilOrigin-Name: 4b20cf4206ac12975ca9c4ec7ef76aa21bbd734d
2013-12-02 01:24:05 +00:00
drh
290ea4053a Add some #if SQLITE_VERSION_NUMBER macros to test/speedtest1.c in order to
make it compatible with older versions of SQLite so that it can be used for
historical speed comparisons.

FossilOrigin-Name: a9e1627ae714156cf6bd419e41cf9b79fbbe99a9
2013-12-01 18:10:01 +00:00
drh
a256c1a4b3 Fix typos in the header comment on the sqlite3Atoi64() routine.
FossilOrigin-Name: c85e0c546ea6c6be46deea5c7a716b5fb553c7b4
2013-12-01 01:18:29 +00:00
drh
094b7587fc Detect a corrupt UnpackedRecord and return SQLITE_CORRUPT prior to calling
sqlite3BtreeMovetoUnpacked().

FossilOrigin-Name: 55ec474db8935ef36fae30da5d11f5701c60c088
2013-11-30 12:49:28 +00:00
drh
b202366509 Change the name of the CORRUPTIBLE macro to CORRUPT_DB.
FossilOrigin-Name: f865be10e85a4063394a21827db2d854fc25960c
2013-11-29 15:39:36 +00:00