1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-01 06:01:49 +03:00

19158 Commits

Author SHA1 Message Date
5d60f47001 Approximately 50 typo fixes, spanning the whole tree, contributed via [forum:006c8fa165083ac3|forum post 006c8fa165083ac3] and individually checked for correctness. Affects only code comments, docs, and a single line of debug output in a test app.
FossilOrigin-Name: af928818a030924060ee0762431dae0f16d53a62f4e1132754d052eb9c621ac2
2025-02-25 20:55:14 +00:00
drh
846643ebad Change the default control-character escape algorithm from "symbol" to
"ascii", since the "ascii" algorithm works even on terminals that do
not support unicode.

FossilOrigin-Name: d35320495eb282601ab4f3b9efc53c7c1d58e890f025317e34c7046a43c8cb53
2025-02-25 20:10:46 +00:00
drh
1c03a34400 Fix harmless "unused parameter" compiler warnings.
FossilOrigin-Name: 7a68a3ead8e6c75203641542256bcfa05067bed4bf9035452fbd134534801a08
2025-02-25 20:02:58 +00:00
drh
82769e7d04 Improved help messages for the --escape option in the CLI.
FossilOrigin-Name: e6784af6d50f715338ae3218fc8ba1b894883c27d797f0b7fd2625cac17d9cd7
2025-02-25 18:10:47 +00:00
drh
87ad172c50 Enhancements to help avoid problems in the CLI when trying display content
that contains ANSI escape codes:  (1) Add the --escape MODE option to the CLI
where MODE is one of "symbol", "ascii", "off" where the default is "symbol".
(2) Add the unistr() SQL function.  (3) Add the unistr_quote() SQL function.
(4) Add the %#Q and %#q conversions in the built-in printf.

FossilOrigin-Name: e3e509ae145ee2623ac68ededa59991a97fcd28313e03f67a3890b560c5381b0
2025-02-25 15:57:49 +00:00
dan
58bc525e32 Reinstate the assert() removed by [0f6223b8]. Avoid holding a wal-mode write lock after the transaction has been rolled back if an IO error occurs while restarting the wal file.
FossilOrigin-Name: 277e150d6ab75de2407f6761aa2359df80a4e1dbce30788df06621dee05b2ef1
2025-02-25 15:27:55 +00:00
drh
d4c686ed8f Small performance improvement for the new %#Q conversion in printf.
FossilOrigin-Name: 17e440781e68d7d3ea68c5144e1e08e183f0caef595a6c7ac4ce56489c60f476
2025-02-25 12:18:27 +00:00
drh
a357a90f12 Consolidate two different UTF8 encoders into a single subroutine.
FossilOrigin-Name: 6208e494858b9d362efc7db4e8aac6f8e93fe51d2e038c94dfa97c55a74688a0
2025-02-25 11:47:34 +00:00
dan
a4cf066d64 Remove an assert() added by [e88212b1] that is sometimes false.
FossilOrigin-Name: 0f6223b8f6c044db687f78e19f6373d0dda9155445c511a297efa05bac3b16e5
2025-02-25 11:29:04 +00:00
dan
f037440bfe Support SQLITE_ENABLE_SETLK_TIMEOUT on windows.
FossilOrigin-Name: e88212b10a7829ff42ef51a02863d788c929e54161faf492f9ef2ad90fd7074e
2025-02-24 21:27:16 +00:00
drh
81d44c7e3e Use an assert() to fix a harmless (false-positive) scan-build warning
in the CLI.

FossilOrigin-Name: 4c56cd7392f114e27b43d8fcc79444c3078cd65285ba7dd3338a414e2a9f5392
2025-02-24 20:13:29 +00:00
drh
e4f7af1908 Only use unistr() in columnar formats when strictly needed.
Do not use unistr() in insert mode when --escape is off.
More test cases.

FossilOrigin-Name: e029828de91b10b4c7f4a19bc70c35e4f36fae4ebf32b40553a6ba9f2b3af295
2025-02-24 17:50:49 +00:00
drh
b6205d4bc3 Add the unistr_quote() function that works like quote(), but also escape
control characters using unistr() if necessary.

