Compare commits

...

2 Commits

Author SHA1 Message Date
drh 843418ae70 In the CLI on the ".mode" command, replace the recently added --no-limits option with
"--limits L,C".  And add --sw as an alias for --screenwidth.

FossilOrigin-Name: caefe4c746599b22aec446f3aeb296e53edaf8c54f8ae803381e8c21d5e29ab4
2025-11-24 12:27:18 +00:00
dan 0ec8c56567 Remove the the SQLITE_SYNC_DATAONLY flag from the core on the grounds that it is not currently used by either built-in VFS and is therefore untested.
FossilOrigin-Name: ff2065b533769cbf5278d13d09ffa93a7a0f841b1b59b6be0e5f27e3d1c341d0
2025-11-24 11:22:56 +00:00
10 changed files with 75 additions and 80 deletions
+13 -14
View File
@@ -1,5 +1,5 @@
C Add\sthe\slong-missing\ssqlite3_next_stmt()\sbinding\sto\sJS/WASM.
D 2025-11-23T22:18:26.469
C In\sthe\sCLI\son\sthe\s".mode"\scommand,\sreplace\sthe\srecently\sadded\s--no-limits\soption\swith\n"--limits\sL,C".\s\sAnd\sadd\s--sw\sas\san\salias\sfor\s--screenwidth.
D 2025-11-24T12:27:18.181
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -719,10 +719,10 @@ F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06
F src/os_kv.c fb7ba8d6204197357f1eb7e1c7450d09c10043bf7e99aba602f4aa46b8fb11a3
F src/os_setup.h 8efc64eda6a6c2f221387eefc2e7e45fd5a3d5c8337a7a83519ba4fbd2957ae2
F src/os_unix.c 7945ede1e85b2d1b910e1b4af9ba342e964b1e30e79f4176480a60736445cb36
F src/os_unix.c bf55d195730393a9faf31dcec65257710c61f61a728342151af06a8267ffb35d
F src/os_win.c a89b501fc195085c7d6c9eec7f5bd782625e94bb2a96b000f4d009703df1083f
F src/os_win.h 4c247cdb6d407c75186c94a1e84d5a22cbae4adcec93fcae8d2bc1f956fd1f19
F src/pager.c a81461de271ac4886ad75b7ca2cca8157a48635820c4646cd2714acdc2c17e5f
F src/pager.c 52bae5ea11f25cbdc425be7b0a8c3310b3ec2a1381e73b5d5b6af20c26094108
F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8
F src/parse.y 424d195ea70f4656a3f6440e0b79ca8f712ae4da9431033a19ec8c9816469287
F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484
@@ -735,8 +735,8 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c 5616fbcf3b833c7c705b24371828215ad0925d0c0073216c4f153348d5753f0a
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c ba9cd07ffa3277883c1986085f6ddc4320f4d35d5f212ab58df79a7ecc1a576a
F src/shell.c.in 7f4a56ac62b5030755e72c5a9598b45782a0deccba350605b13d6d7b48e58b2d
F src/sqlite.h.in f1363321ca55cc2feaa289e9fe6dfb08102a28c54edf005564711a2348b06eef
F src/shell.c.in bc2185e0e988f93643dbaac3c8f190b3687475cd7ac802c035d20347b8e27fbb
F src/sqlite.h.in b5b2450724c9aa2d7ae2861c881385bc21ba940c79122c893f5ae9bb36ad10dd
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
F src/sqlite3ext.h 5d5330f5f8461f5ce74960436ddcfa53ecd09c2b8b23901e22ae38aec3243998
F src/sqliteInt.h a89c3a9296928dffcb4c287df176a739f9cf620c7c9d33aec59e8efb9b39cbbd
@@ -775,7 +775,7 @@ F src/test_md5.c 811a45330c9391933360f998156a8907ee29909c828ab83ac05d329942cbea8
F src/test_multiplex.c 82f0aa8eee629b6949782cfab8782ed35a9b56dc80d12877af52147f304d22b8
F src/test_multiplex.h f0ff5b6f4462bfd46dac165d6375b9530d08089b7bcbe75e88e0926110db5363
F src/test_mutex.c dacae6790956c0d4e705aaed2090227792e291b0496cccd688e9994c1e21f740
F src/test_onefile.c f31e52e891c5fef6709b9fcef54ce660648a34172423a9cbdf4cbce3ba0049f4
F src/test_onefile.c f52ae709489837863521e6e0e1a8965b6716d45f784445b98641b6ce0fc2137b
F src/test_osinst.c 269039d9c0820a02ee928014c30860d57ee757ecda54df42e463d0ca1377b835
F src/test_pcache.c 496da3f7e2ca66aefbc36bbf22138b1eff43ba0dff175c228b760fa020a37bd0
F src/test_quota.c 180e87437250bed7e17e4e61c106730939e39fec9be73d28961f27f579a92078
@@ -789,7 +789,7 @@ F src/test_tclsh.c c01706ac60bd3176754d3ccd37da74c6ad97c2e14489f8ed71b497c1c0ac0
F src/test_tclvar.c ae873248a0188459b1c16ca7cc431265dacce524399e8b46725c2b3b7e048424
F src/test_thread.c 3edb4a5b5aeb1a6e9a275dccc848ac95acab7f496b3e9230f6d2d04953a2b862
F src/test_vdbecov.c 5c426d9cd2b351f5f9ceb30cabf8c64a63bfcad644c507e0bd9ce2f6ae1a3bf3
F src/test_vfs.c b4135c1308516adf0dfd494e6d6c33114e03732be899eace0502919b674586b5
F src/test_vfs.c 7b06f2f82584a9e723e62cb6894d60d21dc4cd9bcd02d6de976e5434e5d60a30
F src/test_window.c 6d80e11fba89a1796525e6f0048ff0c7789aa2c6b0b11c80827dc1437bd8ea72
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
@@ -1925,7 +1925,7 @@ F test/upsertfault.test f21ca47740841fdb4d61acfa7b17646d773e67724fe8c185b71c018d
F test/uri.test 1250724af9beeed2d6c3716f5b990c483200c54f408d3c0ec9543a3c7961f8fc
F test/uri2.test 9d3ba7a53ee167572d53a298ee4a5d38ec4a8fb7
F test/utf16align.test 9fde0bb5d3a821594aa68c6829ab9c5453a084384137ebb9f6153e2d678039da
F test/vacuum-into.test 5a489714feecfdabfc7b293be4111564a173dee92c0d6818dd0207f3ade65783
F test/vacuum-into.test ebd223213fde4c985818b9d6dc33fe29a7cdd4272738d82e3e14aa2e686d228b
F test/vacuum.test f3b2257a4fcd659513c866a5d9e5f70999cc58fd5d74e979290385fa350b79ee
F test/vacuum2.test 9fd45ce6ce29f5614c249e03938d3567c06a9e772d4f155949f8eafe2d8af520
F test/vacuum3.test d9d9a04ee58c485b94694fd4f68cffaba49c32234fdefe1ac1a622c5e17d4ce3
@@ -2179,9 +2179,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 6d01f9f49eef5f7d4bddadc458691b6ca36e277bae1d4b43b60a128a44e3faca
Q +53a99ff4ed5ef5f8620bf324a4f7a1d0812f5c80311228eb820039430ca04bd5
R 515a3a81ebc9373c74089cfbe119fc8c
U stephan
Z 7b4c76955b7cff921337deda4dac0ebb
P ff2065b533769cbf5278d13d09ffa93a7a0f841b1b59b6be0e5f27e3d1c341d0
R 628a0162ba8f0d8ab2de4d5bcae00f5f
U drh
Z 990cca7d1ccfde0bfbdaf6f519eba45c
# Remove this line to create a well-formed Fossil manifest.
+2 -2
View File
@@ -1,2 +1,2 @@
branch trunk
tag trunk
branch remove-sync-dataonly
tag remove-sync-dataonly
+1 -1
View File
@@ -1 +1 @@
de27d2d3f2353309227b4d5f77eff76c108c094b61ac59f5a769229a084f2567
caefe4c746599b22aec446f3aeb296e53edaf8c54f8ae803381e8c21d5e29ab4
+15 -25
View File
@@ -3756,20 +3756,18 @@ int sqlite3_fullsync_count = 0;
** enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash
** or power failure will likely corrupt the database file.
**
** SQLite sets the dataOnly flag if the size of the file is unchanged.
** The idea behind dataOnly is that it should only write the file content
** to disk, not the inode. We only set dataOnly if the file size is
** unchanged since the file size is part of the inode. However,
** Ted Ts'o tells us that fdatasync() will also write the inode if the
** file size has changed. The only real difference between fdatasync()
** and fsync(), Ted tells us, is that fdatasync() will not flush the
** inode if the mtime or owner or other inode attributes have changed.
** We only care about the file size, not the other file attributes, so
** as far as SQLite is concerned, an fdatasync() is always adequate.
** So, we always use fdatasync() if it is available, regardless of
** the value of the dataOnly flag.
** At one point we attempted to pass a flag to this function if the
** file-size had not changed to tell it to use fdatasync() instead of
** fsync() in this case. However, Ted Ts'o tells us that fdatasync() will
** also write the inode if the file size has changed. The only real
** difference between fdatasync() and fsync(), Ted tells us, is that
** fdatasync() will not flush the inode if the mtime or owner or other
** inode attributes have changed. We only care about the file size, not
** the other file attributes, so as far as SQLite is concerned, an
** fdatasync() is always adequate. So, we always use fdatasync() if it is
** available.
*/
static int full_fsync(int fd, int fullSync, int dataOnly){
static int full_fsync(int fd, int fullSync){
int rc;
/* The following "ifdef/elif/else/" block has the same structure as
@@ -3779,12 +3777,9 @@ static int full_fsync(int fd, int fullSync, int dataOnly){
#ifdef SQLITE_NO_SYNC
UNUSED_PARAMETER(fd);
UNUSED_PARAMETER(fullSync);
UNUSED_PARAMETER(dataOnly);
#elif HAVE_FULLFSYNC
UNUSED_PARAMETER(dataOnly);
#else
UNUSED_PARAMETER(fullSync);
UNUSED_PARAMETER(dataOnly);
#endif
/* Record the number of times that we do a normal fsync() and
@@ -3890,10 +3885,6 @@ static int openDirectory(const char *zFilename, int *pFd){
/*
** Make sure all writes to a particular file are committed to disk.
**
** If dataOnly==0 then both the file itself and its metadata (file
** size, access time, etc) are synced. If dataOnly!=0 then only the
** file data is synced.
**
** Under Unix, also make sure that the directory entry for the file
** has been created by fsync-ing the directory that contains the file.
** If we do not do this and we encounter a power failure, the directory
@@ -3906,7 +3897,6 @@ static int unixSync(sqlite3_file *id, int flags){
int rc;
unixFile *pFile = (unixFile*)id;
int isDataOnly = (flags&SQLITE_SYNC_DATAONLY);
int isFullsync = (flags&0x0F)==SQLITE_SYNC_FULL;
/* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */
@@ -3921,7 +3911,7 @@ static int unixSync(sqlite3_file *id, int flags){
assert( pFile );
OSTRACE(("SYNC %-3d\n", pFile->h));
rc = full_fsync(pFile->h, isFullsync, isDataOnly);
rc = full_fsync(pFile->h, isFullsync);
SimulateIOError( rc=1 );
if( rc ){
storeLastErrno(pFile, errno);
@@ -3938,7 +3928,7 @@ static int unixSync(sqlite3_file *id, int flags){
HAVE_FULLFSYNC, isFullsync));
rc = osOpenDirectory(pFile->zPath, &dirfd);
if( rc==SQLITE_OK ){
full_fsync(dirfd, 0, 0);
full_fsync(dirfd, 0);
robust_close(pFile, dirfd, __LINE__);
}else{
assert( rc==SQLITE_CANTOPEN );
@@ -6854,7 +6844,7 @@ static int unixDelete(
int fd;
rc = osOpenDirectory(zPath, &fd);
if( rc==SQLITE_OK ){
if( full_fsync(fd,0,0) ){
if( full_fsync(fd, 0) ){
rc = unixLogError(SQLITE_IOERR_DIR_FSYNC, "fsync", zPath);
}
robust_close(0, fd, __LINE__);
@@ -7910,7 +7900,7 @@ static int proxyTakeConch(unixFile *pFile){
writeSize = PROXY_PATHINDEX + strlen(&writeBuffer[PROXY_PATHINDEX]);
robust_ftruncate(conchFile->h, writeSize);
rc = unixWrite((sqlite3_file *)conchFile, writeBuffer, writeSize, 0);
full_fsync(conchFile->h,0,0);
full_fsync(conchFile->h, 0);
/* If we created a new conch file (not just updated the contents of a
** valid conch file), try to match the permissions of the database
*/
+2 -4
View File
@@ -1400,7 +1400,7 @@ static int zeroJournalHdr(Pager *pPager, int doTruncate){
rc = sqlite3OsWrite(pPager->jfd, zeroHdr, sizeof(zeroHdr), 0);
}
if( rc==SQLITE_OK && !pPager->noSync ){
rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_DATAONLY|pPager->syncFlags);
rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);
}
/* At this point the transaction is committed but the write lock
@@ -4367,9 +4367,7 @@ static int syncJournal(Pager *pPager, int newHdr){
if( 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){
PAGERTRACE(("SYNC journal of %d\n", PAGERID(pPager)));
IOTRACE(("JSYNC %p\n", pPager))
rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags|
(pPager->syncFlags==SQLITE_SYNC_FULL?SQLITE_SYNC_DATAONLY:0)
);
rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);
if( rc!=SQLITE_OK ) return rc;
}
+39 -23
View File
@@ -7653,9 +7653,9 @@ static int modeTitleDsply(ShellState *p, int bAll){
**
** USAGE: .mode [MODE] [OPTIONS]
**
** Change the output mode to MODE and/or apply OPTIONS to the
** output mode. If no arguments, show the current output mode
** and relevant options.
** Change the output mode to MODE and/or apply OPTIONS to the output mode.
** Arguments are processed from left to right. If no arguments, show the
** current output mode and relevant options.
**
** Options:
** --align STRING Set the alignment of text in columnar modes
@@ -7674,9 +7674,9 @@ static int modeTitleDsply(ShellState *p, int bAll){
** any single SQL value to N. Longer values are
** truncated. Zero means "no limit". Only works
** in "line" mode and in columnar modes.
** --limits L,C Shorthand for "--linelimit L --charlimit C".
** Or "off" to mean "0,0". Or "on" for "5,300".
** --list List available modes
** --no-limits Shorthand to turn off --linelimit, --charlimit,
** and --screenwidth.
** --null STRING Render SQL NULL values as the given string
** --once Setting changes to the right are reverted after
** the next SQL command.
@@ -7686,7 +7686,7 @@ static int modeTitleDsply(ShellState *p, int bAll){
** "on and "sql" are synonyms.
** --reset Changes all mode settings back to their default.
** --rowsep STRING Use STRING as the row separator
** --screenwidth N Declare the screen width of the output device
** --sw|--screenwidth N Declare the screen width of the output device
** to be N characters. An attempt may be made to
** wrap output text to fit within this limit. Zero
** means "no limit". Or N can be "auto" to set the
@@ -7694,7 +7694,7 @@ static int modeTitleDsply(ShellState *p, int bAll){
** --tablename NAME Set the name of the table for "insert" mode.
** --tag NAME Save mode to the left as NAME.
** --textjsonb BOOLEAN If enabled, JSONB text is displayed as text JSON.
** --title ARG Whether or not to show column headers, and if so
** --title ARG Whether or not to show column headers, and if so
** how to encode them. ARG can be "off", "on",
** "sql", "csv", "html", "tcl", or "json".
** -v|--verbose Verbose output
@@ -7798,11 +7798,10 @@ static int dotCmdMode(ShellState *p){
}else if( optionMatch(z,"escape") ){
/* See similar code at tag-20250224-1 */
char *zErr = 0;
if( i+1>=nArg ){
dotCmdError(p, i, "missing argument", 0);
if( (++i)>=nArg ){
dotCmdError(p, i-1, "missing argument", 0);
return 1;
}
i++; /* 0 1 2 <-- One less than QRF_ESC_ */
} /* 0 1 2 <-- One less than QRF_ESC_ */
k = pickStr(azArg[i],&zErr,"off","ascii","symbol","");
if( k<0 ){
dotCmdError(p, i, "unknown escape type", "%s", zErr);
@@ -7811,6 +7810,30 @@ static int dotCmdMode(ShellState *p){
}
p->mode.spec.eEsc = k+1;
chng = 1;
}else if( optionMatch(z,"limits") ){
if( (++i)>=nArg ){
dotCmdError(p, i-1, "missing argument", 0);
return 1;
}
k = pickStr(azArg[i],0,"on","off","");
if( k==0 ){
p->mode.spec.nLineLimit = 5;
p->mode.spec.nCharLimit = 300;
}else if( k==1 ){
p->mode.spec.nLineLimit = 0;
p->mode.spec.nCharLimit = 0;
}else{
int L, C;
int nNum = sscanf(azArg[i], "%d,%d", &L, &C);
if( nNum!=2 || L<0 || C<0 ){
dotCmdError(p, i, "bad argument", "Should be \"L,C\" where L and C"
" are unsigned integers");
return 1;
}
p->mode.spec.nLineLimit = L;
p->mode.spec.nCharLimit = C;
}
chng = 1;
}else if( optionMatch(z,"list") ){
int ii;
cli_puts("available modes:", p->out);
@@ -7831,12 +7854,6 @@ static int dotCmdMode(ShellState *p){
p->mode.spec.eText = QRF_TEXT_Plain;
p->mode.spec.eBlob = QRF_BLOB_Text;
chng = 1;
}else if( optionMatch(z,"no-limits") ){
p->mode.spec.nLineLimit = 0;
p->mode.spec.nCharLimit = 0;
p->mode.spec.nScreenWidth = 0;
p->mode.bAutoScreenWidth = 0;
chng = 1;
}else if( optionMatch(z,"quote") ){
if( i+1<nArg
&& azArg[i+1][0]!='-'
@@ -7893,25 +7910,24 @@ static int dotCmdMode(ShellState *p){
int saved_eMode = p->mode.eMode;
modeFree(&p->mode);
modeChange(p, saved_eMode);
}else if( optionMatch(z,"screenwidth") ){
if( i+1>=nArg ){
dotCmdError(p, i, "missing argument", 0);
}else if( optionMatch(z,"screenwidth") || optionMatch(z,"sw") ){
if( (++i)>=nArg ){
dotCmdError(p, i-1, "missing argument", 0);
return 1;
}
k = pickStr(azArg[i+1],0,"off","auto","");
k = pickStr(azArg[i],0,"off","auto","");
if( k==0 ){
p->mode.bAutoScreenWidth = 0;
p->mode.spec.nScreenWidth = 0;
}else if( k==1 ){
p->mode.bAutoScreenWidth = 1;
}else{
i64 w = integerValue(azArg[i+1]);
i64 w = integerValue(azArg[i]);
p->mode.bAutoScreenWidth = 0;
if( w<0 ) w = 0;
if( w>QRF_MAX_WIDTH ) w = QRF_MAX_WIDTH;
p->mode.spec.nScreenWidth = w;
}
i++;
chng = 1;
}else if( optionMatch(z,"tag") ){
size_t nByte;
+1 -3
View File
@@ -766,9 +766,7 @@ struct sqlite3_file {
**
** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
** [SQLITE_SYNC_FULL]. The first choice is the normal fsync().
** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY]
** flag may be ORed in to indicate that only the data of the file
** and not its inode needs to be synced.
** The second choice is a Mac OS X style fullsync.
**
** The integer values to xLock() and xUnlock() are one of
** <ul>
+1 -1
View File
@@ -514,7 +514,7 @@ static int fsSync(sqlite3_file *pFile, int flags){
rc = pRealFile->pMethods->xWrite(pRealFile, zSize, 4, 0);
}
if( rc==SQLITE_OK ){
rc = pRealFile->pMethods->xSync(pRealFile, flags&(~SQLITE_SYNC_DATAONLY));
rc = pRealFile->pMethods->xSync(pRealFile, flags);
}
return rc;
-6
View File
@@ -436,12 +436,6 @@ static int tvfsSync(sqlite3_file *pFile, int flags){
case SQLITE_SYNC_FULL:
zFlags = "full";
break;
case SQLITE_SYNC_NORMAL|SQLITE_SYNC_DATAONLY:
zFlags = "normal|dataonly";
break;
case SQLITE_SYNC_FULL|SQLITE_SYNC_DATAONLY:
zFlags = "full|dataonly";
break;
default:
assert(0);
}
+1 -1
View File
@@ -198,7 +198,7 @@ foreach {tn pragma res} {
750 {
PRAGMA fullfsync = 1;
PRAGMA synchronous = full;
} {full|dataonly 1 full 2}
} {full 3}
} {
forcedelete test.db2