1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Merge latest trunk changes into this branch.

FossilOrigin-Name: edb842349320eda9550bdfcd5a327949c5512e02f4b993782587b2131a425746
This commit is contained in:
dan
2024-11-06 17:31:48 +00:00
35 changed files with 1240 additions and 497 deletions

View File

@ -1642,7 +1642,7 @@ void f5tStrFunc(sqlite3_context *pCtx, int nArg, sqlite3_value **apArg){
const char *zText = 0;
assert( nArg==1 );
zText = sqlite3_value_text(apArg[0]);
zText = (const char*)sqlite3_value_text(apArg[0]);
if( zText ){
sqlite3_int64 nText = strlen(zText);
char *zCopy = (char*)ckalloc(nText+8);
@ -1670,7 +1670,6 @@ static int SQLITE_TCLAPI f5tRegisterStr(
Tcl_Obj *CONST objv[]
){
sqlite3 *db = 0;
int rc;
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "DB");

View File

@ -571,7 +571,7 @@ int sqlite3IcuInit(sqlite3 *db){
return rc;
}
#if !SQLITE_CORE
#ifndef SQLITE_CORE
#ifdef _WIN32
__declspec(dllexport)
#endif

View File

@ -484,10 +484,10 @@ int sqlite3_percentile_init(
){
int rc = SQLITE_OK;
unsigned int i;
#if defined(SQLITE3_H) || defined(SQLITE_STATIC_PERCENTILE)
(void)pApi; /* Unused parameter */
#else
#ifdef SQLITE3EXT_H
SQLITE_EXTENSION_INIT2(pApi);
#else
(void)pApi; /* Unused parameter */
#endif
(void)pzErrMsg; /* Unused parameter */
for(i=0; i<sizeof(aPercentFunc)/sizeof(aPercentFunc[0]); i++){

View File

@ -659,7 +659,7 @@ static int seriesBestIndex(
continue;
}
if( pConstraint->iColumn<SERIES_COLUMN_START ){
if( pConstraint->iColumn==SERIES_COLUMN_VALUE ){
if( pConstraint->iColumn==SERIES_COLUMN_VALUE && pConstraint->usable ){
switch( op ){
case SQLITE_INDEX_CONSTRAINT_EQ:
case SQLITE_INDEX_CONSTRAINT_IS: {

View File

@ -96,8 +96,8 @@ FILE *sqlite3_fopen(const char *zFilename, const char *zMode){
sz1 = (int)strlen(zFilename);
sz2 = (int)strlen(zMode);
b1 = malloc( (sz1+1)*sizeof(b1[0]) );
b2 = malloc( (sz2+1)*sizeof(b1[0]) );
b1 = sqlite3_malloc( (sz1+1)*sizeof(b1[0]) );
b2 = sqlite3_malloc( (sz2+1)*sizeof(b1[0]) );
if( b1 && b2 ){
sz1 = MultiByteToWideChar(CP_UTF8, 0, zFilename, sz1, b1, sz1);
b1[sz1] = 0;
@ -105,8 +105,8 @@ FILE *sqlite3_fopen(const char *zFilename, const char *zMode){
b2[sz2] = 0;
fp = _wfopen(b1, b2);
}
free(b1);
free(b2);
sqlite3_free(b1);
sqlite3_free(b2);
simBinaryOther = 0;
return fp;
}
@ -122,8 +122,8 @@ FILE *sqlite3_popen(const char *zCommand, const char *zMode){
sz1 = (int)strlen(zCommand);
sz2 = (int)strlen(zMode);
b1 = malloc( (sz1+1)*sizeof(b1[0]) );
b2 = malloc( (sz2+1)*sizeof(b1[0]) );
b1 = sqlite3_malloc( (sz1+1)*sizeof(b1[0]) );
b2 = sqlite3_malloc( (sz2+1)*sizeof(b1[0]) );
if( b1 && b2 ){
sz1 = MultiByteToWideChar(CP_UTF8, 0, zCommand, sz1, b1, sz1);
b1[sz1] = 0;
@ -131,8 +131,8 @@ FILE *sqlite3_popen(const char *zCommand, const char *zMode){
b2[sz2] = 0;
fp = _wpopen(b1, b2);
}
free(b1);
free(b2);
sqlite3_free(b1);
sqlite3_free(b2);
return fp;
}
@ -146,7 +146,7 @@ char *sqlite3_fgets(char *buf, int sz, FILE *in){
** that into UTF-8. Otherwise, non-ASCII characters all get translated
** into '?'.
*/
wchar_t *b1 = malloc( sz*sizeof(wchar_t) );
wchar_t *b1 = sqlite3_malloc( sz*sizeof(wchar_t) );
if( b1==0 ) return 0;
_setmode(_fileno(in), IsConsole(in) ? _O_WTEXT : _O_U8TEXT);
if( fgetws(b1, sz/4, in)==0 ){
@ -212,7 +212,7 @@ int sqlite3_fputs(const char *z, FILE *out){
** use O_U8TEXT for everything in text mode.
*/
int sz = (int)strlen(z);
wchar_t *b1 = malloc( (sz+1)*sizeof(wchar_t) );
wchar_t *b1 = sqlite3_malloc( (sz+1)*sizeof(wchar_t) );
if( b1==0 ) return 0;
sz = MultiByteToWideChar(CP_UTF8, 0, z, sz, b1, sz);
b1[sz] = 0;

View File

@ -4449,7 +4449,7 @@ int sqlite3_rtree_query_callback(
);
}
#if !SQLITE_CORE
#ifndef SQLITE_CORE
#ifdef _WIN32
__declspec(dllexport)
#endif

View File

@ -198,7 +198,7 @@ if {[permutation]=="inmemory_journal"} {
} else {
do_catchsql_test 6.1 {
SELECT ( 'elvis' IN(SELECT rtreecheck('t1')) ) FROM (SELECT 1) GROUP BY 1;
} {1 {database table is locked}}
} {0 0}
}
finish_test

View File

@ -0,0 +1,55 @@
# 2024 November 04
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
if {![info exists testdir]} {
set testdir [file join [file dirname [info script]] .. .. test]
}
source [file join [file dirname [info script]] session_common.tcl]
source $testdir/tester.tcl
ifcapable !session {finish_test; return}
if {$::tcl_platform(pointerSize)<8} {
finish_test
return
}
set testprefix sessionblob
forcedelete test.db2
sqlite3 db2 test.db2
set NBLOB 2000000
do_execsql_test 1.0 {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
INSERT INTO t1 VALUES(123, zeroblob($NBLOB));
}
do_test 1.1 {
sqlite3session S db main
S attach t1
} {}
set b2 [string repeat x 1000]
do_test 1.2 {
set ::blob [db incrblob t1 b 123]
for {set ii 0} {$ii < $NBLOB} {incr ii [string length $b2]} {
seek $::blob $ii
puts -nonewline $::blob $b2
}
close $::blob
} {}
S delete
finish_test

View File

@ -46,6 +46,8 @@ fiddle.emcc-flags = \
$(SQLITE_OPT.full-featured) \
$(SQLITE_OPT.common) \
$(SHELL_OPT) \
-UHAVE_READLINE -UHAVE_EDITLINE -UHAVE_LINENOISE \
-USQLITE_HAVE_ZLIB \
-USQLITE_WASM_BARE_BONES \
-DSQLITE_SHELL_FIDDLE