FossilOrigin-Name: e99e37b54baf7283588ead4983e613a1e14c58a0b92be5f7b25b4d9d287b5324
2025-02-24 13:51:24 +00:00
drh
7db5e50b8d Bug fix and initial test-case infrastructure for control-character escaping
in the CLI.

FossilOrigin-Name: c809997792602a7299b8ab84d018a03d291695e308ce750fc8b9d7a824edfd6e
2025-02-24 13:27:16 +00:00
drh
21b431e685 Ongoing work to get all the quoting and escaping variations in the CLI
working correctly.

FossilOrigin-Name: b77aea93e7eff0af408f598727caedcfc4428361b8440fbc1cc54c18f93abb69
2025-02-24 12:41:30 +00:00
dan
b081a391ce Merge latest changes from trunk into this branch.
FossilOrigin-Name: 55324d1c862c42b95251a398c40930d9fa94debb1aec7d3d0ae734d6b17b4a59
2025-02-24 10:52:34 +00:00
drh
6a9c3b407e Make column output modes in the CLI responsive to the --escape setting.
FossilOrigin-Name: 14ff5557d450475ad959f8c753c0cecb85dfca7346fcacd91da16e4d36e30508
2025-02-24 00:40:36 +00:00
drh
96a65cc474 Three different --escape modes: symbol, ascii, off.
FossilOrigin-Name: b5adb52fc0dc1838cb9c66cff422f2b8ec147e546cf909dd3c48731fa1edfe50
2025-02-24 00:18:12 +00:00
drh
9ba963f035 Further improvements to control-character escapes in the CLI.
FossilOrigin-Name: 9c2f974c17e3dfac78f3808fdfe916f7617cfdaa64430af38eae21bd6592e6f5
2025-02-23 20:50:37 +00:00
drh
8d15d7ed68 Work toward VT100-safe output from the CLI by default.
FossilOrigin-Name: 44c44620e8648a4265053f194e32b3a5c65d25b4f1fff61ef9b944e7cb0ed624
2025-02-23 20:20:56 +00:00
drh
a3283ec135 The %#Q conversion now adds unistr('...') around the converted string if
escape characters were inserted.  %#w now works just like %w as escape
sequences inside of identifiers are not recognized.

FossilOrigin-Name: 997391d42079783e294836f714ccd9526ecc442c8dbf8212d72cd17c67e7158a
2025-02-23 11:48:07 +00:00
drh
07ce1820a0 Enhance the %Q, %q, and %w printf conversions so that if the alternate-form
flag # is present, they transform backslash and control characters into
unistr()-style backslash escape codes.

FossilOrigin-Name: ffbfcc2bbb57f02aa5ee813e7a25a2a014e3353a10f6bccb609075a5b63545d7
2025-02-23 00:09:24 +00:00
drh
4d70dbad57 Prototype implementation of the unistr() SQL function.
FossilOrigin-Name: 7cc302de05ed2a973372c05f55b048bf99af3d2590dd29f6fd0f379fb451aa0e
2025-02-22 23:18:38 +00:00
drh
c071c47b51 Tamp down various harmless compiler warnings. Use "int" in places instead
of "u16" or "i16" since the compiler complains less and generates faster
code.

FossilOrigin-Name: 742827f049768c4f69ccdfaadfad339aaad3bc126d3a68b90cfea01d825bf7ce
2025-02-22 16:44:14 +00:00
drh
447f1c2312 Fix an incorrect assert added by [d7729dbbf231d57c].
FossilOrigin-Name: eeea11278bdebe336f0c30fbad79e30e3456ab67dae46abdd5f9951ea1b61bed
2025-02-22 11:40:29 +00:00
drh
cc803b209f The number of declared columns in an index is limited to SQLITE_LIMIT_COLUMN.
But the actual number of columns in the implementation might need to be
twice as much to account for the primary key at the end.  Ensure that the
code is able to deal with this.  This is a correction to
check-in [d7729dbbf231d57c].

FossilOrigin-Name: 5822feec43be9352fd87bf9968c39c0218e01ab5fe3ba50431ae21cba79e6c89
2025-02-21 20:35:37 +00:00
drh
ce25007db8 Detect when a UNIQUE or PRIMARY KEY on a WITHOUT ROWID table would need
to use more than SQLITE_LIMIT_COLUMN columns and raise an error.
Also include some unrelated compiler warning fixes.

FossilOrigin-Name: d7729dbbf231d57cbcaaa5004d0a9c4957f112dd6520052995b232aa521c0ca3
2025-02-21 17:03:22 +00:00
eb0d2e7bc6 Increase default CLI shell .prompt buffer length to 128 bytes, based on discussion in [forum:362f185a6aa|forum post 362f185a6aa].
FossilOrigin-Name: 628407f03d4bfb7499f0e6e2197089edf859380a3c4e6fecc517390327718141
2025-02-19 13:05:33 +00:00
2e132a4c04 Slight tweak to the CLI shell help output to help convey that it can accept multiple SQL arguments, as suggested in [forum:20e617feee|forum post 20e617feee].
FossilOrigin-Name: 82fc67070f9aff0065c07cbeed40f4321e03617bdc3e517adc58a2d96e6e3e49
2025-02-19 13:02:23 +00:00
drh
7bfa4452a3 Additional changes making it easier to prove that integer overflow does not
occur.  No problems found.

FossilOrigin-Name: e846743a875430a5c51d41f00ac9532214f97d9925e6261113b63580f92369fc
2025-02-17 18:09:24 +00:00
drh
ef86b942b9 Code changes that make it easier to prove that no 32-bit integer overflows
happen during memory allocation.  No problems fixed; this change is just
to make future maintenance easier.

FossilOrigin-Name: 215650a5a1d55bdbca9c92524804a1a54456a17f42a17e53747b21a6507506f5
2025-02-17 17:33:14 +00:00
drh
56d2fd008b Harden the SQLITE_DBCONFIG_LOOKASIDE interface against misuse, such as
described in [forum:/forumpost/48f365daec|forum post 48f365daec].  Enhancements
to the SQLITE_DBCONFIG_LOOKASIDE documentation.  Test cases in TH3.

FossilOrigin-Name: 1ec4c308c76c69fba031184254fc3340f07607cfbf8342b13713ab445563d377
2025-02-17 14:16:49 +00:00
drh
59c64e086a Fix a typo (a missing ")") in a comment that is used to generate
documentation.  No changes to code.

FossilOrigin-Name: ea21685658df8246551650666ff59945ac27271b10a675104cbadaf57d48595f
2025-02-17 10:58:23 +00:00
drh
f4fc2ee203 Add a typecast to avoid 32-bit integer overflow in the concat_ws()
function with an enormous separator values and many arguments.

FossilOrigin-Name: 498e3f1cf57f164fbd8380e92bf91b9f26d6aa05d092fcd135d754abf1e5b1b5
2025-02-16 10:57:25 +00:00
dan
5087eacb18 Ensure the counts of "deferred FK violations" and "deferred immediate FK violations" are kept separate when "PRAGMA defer_foreign_keys" is used.
FossilOrigin-Name: c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2
2025-02-13 14:47:25 +00:00
dan
8bbce21ed7 Have the win32 VFS take a temporary shared lock (instead of the current exclusive) on the pending-byte when taking a SHARED lock on a db. Do not lock the pending-byte at all when taking an EXCLUSIVE lock if RESERVED is not already held.
FossilOrigin-Name: 5127509abb10cb1da35b9874ea63e0c2f882b10567606e2bdd636a50811a693c
2025-02-12 17:21:24 +00:00
dan
41f29806a1 Fix test script errors in walsetlk3.test. Tests still don't all pass.
FossilOrigin-Name: 56eb4114f8bf9971960998ae0b79352767657ee19b5bdfec5149906e72ba170f
2025-02-12 08:07:10 +00:00
drh
cd56ad4ccb Omit the src/pragma.h file. It is generated by the tool/mkpragmatab.tcl script.
The makefiles now know how to build this file for themselves.

