1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Report errors back up to the ATTACH command if the codec fails to initialize.

FossilOrigin-Name: a6c696102eb483080b0a1d31b85f6b5f85c3efbf
This commit is contained in:
drh
2009-11-04 01:56:27 +00:00
parent f639c40f77
commit e68e8c58c9
3 changed files with 21 additions and 11 deletions

View File

@@ -151,7 +151,7 @@ static void attachFunc(
aNew->safety_level = 3;
#if SQLITE_HAS_CODEC
{
if( rc==SQLITE_OK ){
extern int sqlite3CodecAttach(sqlite3*, int, const void*, int);
extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);
int nKey;
@@ -168,13 +168,13 @@ static void attachFunc(
case SQLITE_BLOB:
nKey = sqlite3_value_bytes(argv[2]);
zKey = (char *)sqlite3_value_blob(argv[2]);
sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
break;
case SQLITE_NULL:
/* No key specified. Use the key from the main database */
sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
break;
}
}