Skip to content

Commit 853143d

Browse files
committed
build bundles
1 parent 76558e8 commit 853143d

File tree

3 files changed

+79
-57
lines changed

3 files changed

+79
-57
lines changed

libsql-ffi/bundled/SQLite3MultipleCiphers/src/sqlite3.c

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
** src/test2.c
7070
** src/test3.c
7171
** src/test8.c
72+
** src/vacuum.c
7273
** src/vdbe.c
7374
** src/vdbeInt.h
7475
** src/vdbeapi.c
@@ -155950,6 +155951,10 @@ SQLITE_PRIVATE void sqlite3UpsertDoUpdate(
155950155951
/* #include "sqliteInt.h" */
155951155952
/* #include "vdbeInt.h" */
155952155953

155954+
#ifndef SQLITE_OMIT_VECTOR
155955+
/* #include "vectorIndexInt.h" */
155956+
#endif
155957+
155953155958
#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)
155954155959

155955155960
/*
@@ -156227,6 +156232,27 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum(
156227156232
if( rc!=SQLITE_OK ) goto end_of_vacuum;
156228156233
db->init.iDb = 0;
156229156234

156235+
#ifndef SQLITE_OMIT_VECTOR
156236+
// shadow tables for vector index will be populated automatically during CREATE INDEX command
156237+
// so we must skip them at this step
156238+
if( sqlite3FindTable(db, VECTOR_INDEX_GLOBAL_META_TABLE, zDbMain) != NULL ){
156239+
rc = execSqlF(db, pzErrMsg,
156240+
"SELECT'INSERT INTO vacuum_db.'||quote(name)"
156241+
"||' SELECT*FROM\"%w\".'||quote(name)"
156242+
"FROM vacuum_db.sqlite_schema "
156243+
"WHERE type='table'AND coalesce(rootpage,1)>0 AND name NOT IN (SELECT name||'_shadow' FROM " VECTOR_INDEX_GLOBAL_META_TABLE ")",
156244+
zDbMain
156245+
);
156246+
}else{
156247+
rc = execSqlF(db, pzErrMsg,
156248+
"SELECT'INSERT INTO vacuum_db.'||quote(name)"
156249+
"||' SELECT*FROM\"%w\".'||quote(name)"
156250+
"FROM vacuum_db.sqlite_schema "
156251+
"WHERE type='table'AND coalesce(rootpage,1)>0 AND name",
156252+
zDbMain
156253+
);
156254+
}
156255+
#else
156230156256
/* Loop through the tables in the main database. For each, do
156231156257
** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy
156232156258
** the contents to the temporary database.
@@ -156238,6 +156264,7 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum(
156238156264
"WHERE type='table'AND coalesce(rootpage,1)>0",
156239156265
zDbMain
156240156266
);
156267+
#endif
156241156268
assert( (db->mDbFlags & DBFLAG_Vacuum)!=0 );
156242156269
db->mDbFlags &= ~DBFLAG_Vacuum;
156243156270
if( rc!=SQLITE_OK ) goto end_of_vacuum;
@@ -213656,11 +213683,6 @@ int vectorF64ParseSqliteBlob(
213656213683
** VectorIdxParams utilities
213657213684
****************************************************************************/
213658213685

213659-
// VACUUM creates tables and indices first and only then populate data
213660-
// we need to ignore inserts from 'INSERT INTO vacuum.t SELECT * FROM t' statements because
213661-
// all shadow tables will be populated by VACUUM process during regular process of table copy
213662-
#define IsVacuum(db) ((db->mDbFlags&DBFLAG_Vacuum)!=0)
213663-
213664213686
void vectorIdxParamsInit(VectorIdxParams *pParams, u8 *pBinBuf, int nBinSize) {
213665213687
assert( nBinSize <= VECTOR_INDEX_PARAMS_BUF_SIZE );
213666213688

@@ -214379,10 +214401,6 @@ int vectorIndexDrop(sqlite3 *db, const char *zDbSName, const char *zIdxName) {
214379214401
// this is done to prevent unrecoverable situations where index were dropped but index parameters deletion failed and second attempt will fail on first step
214380214402
int rcIdx, rcParams;
214381214403

214382-
if( IsVacuum(db) ){
214383-
return SQLITE_OK;
214384-
}
214385-
214386214404
assert( zDbSName != NULL );
214387214405

214388214406
rcIdx = diskAnnDropIndex(db, zDbSName, zIdxName);
@@ -214393,10 +214411,6 @@ int vectorIndexDrop(sqlite3 *db, const char *zDbSName, const char *zIdxName) {
214393214411
int vectorIndexClear(sqlite3 *db, const char *zDbSName, const char *zIdxName) {
214394214412
assert( zDbSName != NULL );
214395214413

214396-
if( IsVacuum(db) ){
214397-
return SQLITE_OK;
214398-
}
214399-
214400214414
return diskAnnClearIndex(db, zDbSName, zIdxName);
214401214415
}
214402214416

@@ -214406,7 +214420,7 @@ int vectorIndexClear(sqlite3 *db, const char *zDbSName, const char *zIdxName) {
214406214420
* this made intentionally in order to natively support upload of SQLite dumps
214407214421
*
214408214422
* dump populates tables first and create indices after
214409-
* so we must omit them because shadow tables already filled
214423+
* so we must omit index refill setp because shadow tables already filled
214410214424
*
214411214425
* 1. in case of any error :-1 returned (and pParse errMsg is populated with some error message)
214412214426
* 2. if vector index must not be created : 0 returned
@@ -214424,10 +214438,6 @@ int vectorIndexCreate(Parse *pParse, const Index *pIdx, const char *zDbSName, co
214424214438
int hasLibsqlVectorIdxFn = 0, hasCollation = 0;
214425214439
const char *pzErrMsg;
214426214440

214427-
if( IsVacuum(pParse->db) ){
214428-
return CREATE_IGNORE;
214429-
}
214430-
214431214441
assert( zDbSName != NULL );
214432214442

214433214443
sqlite3 *db = pParse->db;
@@ -214577,7 +214587,6 @@ int vectorIndexSearch(
214577214587
VectorIdxParams idxParams;
214578214588
vectorIdxParamsInit(&idxParams, NULL, 0);
214579214589

214580-
assert( !IsVacuum(db) );
214581214590
assert( zDbSName != NULL );
214582214591

214583214592
if( argc != 3 ){
@@ -214662,10 +214671,6 @@ int vectorIndexInsert(
214662214671
int rc;
214663214672
VectorInRow vectorInRow;
214664214673

214665-
if( IsVacuum(pCur->db) ){
214666-
return SQLITE_OK;
214667-
}
214668-
214669214674
rc = vectorInRowAlloc(pCur->db, pRecord, &vectorInRow, pzErrMsg);
214670214675
if( rc != SQLITE_OK ){
214671214676
return rc;
@@ -214685,10 +214690,6 @@ int vectorIndexDelete(
214685214690
){
214686214691
VectorInRow payload;
214687214692

214688-
if( IsVacuum(pCur->db) ){
214689-
return SQLITE_OK;
214690-
}
214691-
214692214693
payload.pVector = NULL;
214693214694
payload.nKeys = r->nField - 1;
214694214695
payload.pKeyValues = r->aMem + 1;

libsql-ffi/bundled/bindings/bindgen.rs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ extern "C" {
2424
}
2525

2626
pub const __GNUC_VA_LIST: i32 = 1;
27-
pub const SQLITE_VERSION: &[u8; 7] = b"3.44.0\0";
28-
pub const SQLITE_VERSION_NUMBER: i32 = 3044000;
27+
pub const SQLITE_VERSION: &[u8; 7] = b"3.45.1\0";
28+
pub const SQLITE_VERSION_NUMBER: i32 = 3045001;
2929
pub const SQLITE_SOURCE_ID: &[u8; 85] =
30-
b"2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad8alt1\0";
30+
b"2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257ccalt1\0";
3131
pub const LIBSQL_VERSION: &[u8; 6] = b"0.2.3\0";
3232
pub const SQLITE_OK: i32 = 0;
3333
pub const SQLITE_ERROR: i32 = 1;
@@ -356,6 +356,7 @@ pub const SQLITE_DETERMINISTIC: i32 = 2048;
356356
pub const SQLITE_DIRECTONLY: i32 = 524288;
357357
pub const SQLITE_SUBTYPE: i32 = 1048576;
358358
pub const SQLITE_INNOCUOUS: i32 = 2097152;
359+
pub const SQLITE_RESULT_SUBTYPE: i32 = 16777216;
359360
pub const SQLITE_WIN32_DATA_DIRECTORY_TYPE: i32 = 1;
360361
pub const SQLITE_WIN32_TEMP_DIRECTORY_TYPE: i32 = 2;
361362
pub const SQLITE_TXN_NONE: i32 = 0;
@@ -408,6 +409,7 @@ pub const SQLITE_TESTCTRL_PENDING_BYTE: i32 = 11;
408409
pub const SQLITE_TESTCTRL_ASSERT: i32 = 12;
409410
pub const SQLITE_TESTCTRL_ALWAYS: i32 = 13;
410411
pub const SQLITE_TESTCTRL_RESERVE: i32 = 14;
412+
pub const SQLITE_TESTCTRL_JSON_SELFCHECK: i32 = 14;
411413
pub const SQLITE_TESTCTRL_OPTIMIZATIONS: i32 = 15;
412414
pub const SQLITE_TESTCTRL_ISKEYWORD: i32 = 16;
413415
pub const SQLITE_TESTCTRL_SCRATCHMALLOC: i32 = 17;
@@ -3133,6 +3135,24 @@ pub struct Fts5ExtensionApi {
31333135
piCol: *mut ::std::os::raw::c_int,
31343136
),
31353137
>,
3138+
pub xQueryToken: ::std::option::Option<
3139+
unsafe extern "C" fn(
3140+
arg1: *mut Fts5Context,
3141+
iPhrase: ::std::os::raw::c_int,
3142+
iToken: ::std::os::raw::c_int,
3143+
ppToken: *mut *const ::std::os::raw::c_char,
3144+
pnToken: *mut ::std::os::raw::c_int,
3145+
) -> ::std::os::raw::c_int,
3146+
>,
3147+
pub xInstToken: ::std::option::Option<
3148+
unsafe extern "C" fn(
3149+
arg1: *mut Fts5Context,
3150+
iIdx: ::std::os::raw::c_int,
3151+
iToken: ::std::os::raw::c_int,
3152+
arg2: *mut *const ::std::os::raw::c_char,
3153+
arg3: *mut ::std::os::raw::c_int,
3154+
) -> ::std::os::raw::c_int,
3155+
>,
31363156
}
31373157
#[repr(C)]
31383158
#[derive(Debug, Copy, Clone)]

libsql-ffi/bundled/src/sqlite3.c

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
** src/test2.c
7070
** src/test3.c
7171
** src/test8.c
72+
** src/vacuum.c
7273
** src/vdbe.c
7374
** src/vdbeInt.h
7475
** src/vdbeapi.c
@@ -155950,6 +155951,10 @@ SQLITE_PRIVATE void sqlite3UpsertDoUpdate(
155950155951
/* #include "sqliteInt.h" */
155951155952
/* #include "vdbeInt.h" */
155952155953

155954+
#ifndef SQLITE_OMIT_VECTOR
155955+
/* #include "vectorIndexInt.h" */
155956+
#endif
155957+
155953155958
#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)
155954155959

155955155960
/*
@@ -156227,6 +156232,27 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum(
156227156232
if( rc!=SQLITE_OK ) goto end_of_vacuum;
156228156233
db->init.iDb = 0;
156229156234

156235+
#ifndef SQLITE_OMIT_VECTOR
156236+
// shadow tables for vector index will be populated automatically during CREATE INDEX command
156237+
// so we must skip them at this step
156238+
if( sqlite3FindTable(db, VECTOR_INDEX_GLOBAL_META_TABLE, zDbMain) != NULL ){
156239+
rc = execSqlF(db, pzErrMsg,
156240+
"SELECT'INSERT INTO vacuum_db.'||quote(name)"
156241+
"||' SELECT*FROM\"%w\".'||quote(name)"
156242+
"FROM vacuum_db.sqlite_schema "
156243+
"WHERE type='table'AND coalesce(rootpage,1)>0 AND name NOT IN (SELECT name||'_shadow' FROM " VECTOR_INDEX_GLOBAL_META_TABLE ")",
156244+
zDbMain
156245+
);
156246+
}else{
156247+
rc = execSqlF(db, pzErrMsg,
156248+
"SELECT'INSERT INTO vacuum_db.'||quote(name)"
156249+
"||' SELECT*FROM\"%w\".'||quote(name)"
156250+
"FROM vacuum_db.sqlite_schema "
156251+
"WHERE type='table'AND coalesce(rootpage,1)>0 AND name",
156252+
zDbMain
156253+
);
156254+
}
156255+
#else
156230156256
/* Loop through the tables in the main database. For each, do
156231156257
** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy
156232156258
** the contents to the temporary database.
@@ -156238,6 +156264,7 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum(
156238156264
"WHERE type='table'AND coalesce(rootpage,1)>0",
156239156265
zDbMain
156240156266
);
156267+
#endif
156241156268
assert( (db->mDbFlags & DBFLAG_Vacuum)!=0 );
156242156269
db->mDbFlags &= ~DBFLAG_Vacuum;
156243156270
if( rc!=SQLITE_OK ) goto end_of_vacuum;
@@ -213656,11 +213683,6 @@ int vectorF64ParseSqliteBlob(
213656213683
** VectorIdxParams utilities
213657213684
****************************************************************************/
213658213685

213659-
// VACUUM creates tables and indices first and only then populate data
213660-
// we need to ignore inserts from 'INSERT INTO vacuum.t SELECT * FROM t' statements because
213661-
// all shadow tables will be populated by VACUUM process during regular process of table copy
213662-
#define IsVacuum(db) ((db->mDbFlags&DBFLAG_Vacuum)!=0)
213663-
213664213686
void vectorIdxParamsInit(VectorIdxParams *pParams, u8 *pBinBuf, int nBinSize) {
213665213687
assert( nBinSize <= VECTOR_INDEX_PARAMS_BUF_SIZE );
213666213688

@@ -214379,10 +214401,6 @@ int vectorIndexDrop(sqlite3 *db, const char *zDbSName, const char *zIdxName) {
214379214401
// this is done to prevent unrecoverable situations where index were dropped but index parameters deletion failed and second attempt will fail on first step
214380214402
int rcIdx, rcParams;
214381214403

214382-
if( IsVacuum(db) ){
214383-
return SQLITE_OK;
214384-
}
214385-
214386214404
assert( zDbSName != NULL );
214387214405

214388214406
rcIdx = diskAnnDropIndex(db, zDbSName, zIdxName);
@@ -214393,10 +214411,6 @@ int vectorIndexDrop(sqlite3 *db, const char *zDbSName, const char *zIdxName) {
214393214411
int vectorIndexClear(sqlite3 *db, const char *zDbSName, const char *zIdxName) {
214394214412
assert( zDbSName != NULL );
214395214413

214396-
if( IsVacuum(db) ){
214397-
return SQLITE_OK;
214398-
}
214399-
214400214414
return diskAnnClearIndex(db, zDbSName, zIdxName);
214401214415
}
214402214416

@@ -214406,7 +214420,7 @@ int vectorIndexClear(sqlite3 *db, const char *zDbSName, const char *zIdxName) {
214406214420
* this made intentionally in order to natively support upload of SQLite dumps
214407214421
*
214408214422
* dump populates tables first and create indices after
214409-
* so we must omit them because shadow tables already filled
214423+
* so we must omit index refill setp because shadow tables already filled
214410214424
*
214411214425
* 1. in case of any error :-1 returned (and pParse errMsg is populated with some error message)
214412214426
* 2. if vector index must not be created : 0 returned
@@ -214424,10 +214438,6 @@ int vectorIndexCreate(Parse *pParse, const Index *pIdx, const char *zDbSName, co
214424214438
int hasLibsqlVectorIdxFn = 0, hasCollation = 0;
214425214439
const char *pzErrMsg;
214426214440

214427-
if( IsVacuum(pParse->db) ){
214428-
return CREATE_IGNORE;
214429-
}
214430-
214431214441
assert( zDbSName != NULL );
214432214442

214433214443
sqlite3 *db = pParse->db;
@@ -214577,7 +214587,6 @@ int vectorIndexSearch(
214577214587
VectorIdxParams idxParams;
214578214588
vectorIdxParamsInit(&idxParams, NULL, 0);
214579214589

214580-
assert( !IsVacuum(db) );
214581214590
assert( zDbSName != NULL );
214582214591

214583214592
if( argc != 3 ){
@@ -214662,10 +214671,6 @@ int vectorIndexInsert(
214662214671
int rc;
214663214672
VectorInRow vectorInRow;
214664214673

214665-
if( IsVacuum(pCur->db) ){
214666-
return SQLITE_OK;
214667-
}
214668-
214669214674
rc = vectorInRowAlloc(pCur->db, pRecord, &vectorInRow, pzErrMsg);
214670214675
if( rc != SQLITE_OK ){
214671214676
return rc;
@@ -214685,10 +214690,6 @@ int vectorIndexDelete(
214685214690
){
214686214691
VectorInRow payload;
214687214692

214688-
if( IsVacuum(pCur->db) ){
214689-
return SQLITE_OK;
214690-
}
214691-
214692214693
payload.pVector = NULL;
214693214694
payload.nKeys = r->nField - 1;
214694214695
payload.pKeyValues = r->aMem + 1;

0 commit comments

Comments
 (0)