Compiles and loads as an extension. Starts to run but quickly hits issues.

FossilOrigin-Name: 2e38726f46918b28b5c638967f960a20afd3fe84ad245f3bea39a1d64980435b
This commit is contained in:
drh 2022-09-08 17:12:12 +00:00
parent e3485ee996
commit 7cd81af3a9
3 changed files with 19 additions and 18 deletions

View File

@ -195,7 +195,7 @@ static int kvstorageWrite(
kvstorageMakeKey(pStore, zKey);
fd = fopen(pStore->zKey, "wb");
if( fd ){
KVVFS_TRACE(("KVVFS-WRITE %-12s (%d) %.30s\n", pStore->zKey,
KVVFS_TRACE(("KVVFS-WRITE %-14s (%d) %.30s\n", pStore->zKey,
(int)strlen(zData), zData));
fputs(zData, fd);
fclose(fd);
@ -210,7 +210,7 @@ static int kvstorageWrite(
static int kvstorageDelete(KVStorage *pStore, const char *zKey){
kvstorageMakeKey(pStore, zKey);
unlink(pStore->zKey);
KVVFS_TRACE(("KVVFS-DELETE %-12s\n", pStore->zKey));
KVVFS_TRACE(("KVVFS-DELETE %-14s\n", pStore->zKey));
return 0;
}
@ -239,14 +239,14 @@ static int kvstorageRead(
|| stat(pStore->zKey, &buf)!=0
|| !S_ISREG(buf.st_mode)
){
KVVFS_TRACE(("KVVFS-READ %-12s (-1)\n", pStore->zKey));
KVVFS_TRACE(("KVVFS-READ %-14s (-1)\n", pStore->zKey));
return -1;
}
if( nBuf<0 ){
return (int)buf.st_size;
}else if( nBuf==1 ){
zBuf[0] = 0;
KVVFS_TRACE(("KVVFS-READ %-12s (%d)\n", pStore->zKey,
KVVFS_TRACE(("KVVFS-READ %-14s (%d)\n", pStore->zKey,
(int)buf.st_size));
return (int)buf.st_size;
}
@ -255,12 +255,12 @@ static int kvstorageRead(
}
fd = fopen(pStore->zKey, "rb");
if( fd==0 ){
KVVFS_TRACE(("KVVFS-READ %-12s (-1)\n", pStore->zKey));
KVVFS_TRACE(("KVVFS-READ %-14s (-1)\n", pStore->zKey));
return -1;
}else{
fread(zBuf, nBuf-1, 1, fd);
fclose(fd);
KVVFS_TRACE(("KVVFS-READ %-12s (%d) %.30s\n", pStore->zKey,
KVVFS_TRACE(("KVVFS-READ %-14s (%d) %.30s\n", pStore->zKey,
nBuf-1, zBuf));
return nBuf-1;
}
@ -456,7 +456,6 @@ static int kvvfsReadFromDb(
int got, n;
char zKey[30];
char aData[131073];
assert( pFile->szDb>=0 );
assert( iOfst>=0 );
assert( iAmt>=0 );
if( (iOfst % iAmt)!=0 ){
@ -472,10 +471,11 @@ static int kvvfsReadFromDb(
sqlite3_snprintf(sizeof(zKey), zKey, "pg-%u", pgno);
got = kvstorageRead(pFile->pVfs->pStore, zKey, aData, sizeof(aData)-1);
if( got<0 ){
return SQLITE_IOERR_READ;
n = 0;
}else{
aData[got] = 0;
n = kvvfsDecode(aData, zBuf, iAmt);
}
aData[got] = 0;
n = kvvfsDecode(aData, zBuf, iAmt);
if( n<iAmt ){
memset(zBuf+n, 0, iAmt-n);
return SQLITE_IOERR_SHORT_READ;
@ -848,5 +848,6 @@ int sqlite3_vfskv_init(
const sqlite3_api_routines *pApi
){
SQLITE_EXTENSION_INIT2(pApi);
return sqlite3_vfs_register(&kvvfs_vfs.base, 1);
sqlite3_vfs_register(&kvvfs_vfs.base, 1);
return SQLITE_OK_LOAD_PERMANENTLY;
}

View File

@ -1,5 +1,5 @@
C Compiles\swithout\serror,\sbut\suntested.
D 2022-09-08T16:27:50.573
C Compiles\sand\sloads\sas\san\sextension.\s\sStarts\sto\srun\sbut\squickly\shits\sissues.
D 2022-09-08T17:12:12.069
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -335,7 +335,7 @@ F ext/misc/uint.c 053fed3bce2e89583afcd4bf804d75d659879bbcedac74d0fa9ed548839a03
F ext/misc/unionvtab.c 36237f0607ca954ac13a4a0e2d2ac40c33bc6e032a5f55f431713061ef1625f9
F ext/misc/urifuncs.c f71360d14fa9e7626b563f1f781c6148109462741c5235ac63ae0f8917b9c751
F ext/misc/uuid.c 5bb2264c1b64d163efa46509544fd7500cb8769cb7c16dd52052da8d961505cf
F ext/misc/vfskv.c f21561436948a853c4df512c68a814ef69d8a278dbbbacbf2acceed1aa477d02
F ext/misc/vfskv.c 8664e43778e5d7cda6abd2e57ec374e7e0eb424ff4da093847bac7aa154c7789
F ext/misc/vfslog.c 3932ab932eeb2601dbc4447cb14d445aaa9fbe43b863ef5f014401c3420afd20
F ext/misc/vfsstat.c 474d08efc697b8eba300082cb1eb74a5f0f3df31ed257db1cb07e72ab0e53dfb
F ext/misc/vtablog.c 5538acd0c8ddaae372331bee11608d76973436b77d6a91e8635cfc9432fba5ae
@ -2001,8 +2001,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 51e267696d25f2f83b5bb847d5254ab15573ef1a16ea3d7dd8279c73c0bee539
R 3f65efdb484bcd33ce484018dd231698
P a329939c32e33d8d00066ba3d4327f07cca1b4e67de0b8d85f1e7f98afe40954
R 3c0347d709594b19afa07b9bd97b3623
U drh
Z e40c8d61375542bcfdfb80455dd845c0
Z c98d8a23118cf655e6b32d119c295b3c
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
a329939c32e33d8d00066ba3d4327f07cca1b4e67de0b8d85f1e7f98afe40954
2e38726f46918b28b5c638967f960a20afd3fe84ad245f3bea39a1d64980435b