mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
When compiling with SQLITE_HAS_CODEC, honor the hexkey= query parameter on
URI pathnames in sqlite3_open_v2(). FossilOrigin-Name: e0ce3fc089c2523b8b718b4a4f9ab8c4d0432fc7
This commit is contained in:
15
src/main.c
15
src/main.c
@@ -2954,6 +2954,21 @@ opendb_out:
|
||||
void *pArg = sqlite3GlobalConfig.pSqllogArg;
|
||||
sqlite3GlobalConfig.xSqllog(pArg, db, zFilename, 0);
|
||||
}
|
||||
#endif
|
||||
#if defined(SQLITE_HAS_CODEC)
|
||||
if( rc==SQLITE_OK ){
|
||||
const char *zHexKey = sqlite3_uri_parameter(zOpen, "hexkey");
|
||||
if( zHexKey && zHexKey[0] ){
|
||||
u8 iByte;
|
||||
int i;
|
||||
char zKey[40];
|
||||
for(i=0, iByte=0; i<sizeof(zKey)*2 && sqlite3Isxdigit(zHexKey[i]); i++){
|
||||
iByte = (iByte<<4) + sqlite3HexToInt(zHexKey[i]);
|
||||
if( (i&1)!=0 ) zKey[i/2] = iByte;
|
||||
}
|
||||
sqlite3_key_v2(db, 0, zKey, i/2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return rc & 0xff;
|
||||
}
|
||||
|
Reference in New Issue
Block a user