1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-04-20 08:47:46 +03:00

1192 Commits

Author SHA1 Message Date
dan
0f42f71da2 Fix an obscure problem with releasing savepoints stored in an in-memory journal that could cause subsequent savepoint rollback to fail.
FossilOrigin-Name: 73c2b50211d3ae26aeb89976ec7b9fcd7de9f152b283ec7d0809ad18bddc603e
2022-01-01 19:29:50 +00:00
drh
021e228ec0 The pager now remembers when a VFS reports that a database file is
SQLITE_OPEN_MEMORY and treats that database as an in-memory database.

FossilOrigin-Name: 967b65623807ff992869da0a7d9b0105701939c4658a7aee37a30fb267869c6d
2021-10-23 20:32:27 +00:00
drh
da125367fc Add NEVER() macros on branches that become unreachable due to the
previous check-in.

FossilOrigin-Name: 5fa272cc033216ed2d3b16078db58accf4d9a3d10e6dd64d362ef844b3e267b6
2021-10-16 18:53:36 +00:00
drh
aa6fe5bf10 Fix harmless static analyzer warnings.
FossilOrigin-Name: 6604a085964121113e7b7f57537a0ba64ba058d0eb12bf0a3aeb6d1b7a29d516
2021-10-04 13:18:44 +00:00
drh
e85e1da07b Fix harmless compiler warnings.
FossilOrigin-Name: 94b59691ee50a4666b25e36d1529fc52f714bbe94c3e8ccb35bf0a4ea11050db
2021-10-01 21:01:07 +00:00
larrybr
b01f1389f2 Squelch needless narrowing warning.
FossilOrigin-Name: 5540e6abc1a2a8540113ec9bfebe1fb78d6a044f45396dd1926b65ff17ff236b
2021-09-15 11:15:03 +00:00
drh
57dd7e6ad8 Fix an incorrect comment and possible integer overflow in pager
resulting from check-in [23ca23894af352ea].  Problem reported by
[forum:/forumpost/e2ea1a3f61|forum post e2ea1a3f61].  Also change
the datatype of Pager.pageSize to i64 even though page size never
exceeds 65536, in order to help prevent future problems of this kind.

FossilOrigin-Name: f4a552ed9f4ab35520b634954c39748cc7bda535f426280b79da1b99f70599ac
2021-09-13 13:53:13 +00:00
dan
9023444fea If an EXCEPTION_IN_PAGE_ERROR exception is caught, make the underlying OS error code available via sqlite3_system_errno().
FossilOrigin-Name: fdb20e9ee48465b94aa6ac3c5e263ecaa7c3b10f4a193e79f965b7c35944b08b
2021-09-10 21:28:56 +00:00
drh
8d889afc0d Enable the sqlite3_serialize() and sqlite3_deserialize() interfaces by
default.  Omit the SQLITE_ENABLE_DESERIALIZE option and replace it with
the SQLITE_OMIT_DESERIALIZE option.

FossilOrigin-Name: 6df3b03e00b1143be8fed3a39a58ce81063020275aa1ac13d87c84f1ceda6e27
2021-05-08 17:18:23 +00:00
drh
55938b5fa0 Remove an ALWAYS() that might be false under very unusual circumstances.
dbsqlfuzz 300261f469ace7ecc57ed32ea7b0de3ea9d7dbf.  Test case in TH3.

FossilOrigin-Name: 466f508973e7adc983a4c9bd7c86b4d9269e3b990183fc7f95a50fe72b832ad0
2021-04-08 19:56:58 +00:00
drh
8119aab3c8 Further improvements (subsequent to [d91450847a3a3a72]) to handling of attempts
to delete a journal using the memdb VFS.
dbsqlfuzz ac61dab357279a6a531de067f040e9a4828d2df0.

FossilOrigin-Name: a0839406426a0d8ec52cc3116ea7d8b582344b44f3f8c9365bbf5187370c3386
2021-04-06 13:03:06 +00:00
drh
e3814ee026 Fix an assert() that can be false when doing an incremental vacuum on a
corrupt database file.  dbsqlfuzz cced0668cfd4da4eb2382cb9dd26c17c64aaff76.

FossilOrigin-Name: 15b801016fa204b8e4b7c89e236adb73dd57687959d825664de5097370b24030
2021-04-05 17:50:38 +00:00
drh
d5e7fff2ca Do not invoke the xDelete method when converting to PRAGMA journal_mode=OFF
if the underlying VFS does not support that method.
dbsqlfuzz 39d6af88ef5242f866c4f9b21ede330c5c1e36a8.

FossilOrigin-Name: d91450847a3a3a7217f8f5947adea9a4d12cf77607d40f9724d6ba093919b524
2021-04-05 13:41:42 +00:00
dan
f43fef29bb When a sub-transaction is released, if no pages required by containing sub-transactions were journaled, truncate the statement journal. This might prevent out-of-control statement journal growth in some cases.
FossilOrigin-Name: e36327fb22db08763a82fb517407ff5ab0dbc053953098033e7e50796a777810
2021-02-22 15:44:45 +00:00
dan
f5c3a75b63 Fix a bug in OOM handling code introduced by [6a28713d].
FossilOrigin-Name: 8a786ce99491401dd7660e54f1a1ba3b2300cecbe180b1a31e549ff5f5b77bdc
2020-11-24 17:55:34 +00:00
dan
2e3cb1382f Ensure that super-journal and other journal filenames passed by SQLite to an sqlite3_vfs.xOpen() implementation may be safely passed to sqlite3_uri_parameter() and similar functions.
FossilOrigin-Name: 6a28713d59cde0882c3508160347c2ea18c7c4e9bfd1b053103af2d5e12a144c
2020-11-24 16:44:09 +00:00
drh
14d093f847 Fix a harmless compiler warning.
FossilOrigin-Name: 6f91769fdb0734905f05e1f4d1c81364e6e874450c9f13a0de2259d564f582a7
2020-08-09 17:58:45 +00:00
drh
8afc09dea3 Fix the check-in at [41474548ef3f7454] so that it computes the pointer in
time for error checking at the end of the routine in the case of a non-OOM
error.

FossilOrigin-Name: 13d2fed760e7d0def573c56b7181f45622b0ed78d61952a6de901f96949d074e
2020-08-08 20:15:16 +00:00
drh
c664355c0f Move a pointer computation until after OOM checks to avoid a nuisance USAN
warning.

FossilOrigin-Name: 41474548ef3f7454e44fbf648429730b3f5ba1ff0086fd2f2d0e59b8f51d85e6
2020-08-08 17:55:39 +00:00
drh
abc3815860 Continuing work toward supporting unsigned 32-bit page numbers.
FossilOrigin-Name: 9ce1710aad43cebe5ad50859c7685fb83e40cdd4a60913bd2b7e659bc59942fd
2020-07-22 13:38:04 +00:00
drh
e9261dbd53 Initial changes to allow database up to 281TB in size.
FossilOrigin-Name: 9cb7da9bdb666ea40771513b89591dca275f1e92092b39190df747e3797178a3
2020-07-20 12:47:32 +00:00
drh
067b92ba00 Extend the refactoring into extensions. Clean up stray newlines.
FossilOrigin-Name: 7a876209a678a34c198b54ceef9e3c041f128a14dc73357f6a57cadadaa6cf7b
2020-06-19 15:24:12 +00:00
drh
ccb2113a62 Refactoring various names. No changes in the resulting machine code.
FossilOrigin-Name: 7bb08b1bfcf184e4b59c8c9028926a0052612ff6a6731914ccdb8dee07ea4a98
2020-06-19 11:34:57 +00:00
dan
861fb1e9dc Block on the WRITER lock when attempting to run recovery.
FossilOrigin-Name: 105d6c9bbcadc64faa2b24e315cb13227b17cfc6bf1b3512713f80ce56976a3d
2020-05-06 19:14:41 +00:00
dan
58021b237a Unless upgrading an existing read transaction, have ENABLE_SETLK_TIMEOUT builds attempt to use a blocking lock when opening a write transaction on a wal mode database.
FossilOrigin-Name: d6f819a9e6b35f3fd558bd93255a6a24ad690a0fa15a82b009ca9c641db983c6
2020-05-05 20:30:07 +00:00
dan
8714de97c0 Changes to avoid deadlock in SQLITE_ENABLE_SETLK_TIMEOUT builds.
FossilOrigin-Name: 553423c23142cf0ec219192315d57ce8a0e10c3d8678d28bc110a1a9a7c17cee
2020-05-04 19:42:35 +00:00
drh
ab2172e69f The new sqlite3_database_file_object() interface requires that the pager
never invoke xOpen with SQLITE_OPEN_MAIN_JOURNAL unless it is using
a pointer to the journal name found in the Pager structure itself.   Make
this the case when processing a master-journal.

