437 Commits

Author SHA1 Message Date
mistachkin
e2848932a5 Fix harmless compiler warning seen with MSVC.
FossilOrigin-Name: e36217f2536d89f7a15a879fe3ead32307909c71ced42e1ae7b35f43d4744a80
2022-08-05 05:30:07 +00:00
drh
403f00219b Small performance increase on the binding interfaces.
FossilOrigin-Name: aab24c37fb444804fb91177b4b522909ef1bb85383444d97d82a758f919047d2
2022-08-03 19:37:25 +00:00
drh
2b294b543f Small performance improvement to sqlite3_finalize().
FossilOrigin-Name: 8a6913b66cc5af354497044ccb849eb80d00d0799362475f1537a6999196895e
2022-06-30 22:46:28 +00:00
drh
2591cfb673 Additional enhancements to comments. No changes to code.
FossilOrigin-Name: d9a320448f5693d906adf437800675cd4773701db065f3ed238b933fb80f6681
2022-06-22 14:25:12 +00:00
drh
1c8486301f Only invoke sqlite3VdbeClearObject() from a single location, so that the
compiler is more likely to in-line the code.  Performance increase and
size reduction.

FossilOrigin-Name: c6947a96e61f71aa61ca3d70d9e2612d784ab04d60fa88852b03cfce86b1bf2b
2022-04-04 01:12:11 +00:00
drh
35e9e350ca There is no need for sqlite3_step() to check for an OOM condition prior
to starting up.

FossilOrigin-Name: 44be7f46ba89289683ed0e123169ca9adb1018de03071d66de480c910a23d074
2022-04-01 19:13:39 +00:00
drh
a24832b7b2 Omit the Vdbe.doingRerun field for a slight size reduction and performance gain.
FossilOrigin-Name: e93297a9d775688e6274c54ba75b19fc1fe8b29b73b9b5e7f94f3f2ca37f045f
2022-04-01 19:04:13 +00:00
drh
17c4865b83 Refactor the Vdbe.iVdbeMagic field into Vdbe.eVdbeState. Split the RUNNING
state into separate RUNNING and READY.  This gives a size reduction and
performance increase.

FossilOrigin-Name: 5a50a42fde9477868fad31099f5fe976437825fac44f8b3a4cf6c739c7667bbb
2022-04-01 17:01:57 +00:00
drh
659fdb4da8 Have the sqlite3_context object carry the encoding for the prepared statement
that it represents, so that sqlite3_result() and similar can set the encoding
according to the prepared statement, even if the database encoding has
changed.
dbsqlfuzz c409b10d0a6bccf78ab00f47e1d29d42ee5b3565

FossilOrigin-Name: d4e19314f564126e180e091f9135c7bc55a10442edb46fbd3a4cfad21201dfa6
2022-04-01 15:31:58 +00:00
drh
99a218282c Split out the RUN state into separate READY and RUN states.
FossilOrigin-Name: d698826b08b88e227eb83f84b3cdb19f17306b532eccfa162090abccdf3c63d8
2022-03-31 21:15:09 +00:00
drh
66181ce2b8 Rename Vdbe.iVdbeMagic to eVdbeState. Remove unnecessary states. This is
a preliminary step toward splitting RUN_STATE out into several other states.

FossilOrigin-Name: ff91191d232305d44ae6c0fbca2542a749422dc716fa1fd5d54f58c7d6052c14
2022-03-31 20:04:49 +00:00
drh
7e62146b13 Faster and slightly smaller implementation of sqlite3Step().
FossilOrigin-Name: c6901a8c78838228f8135c9346b214e638b72086fd85367b9ff482273e62ece6
2022-03-30 17:56:27 +00:00
drh
c55b62d4cb In setResultStrOrError(), if the input string pointer is NULL and hence the
value gets set to an SQL NULL, then the Mem.enc field is uninitialized.  So
do not read it.  This is a harmless OSSFuzz/ASAN found problem.

FossilOrigin-Name: 47d0b1c4cfc3d2d8f57a02079276bb70a205ffd0f18007dd39c92f813d4c87f5
2022-03-29 22:57:00 +00:00
drh
fb92e07186 Fix the sqlite3_result_xxxxx() routines so that they all check for and
perform any necessary text encoding conversions and check for oversize
strings and BLOBs.  Thus those checks can be done where they are most
efficient and avoided in cases like OP_Function where they are more
expensive.

FossilOrigin-Name: d50b162b2f2e320af0889b931351f9443580465a933f6657fa98f437b6579277
2022-03-29 01:43:09 +00:00
drh
836652952f Calling sqlite3_value_dup() on a pointer value results in an ordinary
NULL.  [forum:/forumpost/ae8592cc73|Forum post ae8592cc73].  Test cases
in TH3.

FossilOrigin-Name: fff1243b594c190d15f14b7ca4e60d23519cd15134f275991c685966fcc24145
2022-03-14 23:50:38 +00:00
drh
4296357c90 The performance increase in the previous check-in of this branch was due to
the revised loop in initMemArray() and reordering fields of Mem - not the
call the memcpy().  Changing the code to avoid memcpy() results in an even
better gain, and code that is far less dodgy.

FossilOrigin-Name: d74aa979530d4236f5900d2ef998b27065d352d7c18bcd822e5c8f1041a1a81c
2022-02-28 12:08:09 +00:00
drh
c9373e86e8 An optimization to initMemArray() saves almost 500K cycles. But it seems a
little dodgy.  I want to think about this more before merging to trunk.
Perhaps there is a cleaner way to accomplish the same.

FossilOrigin-Name: 7fefd8676110a53e6c98a697e2dbf820740fe602a1e83b6caa8d099c41a15d80
2022-02-28 03:25:13 +00:00
dan
63a47336af Fix a problem in [c006515ae6faff65] causing an assert() to fail with some build configurations.
FossilOrigin-Name: d7ff262d6d1fd8b855bcb8f6f54ab1833663a4d8187701ddf045f6b5a62a5d1d
2022-02-11 16:10:18 +00:00
dan
252fe67bdd Fix a problem with using sqlite3_bind_value() with sqlite3_value objects obtained from sqlite3_preupdate_new() when an integer value is written to a column with real affinity.
FossilOrigin-Name: c006515ae6faff6525d589827d99092b06004472e32b7f586845c00c4732d695
2022-02-09 18:42:15 +00:00
drh
3d7a69e5ef Relax the restriction that the RHS of the IN operator must be a list in order
for sqlite3_vtab_in() to work.  Change an unreachable branch into an assert().

FossilOrigin-Name: 3bf2153440dce0e8c0572c4fd39e6b9f34ead75ccab2cea80a646d4ff9d19146
2022-02-02 16:24:01 +00:00
drh
38d1e44350 Be sure that sqlite3_vtab_in_first() and _next() set the correct encoding.
FossilOrigin-Name: 04edf36ee8e043c83235a5169a7ced23f211edd2f7ef3290d96413d5fd229ad7
2022-02-02 15:10:45 +00:00
drh
30e314e4cb Refactor sqlite3_vtab_in() to make use of the existing
sqlite3_value_pointer() mechanism for passing the list of IN operator
RHS values into xFilter, for improved memory safety.

FossilOrigin-Name: 8965929be236fe1a6994f31b94c1b7590c7c1e809470c542a76f3e0e275d032f
2022-02-02 14:36:58 +00:00
drh
b30298d3ea Tweaks to the sqlite3_vtab_in() interface.
FossilOrigin-Name: 75040183b8e14f20bfedfdcc1a9fb968f2f0193bc698605d1b4791a3699b93d9
2022-02-01 21:59:43 +00:00
drh
0fe7e7d924 Add new interfaces to enable virtual table to process IN operator constraints
all at once, rather than one element at a time.

FossilOrigin-Name: eb84b80e1f6d8c32bf0c9e1731f0233de0160a13f714f766779ae01fdf504e7b
2022-02-01 14:58:29 +00:00
drh
3ab4ffce1f New assert() statements to help prove correct usage of VdbeCursor objects.
FossilOrigin-Name: 7cee62f77a9e7c3cf886f136e75a93c3bbbb88e48b66035883bea5503d9fc03c
2021-11-11 11:23:08 +00:00
dan
a32536b498 Fix the zeroblob() function and related APIs so that they work with SQLITE_OMIT_INCRBLOB builds.
FossilOrigin-Name: bc401a75dd9f3c29c5969ae36264e68ccefc0937e44e232ca1f6b550f7fd6e22
2021-11-08 19:35:26 +00:00
drh
dbe349dfa5 The sqlite3_result_text() routine (and similar) should record OOM errors
in addition to SQLITE_TOOBIG errors.
dbsqlfuzz

FossilOrigin-Name: eca434362652fe2edd6090b29417b35bc88a170609810aa9d266f6fc27baeab8
2021-10-13 13:00:34 +00:00
drh
d622855e34 Set the database connection error code for an oversize argument to
sqlite3_bind_blob64() or sqlite3_bind_text64().
[forum:/info/a636276f0d451667|Forum post a636276f0d451667] and
[forum/forumpost/33821c8db543c|33821c8db543c].

FossilOrigin-Name: 56ff58c0b8905aa10c85f1418da8d6089d23fd9a220c5cb17027d46affe05002
2021-06-09 14:45:02 +00:00
dan
a23a873fbb Add the experimental sqlite3session_changeset_size() API.
FossilOrigin-Name: b5564a6fd54875db1de884fdc0e5eeabcd6aa5595ad03a8a60843503e830a2d8
2021-04-21 20:52:17 +00:00
drh
17b74817c0 Change the name of Vdbe.magic to Vdbe.iVdbeMagic to disambiguate with
sqlite3.magic.

FossilOrigin-Name: 6b29e549bb34933bfd0758e31085e65dcc0f75446c478fc775d96cf01c22cf43
2021-02-03 18:32:25 +00:00
drh
08b9208660 Fix harmless compiler warnings that surface in newer versions of GCC.
FossilOrigin-Name: 9d670a318381f219b467653f5f9539097808b887ae37291ce13be462dedfb18d
2020-08-10 14:18:00 +00:00
drh
5cbb442ea3 Small performance improvement in the sqlite3_step() interface.
FossilOrigin-Name: 61400ef9f1337c77263b4d3e43a1983b0c4cf7137f066a2691768c98877035ef
2020-06-29 13:12:42 +00:00
drh
bbf6d4328e Adjust some requirement marks. No changes to code.
FossilOrigin-Name: 7285ae2ce8fb1439e1acea2ec321abbc76aab0a2e84b58683fddb0a7bf74fb1b
2020-05-15 15:03:51 +00:00
dan
892edb69c4 Use __atomic_load_n() and __atomic_store_n() for a few more things where they are available.
FossilOrigin-Name: a49f8ec552bede7da731e0571ccf49de1a30e7be3a5673150436c8b411ba6ffc
2020-03-30 13:35:05 +00:00
drh
b9bcf7ca60 Refactor names of column index transformation functions, for clarity.
Get generated columns working with ALTER TABLE RENAME COLUMN.

FossilOrigin-Name: 27ab41c9102e7801ff829488fc123a8040da008bef373d6704efbe2f93e1da90
2019-10-19 13:29:10 +00:00
drh
175b8f06f7 Remove support for STAT3. The sqlite_stat3 tables are ignored, if they
exist.  STAT4 continues to work as it always has, and as it is a superset of
STAT3 is the recommended replacement.

