1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Merge the latest trunk enhancments into the reuse-schema branch.

FossilOrigin-Name: 52262ac9205e7e4f19855a47955a5df10d53c222b4872d2ed1e5ca5230034a1d
This commit is contained in:
drh
2023-10-23 19:27:44 +00:00
297 changed files with 23786 additions and 10492 deletions

11
tool/cktclsh.sh Normal file
View File

@@ -0,0 +1,11 @@
# Fail with an error if the TCLSH named in $2 is not tclsh version $1 or later.
#
echo "set vers $1" >cktclsh$1.tcl
echo 'if {$tcl_version<$vers} {exit 1}' >>cktclsh$1.tcl
if ! $2 cktclsh$1.tcl
then
echo "ERROR: This makefile target requires tclsh $1 or later."
rm cktclsh$1.tcl
exit 1
fi
rm cktclsh$1.tcl

View File

@@ -680,6 +680,11 @@ static sqlite3_module seriesModule = {
0, /* xRollback */
0, /* xFindMethod */
0, /* xRename */
0, /* xSavepoint */
0, /* xRelease */
0, /* xRollbackTo */
0, /* xShadowName */
0 /* xIntegrity */
};
/* END the generate_series(START,END,STEP) implementation
*********************************************************************************/

View File

@@ -25,6 +25,14 @@ VERSION=`cat $TOP/VERSION`
HASH=`sed 's/^\(..........\).*/\1/' $TOP/manifest.uuid`
DATETIME=`grep '^D' $TOP/manifest | sed -e 's/[^0-9]//g' -e 's/\(............\).*/\1/'`
# Verify that the version number in the TEA autoconf file is correct.
# Fail with an error if not.
#
if grep $VERSION $TOP/autoconf/tea/configure.ac
then echo "TEA version number ok"
else echo "TEA version number mismatch. Should be $VERSION"; exit 1
fi
# If this script is given an argument of --snapshot, then generate a
# snapshot tarball named for the current checkout SHA1 hash, rather than
# the version number.

View File