FossilOrigin-Name: b4987a5ced0c0f2c606c040e0c1b8ee11175f40ae35a7446308a43e77b1f1db2
2020-04-24 18:20:30 +00:00
drh
480620c713 Experimental API: sqlite3_database_file_object().
FossilOrigin-Name: ae697b152d22737169892411a0c4d908895ff5fb249cce9bdb1ba0bbe32806f0
2020-04-21 01:06:35 +00:00
drh
be284e4ece Fix harmless compiler warnings from MSVC.
FossilOrigin-Name: 951b39ca74c9bd933139e099d5555283278db475f410f202c162e5d1e6aef933
2020-02-27 16:21:39 +00:00
drh
47a60d4518 Extra zero terminators on the end of the blank filename returned by
sqlite3PagerFilename() for an in-memory database.  This helps the result
work better with sqlite3_filename_journal() and similar functions.

FossilOrigin-Name: 63e533d28e87bbb10e0c611de4b79d22aae291b163fe59d1f95dcad9ab3939e4
2020-02-27 13:54:18 +00:00
drh
4defdddc31 Add the new sqlite3_create_filename() and sqlite3_free_filename() interfaces
for use by Shims.  Use these interfaces inside the multiplexor.

FossilOrigin-Name: 9469f36ac89e4b75d0ab25fefbeff25201992c53141da915dcaa017083cab6db
2020-02-18 19:49:48 +00:00
drh
b48c0d59fa Simplify the code by removing the unsupported and undocumented
SQLITE_HAS_CODEC compile-time option

FossilOrigin-Name: 5a877221ce90e7523059353a68650c5fdd28ed032807afc2f10afbfbf864bdfe
2020-02-07 01:12:53 +00:00
drh
532b0d23fd Revise the layout of filenames in the Pager object so that it is unchanged
from prior versions.  It turns out that some important 3rd-party software
does questionable pointer manipulations on those filenames that depend on
that legacy layout.  Technical this is a misuse of SQLite by the 3rd-party
software, but we want to avoid unnecessary breakage.

FossilOrigin-Name: 34ab760689fd493eda482e856047708d74e769a01cc90b69da456d79ffe39aea
2020-01-27 14:40:44 +00:00
drh
f71eb2091f Do not use memcpy() of zero bytes when initializing a pager. This avoids
a warning.

FossilOrigin-Name: cca437788e092b21ed1784dd94d4b1c7204ff1717538d276a10880d1345904bd
2020-01-18 19:46:42 +00:00
drh
cea7b5d57e Add extra front margin to the fake empty filename returned by
sqlite3PagerFilename() for an in-memory or TEMP database.

FossilOrigin-Name: fee945671a19a93287f9bfadc346f9821fb1311c7fc75b95a6a48d1419c840e7
2020-01-18 14:50:06 +00:00
drh
8080403e44 Redesign for better legacy compatibility. Add the sqlite3_uri_key() interface.
FossilOrigin-Name: bcb43d11c4d0be36888c9e968ccdf85e7d7fccd72a29866f85c014e0562d4b93
2020-01-11 16:08:31 +00:00
drh
8875b9e7b5 Rearchitect the way in which filenames are stored in the Pager object so that
the sqlite3_uri_parameter() interface will work from journal and WAL filenames
too.  This check-in implements the central idea, and compile and runs somewhat,
but crashes on an extended test.

FossilOrigin-Name: 2ae77bd2335708343bce4541b4d2cf16edfe3fd5bc2dfb93757238c926aa960b
2020-01-10 18:05:55 +00:00
drh
fce8165ec6 Ensure that the Pager.changeCountDone flag is cleared whenever dropping
the write lock, even when transitioning from EXCLUSIVE locking mode into
NORMAL locking mode while in WAL mode.  Ticket [fb3b3024ea238d5c].

FossilOrigin-Name: 846b1de6e5a9e418f225273dc033234c64c116fcd89c8261522b4902c248451f
2019-12-27 01:50:46 +00:00
dan
7a1d7c3968 Fix "PRAGMA data_version" so that it works the same way with locking_mode=PERSIST and journal_mode=PERSIST configured. Fix for 7a458c2a5f.
FossilOrigin-Name: 45748e2db028ffbda5d3e747493721a5a89af3fbc06823081a2f27f570e40e73
2019-12-22 14:29:55 +00:00
dan
879f1a1ea6 Fix a bad interaction between RBU and [df51ae19].
FossilOrigin-Name: 0b9d8a1202c4220fd2ef299b6194533c1bf4018a0cd2d13da7e22c1a7de05ffa
2019-12-20 20:03:21 +00:00
drh
c398c65bee Revise the SQLITE_OPEN_NOFOLLOW so that it actually uses O_NOFOLLOW in the
open() system call.  This backs out the SQLITE_ACCESS_SYMLINK value but adds
the new SQLITE_OK_SYMLINK return code from the xFullPathname method of 
sqlite3_vfs when that routine resolves symbolic links. O_NOFOLLOW is always
included in open() system calls for journal files.

FossilOrigin-Name: 6a64fb6a2da6c98f1e87b55ad5689967e1db4eae2e08345471d95e28cd567e0f
2019-11-22 00:42:01 +00:00
mistachkin
dc96192eef Ensure all file names passed to the VFS layer are double-zero terminated.
FossilOrigin-Name: 251230cf43c591cf49cf9d2f392581c57d334b791bc3407814d216b5999c32f4
2019-11-18 22:34:07 +00:00
drh
3c904885b1 In the SQLITE_OPEN_NOFOLLOW processing, distinguish between an I/O error
on the xAccess() call and an actual symlink encounter.

FossilOrigin-Name: 2e98b42fcb7bc38e22808a9dc1d7a4231ed08ffa97c9f08f33e6e8cd8726856c
2019-11-18 18:43:19 +00:00
drh
0933aad72c Add support for SQLITE_OPEN_NOFOLLOW.
FossilOrigin-Name: cb79c828496a703f1410f61458ebc1e15a92a63412b36f51945b2b5a32ec6e88
2019-11-18 17:46:38 +00:00
drh
d2c40e9310 For for the previous check-in: Always enable the nUri variable, even
when debugging is turned off.

FossilOrigin-Name: f84a15394c369cbdb6fba87c603a609722cf1f499626c7f20699060273ab5081
2019-11-12 16:21:27 +00:00
drh
746461f1b8 Ensure that the main filename and the journal filenames in the pager
object are all correctly double-zero terminated.

FossilOrigin-Name: df51ae19c1aa4c26f2dcd427eddc1c9cc24b698e1ab0a948b198a57432e25e1e
2019-11-12 14:43:47 +00:00
drh
aff0fd483c Add an "|| CORRUPT_DB" term to an assert() that might be false if the database
is corrupt.  Also add a branch to have sqlite3PagerMovepage() return
SQLITE_CORRUPT in that case.

FossilOrigin-Name: b0d5cf40bba34e459caa7480bc84a1d75496c2ab52029f4bb0a31f2d9369a8ee
2019-03-06 14:08:41 +00:00
drh
e22976c535 Fix the SQLITE_DIRECT_OVERFLOW_READ compile-time option so that it works
with SQLITE_HAS_CODEC.

FossilOrigin-Name: fd085e9260bec18f968704abb2dd324d954baa121d13b67c3f5b801e9e3834aa
2019-03-02 15:25:24 +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
dan
3fd7eaf3f2 Avoid using non-ANSI return statement in void function sqlite3WalSnapshotUnlock().
FossilOrigin-Name: 4a4952d38e8177ed8d59aaa575410bebf76787dd6d801fdbdb809d4f8c670da0
2019-02-11 11:04:17 +00:00