Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 40 additions & 32 deletions libsql-ffi/bundled/SQLite3MultipleCiphers/src/sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
** README.md
** configure
** configure.ac
** doc/compile-for-windows.md
** doc/jsonb.md
** doc/testrunner.md
** doc/trusted-schema.md
** doc/vdbesort-memory.md
** doc/wal-lock.md
** ext/fts5/fts5_tokenize.c
** ext/jni/README.md
** ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java
** ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java
** ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java
Expand Down Expand Up @@ -81,38 +88,9 @@
** src/where.c
** src/wherecode.c
** test/all.test
** test/dbdata.test
** test/dbfuzz.c
** test/dbfuzz001.test
** test/dbfuzz2-seed1.db
** test/dbfuzz2.c
** test/dbpage.test
** test/dbpagefault.test
** test/dbstatus.test
** test/dbstatus2.test
** test/delete_db.test
** test/fuzzdata1.db
** test/fuzzdata2.db
** test/fuzzdata3.db
** test/fuzzdata4.db
** test/fuzzdata5.db
** test/fuzzdata6.db
** test/fuzzdata7.db
** test/fuzzdata8.db
** test/indexedby.test
** test/manydb.test
** test/memdb.test
** test/memdb1.test
** test/memdb2.test
** test/optfuzz-db01.c
** test/optfuzz-db01.txt
** test/json/README.md
** test/permutations.test
** test/resetdb.test
** test/rowvaluevtab.test
** test/sessionfuzz-data1.db
** test/tempdb.test
** test/tempdb2.test
** test/tkt-94c04eaadb.test
** tool/mkkeywordhash.c
** tool/mksqlite3c-noext.tcl
** tool/mksqlite3c.tcl
Expand Down Expand Up @@ -65386,18 +65364,25 @@ SQLITE_PRIVATE int sqlite3PagerWalInsert(Pager *pPager, unsigned int iFrame, voi
}
if (iFrame <= mxFrame) {
unsigned long frame_len = nBuf-24;
unsigned char current[frame_len];
unsigned char *current;

current = (unsigned char *)sqlite3MallocZero(frame_len);
if (current == NULL) {
return SQLITE_NOMEM;
}
rc = pPager->wal->methods.xReadFrame(pPager->wal->pData, iFrame, frame_len, current);
if (rc != SQLITE_OK) {
sqlite3_free(current);
return rc;
}
int conflict = 0;
if (memcmp(pBuf+24, current, frame_len) != 0) {
if (memcmp((unsigned char*)pBuf+24, current, frame_len) != 0) {
conflict = 1;
}
if (pConflict) {
*pConflict = conflict;
}
sqlite3_free(current);
if (conflict) {
return SQLITE_ERROR;
}
Expand Down Expand Up @@ -67628,6 +67613,15 @@ static int walCheckpoint(
}
}


#ifdef LIBSQL_CHECKPOINT_ONLY_FULL
// in case of LIBSQL_CHECKPOINT_ONLY_FULL option we want to either checkpoint whole WAL or quickly abort the checkpoint
if( mxSafeFrame!=walIndexHdr(pWal)->mxFrame ){
rc = SQLITE_BUSY;
goto walcheckpoint_out;
}
#endif

/* Allocate the iterator */
if( pInfo->nBackfill<mxSafeFrame ){
rc = walIteratorRevInit(pWal, pInfo->nBackfill, &pIter, mxSafeFrame, xCb == NULL);
Expand Down Expand Up @@ -121878,6 +121872,10 @@ SQLITE_PRIVATE int sqlite3DbIsNamed(sqlite3 *db, int iDb, const char *zName){
int libsql_handle_extra_attach_params(sqlite3* db, const char* zName, const char* zPath, sqlite3_value* pKey, char** zErrDyn);
#endif

#ifdef LIBSQL_ENCRYPTION
SQLITE_PRIVATE int sqlite3mcHandleAttachKey(sqlite3*, const char*, const char*, sqlite3_value*, char**);
#endif

/*
** An SQL user-function registered to do the work of an ATTACH statement. The
** three arguments to the function come directly from an attach statement:
Expand Down Expand Up @@ -122037,6 +122035,16 @@ static void attachFunc(
rc = libsql_handle_extra_attach_params(db, zName, zPath, argv, &zErrDyn);
}
#endif

#ifdef LIBSQL_ENCRYPTION
/* If the ATTACH statement came with key parameter, then lets handle it here. */
if( rc==SQLITE_OK ){
if( argv != NULL && argv[0] != NULL && argv[1] != NULL && argv[2] != NULL ){
rc = sqlite3mcHandleAttachKey(db, zName, zPath, argv[2], &zErrDyn);
}
}
#endif

sqlite3_free_filename( zPath );

/* If the file was opened successfully, read the schema for the new database.
Expand Down
Loading