@@ -239,6 +239,7 @@ set boolean_defnil_options {
SQLITE_OMIT_REINDEX
SQLITE_OMIT_SCHEMA_PRAGMAS
SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
SQLITE_OMIT_SEH
SQLITE_OMIT_SHARED_CACHE
SQLITE_OMIT_SHUTDOWN_DIRECTORIES
SQLITE_OMIT_SUBQUERY
@@ -308,6 +309,7 @@ set value_options {
SQLITE_ENABLE_8_3_NAMES
SQLITE_ENABLE_CEROD
SQLITE_ENABLE_LOCKING_STYLE
SQLITE_EXTRA_AUTOEXT
SQLITE_EXTRA_INIT
SQLITE_EXTRA_SHUTDOWN
SQLITE_FTS3_MAX_EXPR_DEPTH

59
tool/mktoolzip.tcl Normal file
View File

@@ -0,0 +1,59 @@
#!/usr/bin/tclsh
#
# Run this script in order to generate a ZIP archive containing various
# command-line tools.
#
# The makefile that invokes this script must first build the following
# binaries:
#
# testfixture -- used to run this script
# sqlite3 -- the SQLite CLI
# sqldiff -- Program to diff two databases
# sqlite3_analyzer -- Space analyzer
#
switch $tcl_platform(os) {
{Windows NT} {
set OS win32
set EXE .exe
}
Linux {
set OS linux
set EXE {}
}
Darwin {
set OS osx
set EXE {}
}
default {
set OS unknown
set EXE {}
}
}
switch $tcl_platform(machine) {
arm64 {
set ARCH arm64
}
x86_64 {
set ARCH x64
}
amd64 -
intel {
if {$tcl_platform(pointerSize)==4} {
set ARCH x86
} else {
set ARCH x64
}
}
default {
set ARCH unk
}
}
set in [open VERSION]
set vers [read $in]
close $in
scan $vers %d.%d.%d v1 v2 v3
set v2 [format 3%02d%02d00 $v2 $v3]
set name sqlite-tools-$OS-$ARCH-$v2.zip
puts "zip $name sqlite3$EXE sqldiff$EXE sqlite3_analyzer$EXE"
puts [exec zip $name sqlite3$EXE sqldiff$EXE sqlite3_analyzer$EXE]
puts [exec ls -l $name]

View File

@@ -959,6 +959,10 @@ static void page_usage_freelist(u32 pgno){
a = fileRead((pgno-1)*g.pagesize, g.pagesize);
iNext = decodeInt32(a);
n = decodeInt32(a+4);
if( n>(g.pagesize - 8)/4 ){
printf("ERROR: page %d too many freelist entries (%d)\n", pgno, n);
n = (g.pagesize - 8)/4;
}
for(i=0; i<n; i++){
int child = decodeInt32(a + (i*4+8));
page_usage_msg(child, "freelist leaf, child %d of trunk page %d",

View File

@@ -581,6 +581,7 @@ set inuse_pgcnt [expr wide([mem eval $sql])]
set inuse_percent [percent $inuse_pgcnt $file_pgcnt]
set free_pgcnt [expr {$file_pgcnt-$inuse_pgcnt-$av_pgcnt}]
if {$file_bytes>1073741824 && $free_pgcnt>0} {incr free_pgcnt -1}
set free_percent [percent $free_pgcnt $file_pgcnt]
set free_pgcnt2 [db one {PRAGMA freelist_count}]
set free_percent2 [percent $free_pgcnt2 $file_pgcnt]

View File

@@ -596,9 +596,9 @@ static void diff_one_table(const char *zTab, FILE *out){
/* Build the comparison query */
for(n2=n; az2[n2]; n2++){
char *zTab = safeId(az2[n2]);
fprintf(out, "ALTER TABLE %s ADD COLUMN %s;\n", zId, zTab);
sqlite3_free(zTab);
char *zNTab = safeId(az2[n2]);
fprintf(out, "ALTER TABLE %s ADD COLUMN %s;\n", zId, zNTab);
sqlite3_free(zNTab);
}
nQ = nPk2+1+2*(n2-nPk2);
if( n2>nPk2 ){

79
tool/srctree-check.tcl Normal file
View File

@@ -0,0 +1,79 @@
#!/usr/bin/tclsh
#
# Run this script from the top of the source tree in order to confirm that
# various aspects of the source tree are up-to-date. Items checked include:
#
# * Makefile.msc and autoconf/Makefile.msc agree
# * src/ctime.tcl is consistent with tool/mkctimec.tcl
# * VERSION agrees with autoconf/tea/configure.ac
# * src/pragma.h agrees with tool/mkpragmatab.tcl
#
# Other tests might be added later.
#
# Error messages are printed and the process exists non-zero if problems
# are found. If everything is ok, no output is generated and the process
# exits with 0.
#
# Read an entire file.
#
proc readfile {filename} {
set fd [open $filename rb]
set txt [read $fd]
close $fd
return $txt
}
# Find the root of the tree.
#
set ROOT [file dir [file dir [file normalize $argv0]]]
cd $ROOT
# Name of the TCL interpreter
#
set TCLSH [info nameofexe]
######################### autoconf/tea/configure.ac ###########################
set confac [readfile $ROOT/autoconf/tea/configure.ac]
set vers [readfile $ROOT/VERSION]
set pattern {AC_INIT([sqlite],[}
append pattern [string trim $vers]
append pattern {])}
if {[string first $pattern $confac]<=0} {
puts "ERROR: ./autoconf/tea/configure.ac does not agree with ./VERSION"
exit 1
}
######################### autoconf/Makefile.msc ###############################
set f1 [readfile $ROOT/autoconf/Makefile.msc]
exec mv $ROOT/autoconf/Makefile.msc $ROOT/autoconf/Makefile.msc.tmp
exec $TCLSH $ROOT/tool/mkmsvcmin.tcl
set f2 [readfile $ROOT/autoconf/Makefile.msc]
exec mv $ROOT/autoconf/Makefile.msc.tmp $ROOT/autoconf/Makefile.msc
if {$f1 != $f2} {
puts "ERROR: ./autoconf/Makefile.msc does not agree with ./Makefile.msc"
}
######################### src/pragma.h ########################################
set f1 [readfile $ROOT/src/pragma.h]
exec mv $ROOT/src/pragma.h $ROOT/src/pragma.h.tmp
exec $TCLSH $ROOT/tool/mkpragmatab.tcl
set f2 [readfile $ROOT/src/pragma.h]
exec mv $ROOT/src/pragma.h.tmp $ROOT/src/pragma.h
if {$f1 != $f2} {
puts "ERROR: ./src/pragma.h does not agree with ./tool/mkpragmatab.tcl"
}
######################### src/ctime.c ########################################
set f1 [readfile $ROOT/src/ctime.c]
exec mv $ROOT/src/ctime.c $ROOT/src/ctime.c.tmp
exec $TCLSH $ROOT/tool/mkctimec.tcl
set f2 [readfile $ROOT/src/ctime.c]
exec mv $ROOT/src/ctime.c.tmp $ROOT/src/ctime.c
if {$f1 != $f2} {
puts "ERROR: ./src/ctime.c does not agree with ./tool/mkctimec.tcl"
}