Skip to content

Commit 9e56392

Browse files
committed
Add LIBSQL_ENCRYPTION flag
1 parent fe5227a commit 9e56392

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

libsql-ffi/bundled/src/sqlite3.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121872,7 +121872,9 @@ 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+
#ifdef LIBSQL_ENCRYPTION
121875121876
SQLITE_PRIVATE int sqlite3mcHandleAttachKey(sqlite3*, const char*, const char*, sqlite3_value*, char**);
121877+
#endif
121876121878

121877121879
/*
121878121880
** An SQL user-function registered to do the work of an ATTACH statement. The
@@ -122034,6 +122036,7 @@ static void attachFunc(
122034122036
}
122035122037
#endif
122036122038

122039+
#ifdef LIBSQL_ENCRYPTION
122037122040
/* Handle KEY parameter. */
122038122041
if( rc==SQLITE_OK ){
122039122042
printf("attempting to handle the attach key\n");
@@ -122042,6 +122045,7 @@ static void attachFunc(
122042122045
rc = sqlite3mcHandleAttachKey(db, zName, zPath, argv[2], &zErrDyn);
122043122046
}
122044122047
}
122048+
#endif
122045122049

122046122050
sqlite3_free_filename( zPath );
122047122051

libsql-sqlite3/src/attach.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ int sqlite3DbIsNamed(sqlite3 *db, int iDb, const char *zName){
6161
int libsql_handle_extra_attach_params(sqlite3* db, const char* zName, const char* zPath, sqlite3_value* pKey, char** zErrDyn);
6262
#endif
6363

64+
#ifdef LIBSQL_ENCRYPTION
65+
SQLITE_PRIVATE int sqlite3mcHandleAttachKey(sqlite3*, const char*, const char*, sqlite3_value*, char**);
66+
#endif
67+
6468
/*
6569
** An SQL user-function registered to do the work of an ATTACH statement. The
6670
** three arguments to the function come directly from an attach statement:
@@ -220,6 +224,18 @@ static void attachFunc(
220224
rc = libsql_handle_extra_attach_params(db, zName, zPath, argv, &zErrDyn);
221225
}
222226
#endif
227+
228+
#ifdef LIBSQL_ENCRYPTION
229+
/* Handle KEY parameter. */
230+
if( rc==SQLITE_OK ){
231+
printf("attempting to handle the attach key\n");
232+
fflush(stdout);
233+
if( argv != NULL && argv[0] != NULL && argv[1] != NULL && argv[2] != NULL ){
234+
rc = sqlite3mcHandleAttachKey(db, zName, zPath, argv[2], &zErrDyn);
235+
}
236+
}
237+
#endif
238+
223239
sqlite3_free_filename( zPath );
224240

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

0 commit comments

Comments
 (0)