344 Commits

Author SHA1 Message Date
drh
f82b9afcba Improved VDBE comments on the constraint checker. Fix a missing write
lock in the UPDATE logic.

FossilOrigin-Name: 3bed599e74d354bf1513e4fb0e8665376ba44d0b
2013-11-01 14:03:20 +00:00
drh
ccc79f021f Some UPDATE statements now working in WITHOUT ROWID tables.
FossilOrigin-Name: 5c0eaea6a26b5c3310d96b3c896ac3068a3ebad1
2013-11-01 12:42:21 +00:00
drh
6934fc7b6f Improved comments and variable names in infrastructure routines of UPDATE,
DELETE, and INSERT.

FossilOrigin-Name: ad90e762e51384ac7c311f08a641419f03f6d3f0
2013-10-31 15:37:49 +00:00
drh
77f64bb7b9 Moving UPDATE towards the iDataCur/iIdxCur representation. Still not working
for WITHOUT ROWID, though.

FossilOrigin-Name: deacbd21b50cc8c63a1572d14a4bbc7af4052d37
2013-10-31 12:13:37 +00:00
drh
26198bb481 Refactor the INSERT, DELETE, and UPDATE code generators to distinguish between
the "data cursor" and the "first index cursor", which are no longer consecutive
in the case of a WITHOUT ROWID table.

FossilOrigin-Name: 1adfca6019847d37dee4a297669f29d5ca184066
2013-10-31 11:15:09 +00:00
drh
6fbe41acf2 Continue working to get UPDATE operational for WITHOUT ROWID tables.
Fix PRAGMA integrity_check so that it works on WITHOUT ROWID tables.

FossilOrigin-Name: 0d4fea7462c0f61cd1c736cbcd7bea5ec2034d54
2013-10-30 20:22:55 +00:00
drh
72ffd09188 Make sure KeyInfo objects on multi-column indices of WITHOUT ROWID tables
have the correct nField and nXField values.  Also, add the
SQLITE_ENABLE_MODULE_COMMENT compile-time option and the VdbeModuleComment()
macro and use it to label entry and exit points of some key routines.

FossilOrigin-Name: 6d9af6065fc0da8337aee2297a8da7511eecccf1
2013-10-30 15:52:32 +00:00
drh
0978d4ffb2 Improved comments on the constraint checking logic.
FossilOrigin-Name: 141a38a7a636e3e4255b59c27df4a1b3d6f26e97
2013-10-29 16:14:35 +00:00
drh
11e85273df Work on the UPDATE and INSERT logic. This is an incremental check-in so that
can switch over to trunk to work on an unrelated issue there.

FossilOrigin-Name: 086ec2a177b24ad90d5d705a99d93aa0c1545217
2013-10-26 15:40:48 +00:00
drh
6f225d0d7f Replace the OP_IsUnique opcode with OP_NoConflict. This code simplification
might be useful to move onto trunk even if this branch is never merged.

FossilOrigin-Name: e6650e16dd11327afd25961b2feb29ec8778c2ca
2013-10-26 13:36:51 +00:00
drh
d82b50212e Minor refactoring of variable names and fixes to comments in insert.c.
FossilOrigin-Name: ae61a34378d3ed2f454ba8768029d6f5fef849e4
2013-10-26 00:58:34 +00:00
drh
ea22abe3d6 Progress toward getting UPDATE to work in WITHOUT ROWID tables.
FossilOrigin-Name: e557b7d80f1ede63427a31b16757bf5d8dbfb66d
2013-10-25 19:17:17 +00:00
drh
261c02d963 Basic DELETE operations now working on WITHOUT ROWID tables.
FossilOrigin-Name: 9eafafa31c4a2bbcf48418743e0fcb17c374e9a6
2013-10-25 14:46:15 +00:00
drh
ecb31b6304 Update the interface to the sqlite3GenerateRowDelete() utility so that it is
able to handle WITHOUT ROWID tables.  The implementation still needs to be 
completed.

FossilOrigin-Name: 85daf5174679630474b3bccf3d662d5d56bf00d5
2013-10-24 19:48:39 +00:00
drh
dd9930ef20 Change the sqlite3OpenTable() utility to open the PRIMARY KEY index when
reading a WITHOUT ROWID table.

FossilOrigin-Name: 247f389930aededaa54ecb792748aa8d0ad6d57b
2013-10-23 23:37:02 +00:00
drh
55548273a3 Get VACUUM and the xfer optimization working with WITHOUT ROWID.
FossilOrigin-Name: 579815fff1737552d2077255862b8f4fd220927c
2013-10-23 16:03:07 +00:00
drh
ad124329ab Some inserts and queries working for multi-column primary keys
and WITHOUT ROWID.

FossilOrigin-Name: b21d831b2aa55507dd9def2acb02cdbffddf10d1
2013-10-23 13:30:58 +00:00
drh
ec95c44175 Some simple inserts and queries working on WITHOUT ROWID tables.
FossilOrigin-Name: 3f8016dee24213ec83a02d71ad2698789cc3a818
2013-10-23 01:57:32 +00:00
drh
bbbdc83b52 The Index object now has nKeyCol and nColumn. nColumn is the total number
of columns and nKeyCol is the number of key columns.  Currently these always
differ by one.  Refactor aiColumn[] to be of type i16 instead of int.

FossilOrigin-Name: a106ce86cd4afd1f81603826de77df1fb25e9ab5
2013-10-22 18:01:40 +00:00
dan
5988572876 If an "INSERT INTO ... SELECT" can use the xfer optimization, pass the OPFLAG_BULKCSR hint to btree cursors used to update indices. This results in a tighter key packing.
FossilOrigin-Name: 087af29ee2e1572f8668dd0152a14d7f9796a530
2013-10-04 18:17:18 +00:00
dan
8ff2d9561a When preparing an UPDATE statement, avoid generating VDBE code for those foreign key related actions and constraint checks that may be seen to be unnecessary by considering the subset of table columns potentially modified by the UPDATE.
FossilOrigin-Name: e940b5de49baa1d6a4cf859fbbc0e0df86ac5dbf
2013-09-05 18:40:29 +00:00
drh
619a1305e7 Fill out an initial implementation of the sqlite3ExprImpliesExpr() function.
FossilOrigin-Name: 8e07aa2ad5579aeb82174ce5bd432ddb9c058bc1
2013-08-01 13:04:46 +00:00
drh
8a9789b6c1 Test cases and bug fixes for the partial index logic.
FossilOrigin-Name: 6b73ae7c123801787c8994113cbeb87ee96ba653
2013-08-01 03:36:59 +00:00
drh
b2b9d3d758 Add the logic to keep partial indices up to date through DML statements and
when new partial indices are created.  This new logic is untested except to
verify that it does not interfere with full indices.

FossilOrigin-Name: fb9044d15ad4fd6ae4a38858c0c0e6fe9d4faa25
2013-08-01 01:14:43 +00:00
drh
d91c1a1768 Add extended error codes for constraint errors.
FossilOrigin-Name: 5461104668a49529577f21df97f6a0e7d8f0c679
2013-02-09 13:58:25 +00:00
drh
2d8e920339 Duplicating check constraint expressions prior to code generation is no
longer required, and so it is removed.

FossilOrigin-Name: 1a9db8dc2f3c5cb089801d56122cdf5c3a618163
2012-12-08 04:10:44 +00:00
drh
5f53aac2e7 Remove an unreachable condition. Replace it with an assert().
FossilOrigin-Name: 7d5fc1a339cf4f3597ab6a5f3e7101884d2d7673
2012-12-03 19:42:39 +00:00
drh
c31c7c1c6e Changes to facilitate full test coverage.
FossilOrigin-Name: 28d1eb40bfc4c993010ce670ee10780ca2ae5c9c
2012-10-08 23:25:07 +00:00
dan
1e92fb59b2 Fix a problem with shared-cache mode and CHECK constraints causing one db handle to invoke a collation sequence function registered with another.
FossilOrigin-Name: c2c776ab73828374836af008aa320cc670c081b5
2012-10-05 16:30:10 +00:00
dan
41fb5cd103 Shared-cache mode fixes for views and virtual tables.
FossilOrigin-Name: 2b370dea704b59262c604af0efcef5660b194454
2012-10-04 19:33:00 +00:00
drh
5f08526937 Factor out the code that generates a co-routine for evaluating the SELECT
on the RHS of an INSERT statement so that the same code can potentially
be reused in other places.

FossilOrigin-Name: a93ee09cdc15987848bf9023e69892ce9a5f989e
2012-09-15 13:29:23 +00:00
mistachkin
d5578433ff Fix all known instances of 'repeated the' style typos in comments. No changes to code.
FossilOrigin-Name: 9b19b847533f944f289d93dcdba29c0d67bf251c
2012-08-25 10:01:29 +00:00
drh
2b596da8b7 Refactor field names in the SelectDest object to make them distinct and easier
to grep for.

FossilOrigin-Name: b589f1efb3907a68058bf2ee981dca126d083e83
2012-07-23 21:43:19 +00:00
drh
a477a8670f Fix a compiler warning by removing a redundant variable.
FossilOrigin-Name: af602d87736b52802a4e760ffeeaa28112b99d9a
2012-03-31 19:12:23 +00:00
drh
f68686ae52 When a named CHECK constraint fails, include the name of the constraint
in the error message.

FossilOrigin-Name: 1b75f301affac654bee24fa247046ea0782d3c4d
2012-03-30 15:48:48 +00:00
drh
2938f924cc If a CHECK constraint is named, report that name on the error message when
the constraint fails.

FossilOrigin-Name: 9a0f90d9deb335ac71044b8afa81538d85cc7ccf
2012-03-07 19:13:29 +00:00
drh
e4c88c0c38 Fix typos and comments and make minor changes to a few function names,
as suggested by readership.

FossilOrigin-Name: e9d05cbb7676cbda83f1b3b71447404d7edde898
2012-01-04 12:57:45 +00:00
drh
f4d31bcb05 Previous check-in broke auto-increment. This check-in appears to fix it.
FossilOrigin-Name: 28ffd39c7162c8f7139711545122cffa257911dd
2011-12-09 16:59:19 +00:00
drh
b8475df809 Make no assumptions about the initial state of VDBE registers.
FossilOrigin-Name: 521d72bdf67b4b1972331307345a18c231a6e1d6
2011-12-09 16:21:19 +00:00
dan
0c733f67d8 Where possible, take advantage of the rowid at the end of index records to optimize range constraints (<, >, <=, >=) on the rowid column.
FossilOrigin-Name: 3b58f5f06648205a47e5cace0201269c406e476a
2011-11-16 15:27:09 +00:00
drh
ccdf1baebf Update the xfer optimization code so that the xfer optimization can be used
with INTEGER PRIMARY KEY ON CONFLICT ... as long as the destination table
is initially empty.  Improvements to the comments on the xfer optimization.
New test cases added.

FossilOrigin-Name: e3f368cd5ef66a56fd4bd05a77276039e26b9e0e
2011-11-04 14:36:02 +00:00
drh
e7224a011b Make sure the INSERT INTO ... SELECT statement works correctly even when
the destination table contains an INTEGER PRIMARY KEY ON CONFLICT... column.
Ticket [676bc02b87176125].

FossilOrigin-Name: 6f9898db7ff0730cc03f561f9c32ef3dee7e5d81
2011-11-04 00:23:53 +00:00
dan
1696124db7 Disable the xfer optimization if "PRAGMA count_changes=1" is configured. Ticket [c48d99d690].
FossilOrigin-Name: 9ddfe1e41300413bc9af7e5ce0ec9d1daf9136b1
2011-09-30 12:01:01 +00:00
dan
b061d058cb Add support for on conflict clauses to fts3/fts4.
FossilOrigin-Name: 6d2633a6d0a9bb88fb1a6adac0827dc51df2d4d2
2011-04-25 18:49:57 +00:00
drh
713de341a7 Disable the transfer optimization if the destination table contains
any foreign key constraint and foreign key constraints are enabled.
Ticket [6284df89debdf].

FossilOrigin-Name: ddeea5ab5f6c0c4a86cdfbbb9f24d9d54bf8d301
2011-04-24 22:56:07 +00:00
drh
2184fc75a2 Back out the SQLITE_OMIT_UNIQUE_ENFORCEMENT compile-option. It is an unneeded
complication.

FossilOrigin-Name: 927e955b93e869727c55b784401de3ea07bee257
2011-04-09 03:04:13 +00:00
drh
959b6a95ee Merge the scheme-parse-refactor changes into trunk: (1) added
sqlite3SchemaMutexHeld() asserts, (2) Use -1 instead of 0 to mean
"all" in sqlite3ResetInternalSchema(), and other cosmetic changes.

FossilOrigin-Name: 5db4511d8a77b74be3503a7c34257ef6b07541f5
2011-04-05 13:12:28 +00:00
drh
8d129422ed Fix the P4_TRANSIENT constant so that it works correct - so that it really
makes a copy of the string for the P4 argument.  Use P4_TRANSIENT wherever
appropriate.  Change P4_STATICs of schema names to P4_TRANSIENT.

FossilOrigin-Name: bf664b206bf6f5c1941da1986dfe2c0d1831d5e4
2011-04-05 12:25:19 +00:00
drh
2120608e0f Add a description of access rules for the Schema object and lots of asserts
to verify that the access rules are followed.

FossilOrigin-Name: ae8374af057b6e6546e9265148cfffe32fcb0849
2011-04-04 18:22:02 +00:00
shaneh
11c58f7d8e More tests for SQLITE_OMIT_UNIQUE_ENFORCEMENT and minor change to implementation.
FossilOrigin-Name: b86999436ec2414c990ba720441fe316f647eef6
2011-03-12 04:58:55 +00:00