Skip to content

Commit 67c1841

Browse files
committed
add sqlite3mc attach API
1 parent 6e55668 commit 67c1841

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

libsql-ffi/bundled/src/sqlite3.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121872,6 +121872,8 @@ SQLITE_PRIVATE int sqlite3DbIsNamed(sqlite3 *db, int iDb, const char *zName){
121872121872
int libsql_handle_extra_attach_params(sqlite3* db, const char* zName, const char* zPath, sqlite3_value* pKey, char** zErrDyn);
121873121873
#endif
121874121874

121875+
SQLITE_PRIVATE int sqlite3mcHandleAttachKey(sqlite3*, const char*, const char*, sqlite3_value*, char**);
121876+
121875121877
/*
121876121878
** An SQL user-function registered to do the work of an ATTACH statement. The
121877121879
** three arguments to the function come directly from an attach statement:
@@ -122031,6 +122033,16 @@ static void attachFunc(
122031122033
rc = libsql_handle_extra_attach_params(db, zName, zPath, argv, &zErrDyn);
122032122034
}
122033122035
#endif
122036+
122037+
/* Handle KEY parameter. */
122038+
if( rc==SQLITE_OK ){
122039+
printf("attempting to handle the attach key\n");
122040+
fflush(stdout);
122041+
if( argv != NULL && argv[0] != NULL && argv[1] != NULL && argv[2] != NULL ){
122042+
rc = sqlite3mcHandleAttachKey(db, zName, zPath, argv[2], &zErrDyn);
122043+
}
122044+
}
122045+
122034122046
sqlite3_free_filename( zPath );
122035122047

122036122048
/* If the file was opened successfully, read the schema for the new database.

0 commit comments

Comments
 (0)