FossilOrigin-Name: 9709ed1cdfa17f690ffd4ec8cfc54efefec8352143c1d8b701f09299bd7eef6e
2025-02-11 19:54:13 +00:00
drh
374c6a451e Omit the src/ctime.c source file, since it is automatically generated by a TCL
script.  Instead, add rules to the various makefiles to generate ctime.c on
demand.

FossilOrigin-Name: 958bb5de7c484cc503c38d38d51a30f679244fd364df5cbfc1992e36995b2ff9
2025-02-11 19:40:19 +00:00
dan
e5769f6525 Update tool/mkctimec.tcl so that sqlite3_compileoption_xxx() APIs report on the SQLITE_ENABLE_SETLK_TIMEOUT option.
FossilOrigin-Name: 303e8009ab59aad32030407baf3eff9443f7f9bed7947218b78293b06bba1737
2025-02-11 18:32:22 +00:00
dan
833dd3daff Fix "unused variable" warnings in os_unix.c and os_win.c.
FossilOrigin-Name: 8e809632ba3bb20b7ec23ce9e6ca659c57cf1338b1fe8c33502c5f3161061dd2
2025-02-11 18:29:35 +00:00
dan
138951dc2e Merge latest changes from trunk into this branch.
FossilOrigin-Name: e5ec5bb9f4dc3e02db7ab0e49686f47617af75d3f7d4ab23288a1aea4a693e59
2025-02-11 17:10:46 +00:00
dan
2d87894700 Experimental change to allow clients to block when taking a SHARED lock to connect to a wal mode database.
FossilOrigin-Name: d2d6a000fb9bf8097e0ce9979685408d183be3ab785ceeb11ec1f97a81a83e41
2025-02-10 20:46:14 +00:00
drh
0a4af54a7e Remove a pointless line of code.
FossilOrigin-Name: 57b2b812c8c5524f315e20cee0e6a12a3b1635aeb42925bf891532a7029d0eb0
2025-02-10 19:48:13 +00:00
drh
a0d35d44e4 Convert some expensive NEVER() and ASSERT() macros into assert()s.
FossilOrigin-Name: 4aad891802d9d87f1ff3cbbf4bc70fa242c6782088189a2bd5d6f8863f552d29
2025-02-10 11:16:37 +00:00
drh
93df8109fc Small performance increase in jsonTranslateBlobToText().
FossilOrigin-Name: 3b1dcac2eeaf5f97450919f2a6eed74a4d54fb2b812bdb4a580f79d075e99dfe
2025-02-10 00:20:50 +00:00
drh
3efac4aa78 Performance optimization to the substr() SQL function.
FossilOrigin-Name: ce228ce3d0132ad758b5b7464fcf22ae5976df3c02ec948280cc76290c79ed0b
2025-02-09 20:23:29 +00:00
drh
3bdebaeabb Performance and size optimization for the sqlite3ColumnIndex() routine.
FossilOrigin-Name: a93e3fe0ee8f98a7ec0dfb2e1abf432cc9d5f9d3ad345b5db261475215d43df9
2025-02-09 19:49:46 +00:00
drh
66172ceb89 Put a 16-byte hash table for column names on each Table object, to speed
up column name lookups.

FossilOrigin-Name: 11eb8f99e5c4974cb6ba39e5bbc99f6b88b9e01006b70d5fea85c2a6d4f7044f
2025-02-08 16:16:08 +00:00
drh
9d90a3af2f Use the sqlite3ColumnIndex() routine to look up a column in a table, rather
than using a custom loop.  Performance improvement, size reduction, and
complexity decrease.

FossilOrigin-Name: 351dbbc2bf0b23efdc625ddaa5dc2239cf2990addf071a04bd41612b341de8c8
2025-02-08 14:15:42 +00:00