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

Merge the 3.50.2 changes into the reuse-schema-3.50 branch.

FossilOrigin-Name: b66f853a242c33e270ab744adbd277c4343ef1fd6b88e5f72b43deda94590d7a
This commit is contained in:
drh
2025-06-28 14:35:51 +00:00
20 changed files with 388 additions and 109 deletions

View File

@ -539,6 +539,7 @@ static int fts5StorageDeleteFromIndex(
for(iCol=1; rc==SQLITE_OK && iCol<=pConfig->nCol; iCol++){
if( pConfig->abUnindexed[iCol-1]==0 ){
sqlite3_value *pVal = 0;
sqlite3_value *pFree = 0;
const char *pText = 0;
int nText = 0;
const char *pLoc = 0;
@ -555,11 +556,22 @@ static int fts5StorageDeleteFromIndex(
if( pConfig->bLocale && sqlite3Fts5IsLocaleValue(pConfig, pVal) ){
rc = sqlite3Fts5DecodeLocaleValue(pVal, &pText, &nText, &pLoc, &nLoc);
}else{
pText = (const char*)sqlite3_value_text(pVal);
nText = sqlite3_value_bytes(pVal);
if( pConfig->bLocale && pSeek ){
pLoc = (const char*)sqlite3_column_text(pSeek, iCol + pConfig->nCol);
nLoc = sqlite3_column_bytes(pSeek, iCol + pConfig->nCol);
if( sqlite3_value_type(pVal)!=SQLITE_TEXT ){
/* Make a copy of the value to work with. This is because the call
** to sqlite3_value_text() below forces the type of the value to
** SQLITE_TEXT, and we may need to use it again later. */
pFree = pVal = sqlite3_value_dup(pVal);
if( pVal==0 ){
rc = SQLITE_NOMEM;
}
}
if( rc==SQLITE_OK ){
pText = (const char*)sqlite3_value_text(pVal);
nText = sqlite3_value_bytes(pVal);
if( pConfig->bLocale && pSeek ){
pLoc = (const char*)sqlite3_column_text(pSeek, iCol+pConfig->nCol);
nLoc = sqlite3_column_bytes(pSeek, iCol + pConfig->nCol);
}
}
}
@ -575,6 +587,7 @@ static int fts5StorageDeleteFromIndex(
}
sqlite3Fts5ClearLocale(pConfig);
}
sqlite3_value_free(pFree);
}
}
if( rc==SQLITE_OK && p->nTotalRow<1 ){

View File

@ -325,5 +325,25 @@ ifcapable foreignkey {
}
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 13.0 {
CREATE VIRTUAL TABLE t1 USING fts5(a, b);
INSERT INTO t1 VALUES('abc def', X'123456');
}
faultsim_save_and_close
do_faultsim_test 13 -faults oom* -prep {
faultsim_restore_and_reopen
} -body {
execsql {
UPDATE t1 SET a='def abc'
}
} -test {
faultsim_test_result {0 {}}
}
finish_test

View File

@ -28,4 +28,34 @@ do_execsql_test 1.1 {
INSERT INTO sss VALUES('まりや');
}
foreach {tn enc tok} {
1 utf-8 ascii
2 utf-16 ascii
3 utf-8 unicode61
4 utf-16 unicode61
} {
reset_db
do_execsql_test 1.$tn.0 "
PRAGMA encoding = '$enc';
CREATE VIRTUAL TABLE vt2 USING fts5(c0, c1, tokenize=$tok);
"
do_execsql_test 1.$tn.1 {
INSERT INTO vt2(c0, c1) VALUES ('bhal', x'17db');
}
do_execsql_test 1.$tn.2 {
UPDATE vt2 SET c0='bhal';
}
do_execsql_test 1.$tn.3 {
INSERT INTO vt2(vt2) VALUES('integrity-check')
}
do_execsql_test 1.$tn.4 {
SELECT quote(c1) FROM vt2
} {X'17DB'}
}
finish_test

View File

@ -92,13 +92,14 @@ SQLITE_EXTENSION_INIT1
# include <dirent.h>
# include <utime.h>
# include <sys/time.h>
# define STRUCT_STAT struct stat
#else
# include "windows.h"
# include <io.h>
# include <direct.h>
# include "test_windirent.h"
# define dirent DIRENT
# define stat _stat
# define STRUCT_STAT struct _stat
# define chmod(path,mode) fileio_chmod(path,mode)
# define mkdir(path,mode) fileio_mkdir(path)
#endif
@ -289,7 +290,7 @@ LPWSTR utf8_to_utf16(const char *z){
*/
static void statTimesToUtc(
const char *zPath,
struct stat *pStatBuf
STRUCT_STAT *pStatBuf
){
HANDLE hFindFile;
WIN32_FIND_DATAW fd;
@ -317,7 +318,7 @@ static void statTimesToUtc(
*/
static int fileStat(
const char *zPath,
struct stat *pStatBuf
STRUCT_STAT *pStatBuf
){
#if defined(_WIN32)
sqlite3_int64 sz = strlen(zPath);
@ -341,7 +342,7 @@ static int fileStat(
*/
static int fileLinkStat(
const char *zPath,
struct stat *pStatBuf
STRUCT_STAT *pStatBuf
){
#if defined(_WIN32)
return fileStat(zPath, pStatBuf);
@ -374,7 +375,7 @@ static int makeDirectory(
int i = 1;
while( rc==SQLITE_OK ){
struct stat sStat;
STRUCT_STAT sStat;
int rc2;
for(; zCopy[i]!='/' && i<nCopy; i++);
@ -424,7 +425,7 @@ static int writeFile(
** be an error though - if there is already a directory at the same
** path and either the permissions already match or can be changed
** to do so using chmod(), it is not an error. */
struct stat sStat;
STRUCT_STAT sStat;
if( errno!=EEXIST
|| 0!=fileStat(zFile, &sStat)
|| !S_ISDIR(sStat.st_mode)
@ -626,7 +627,7 @@ struct fsdir_cursor {
const char *zBase;
int nBase;
struct stat sStat; /* Current lstat() results */
STRUCT_STAT sStat; /* Current lstat() results */
char *zPath; /* Path to current entry */
sqlite3_int64 iRowid; /* Current rowid */
};

View File

@ -1193,9 +1193,11 @@ push-testing:
########################################################################
# If we find a copy of the sqlite.org/wasm docs checked out, copy
# certain files over to it, noting that some need automatable edits...
wasm.docs.home ?= ../../../wasm
wasm.docs.found = $(if $(wildcard $(wasm.docs.home)/api-index.md),\
$(wildcard $(wasm.docs.home)),)
wasm.docs.home ?= $(firstword $(wildcard ../../../wasm $(HOME)/f/s/wasm))
wasm.docs.found = $(if \
$(wildcard $(wasm.docs.home)/api-index.md),$(wildcard $(wasm.docs.home)),)
# ^^^ don't split between the args there, else it can introduce an extra
# space.
.PHONY: update-docs
ifeq (,$(wasm.docs.found))
update-docs: