#define ZONEFILE_MAGIC_NUMBER 0x464B3138
-#define ZONEFILE_SZ_HEADER 26
+#define ZONEFILE_SZ_HEADER 32
#define ZONEFILE_SZ_KEYOFFSETS_ENTRY 20
#define ZONEFILE_DEFAULT_MAXAUTOFRAMESIZE (64*1024)
const char *zJson, /* JSON configuration parameter (or NULL) */
ZonefileWrite *p /* Populate this object before returning */
){
+ sqlite3 *db = sqlite3_context_db_handle(pCtx);
+ sqlite3_stmt *pStmt = 0;
+ char *zErr = 0;
+ int rc = SQLITE_OK;
+ int rc2;
+
memset(p, 0, sizeof(ZonefileWrite));
p->maxAutoFrameSize = ZONEFILE_DEFAULT_MAXAUTOFRAMESIZE;
- return SQLITE_OK;
+
+ rc = zonefilePrepare(db, &pStmt, &zErr,"SELECT key, value FROM json_each(?)");
+ while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
+ const char *zKey = (const char*)sqlite3_column_text(pStmt, 0);
+ int iVal = sqlite3_column_int(pStmt, 1);
+ if( sqlite3_stricmp("maxAutoFrameSize", zKey)==0 ){
+ p->maxAutoFrameSize = iVal;
+ }else
+ if( sqlite3_stricmp("compressionTypeIndexData", zKey)==0 ){
+ p->compressionTypeIndexData = iVal;
+ }else
+ if( sqlite3_stricmp("compressionTypeContent", zKey)==0 ){
+ p->compressionTypeContent = iVal;
+ }else
+ if( sqlite3_stricmp("encryptionType", zKey)==0 ){
+ p->encryptionType = iVal;
+ }else{
+ rc = SQLITE_ERROR;
+ zErr = sqlite3_mprintf("unknown parameter name: \"%s\"", zKey);
+ }
+ }
+ rc2 = sqlite3_finalize(pStmt);
+ if( rc==SQLITE_OK ) rc = rc2;
+
+ if( zErr ){
+ sqlite3_result_error(pCtx, zErr, -1);
+ sqlite3_free(zErr);
+ }
+ return rc;
}
/*
pPrev = 0;
/* Create the zonefile header in the in-memory buffer */
+ memset(aHdr, 0, ZONEFILE_SZ_HEADER);
zonefilePut32(&aHdr[0], ZONEFILE_MAGIC_NUMBER);
aHdr[4] = sWrite.compressionTypeIndexData;
aHdr[5] = sWrite.compressionTypeContent;
aHdr[23] = 0; /* Encryption key index */
aHdr[24] = 0; /* extended header version */
aHdr[25] = 0; /* extended header size */
- assert( ZONEFILE_SZ_HEADER==26 );
+ assert( ZONEFILE_SZ_HEADER>=26 );
rc = zonefileFileWrite(pFd, aHdr, ZONEFILE_SZ_HEADER);
if( rc==SQLITE_OK ) rc = zonefileFileWrite(pFd, sFrameIdx.a, sFrameIdx.n);
-C Add\ssupport\sfor\sreading\ssimple\s(no\scompression,\sno\sencryption)\szonefile\sfiles.
-D 2018-02-12T20:04:22.636
+C Pad\sthe\s26\sbyte\sZonefile\sheader\sto\s32\sbytes\sso\sthat\sthe\sZonefileIndex\sobject\nis\s8-byte\saligned.
+D 2018-02-13T17:33:28.294
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 7a3f714b4fcf793108042b7b0a5c720b0b310ec84314d61ba7f3f49f27e550ea
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 3410be31283abba70255d71fd24734e017a4497f
F ext/zonefile/README.md d675dbdffe2cd6d54681b958a13c88433a5022d39ab9ef3d4f487a272603f902
-F ext/zonefile/zonefile.c 31a8627c6fb619f4b87993abb22f2e38f14eb2bdf53130c425ba711d17eedb91
+F ext/zonefile/zonefile.c ed633fa36e07eb7f23484bc05d791c4d694b3b4e9d35badf49e53abdb7d579bc
F ext/zonefile/zonefile1.test 8904658bd8332dc0d0c77c0c74c9c83dce4123a442bb971d5baf00170f6d0afe
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 0b7bd1694bf50a5afed22ed3026cefe53c5e7ec334167244e2caa9c56185ff43
-R 33d1fa645c0dd3199e4abbacb34944f8
+P dba42f0e1efae7bad4579d23ad98e2c06e38053abe55f5cb277d7eecea42c56c
+R a2267f09422e3c7541908b968634faac
U dan
-Z de15678e60eb47332eda44ee08650662
+Z 6e2ce05e6036b2dfe07f6724215b9f81