FossilOrigin-Name: 1e17ea2fd1df4ad49138c787c8fe3207dd0c25c93f9001d52a9b69f8c12e841c
2019-08-08 15:24:17 +00:00
drh
3242c69c91 New testcase macros to ensure that MEM_IntReal is fully tested.
FossilOrigin-Name: 8b8ef445ccccc148af2cda5975986af0d134352fe16283f65d0f8a91c9ffa932
2019-05-04 01:29:13 +00:00
drh
0c8f40389e Add the SQLITE_TESTCTRL_RESULT_INTREAL test-control and use it to create
the intreal() SQL function in testfixture.  Write a few simple tests to
prove this all works.  TH3 will hold most of the INTREAL tests, probably.

FossilOrigin-Name: c9838731325e0ca73bd8784c10c74ae043fed7861e6de269fd90e29fa4a19955
2019-05-03 21:17:28 +00:00
drh
f2566c4132 Improved comments on the elements of the array constant used to implement
the sqlite3_value_type() interface.

FossilOrigin-Name: f73a7de7a53f6aa6517221550a9c9882893206edfd7433e80e5fc0f441db9fc4
2019-05-03 17:08:16 +00:00
drh
169f077e07 Make MEM_IntReal a completely independent type, meaning a floating point
value stored as an integer.  This fixes a problem with arithmetic within
arguments to string functions on indexes of expressions.  But it is a big
change and needs lots of new testcase() macros for MC/DC and so it is
initially put on this branch.

FossilOrigin-Name: dba836e31cb29d339b4520acb06188a892a52e45c50aba9742966b01108e251a
2019-05-02 21:36:26 +00:00
drh
de7109e61b Ensure that the typeof() function always returns SQLITE_FLOAT for floating
point values even when the value is stored as an integer to save space.

FossilOrigin-Name: 48889530a9de22fee536edfd1627be62396ed18d842d5fd6d91e010b4337be95
2019-05-02 17:45:52 +00:00
drh
07891f0294 Remove a stray tab from the source code.
FossilOrigin-Name: 0ada58e9303d53aba8bdc37abe5904aa40e91f80e247eb51cb1192387b0d661c
2019-04-14 00:40:29 +00:00
drh
57b1a3e303 Initial implementation of the sqlite3_value_frombind() interface.
FossilOrigin-Name: 98da62dfdacc6b3c490c387d1f8a74cc5daa978776967e264ad4800c380b0ddf
2019-03-29 11:13:37 +00:00
drh
39c5c4ae06 Add the sqlite3_stmt_isexplain() interface.
FossilOrigin-Name: ee642d3e2775ba4c73627ac71d0abf7a0f7a4ab3151d88e0076e9992f4814983
2019-03-06 14:53:27 +00:00
dan
4474e869fe Fix a problem preventing compilation with SQLITE_OMIT_UTF16.
FossilOrigin-Name: 906d1fd8650874236e0bf5734d5347dcc45ec036164a56570fec37da4ffeaf8f
2019-03-04 07:15:57 +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
cfc078318c Small performance improvement in sqlite3_step().
FossilOrigin-Name: d1db8d5894450b24bb0335983503d9bbf6cc48a0ae4b83291283fb2d32b6b25b
2018-12-11 12:51:46 +00:00
drh
368bfe8b00 Small performance improvement in the sqlite3_bind() family of interfaces.
FossilOrigin-Name: 1dc0c3df32572f09265fc73eeaa0748159e0e9523b9b2d6768b834a29c909968
2018-12-11 12:20:41 +00:00
drh
1a6c2b1d38 Further refinements to the sqlite3_normalized_sql() interface. TH3 now
gives 100% MC/DC on that interface.

FossilOrigin-Name: c96bf6cca220e363b099455ce35195ce7e89d374a52dc787f56e7b11e587bced
2018-12-10 20:01:40 +00:00
drh
1f169fefca Fix a missing mutex in the sqlite3_normalized_sql() interface when it is
called on a prepared statement that did not previously have a computed
normalization of the input SQL.

FossilOrigin-Name: 1a1a59c6c570879c8f318bbc132103c0285088ba233dd8c32e049b86419347b0
2018-12-06 01:08:58 +00:00