mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Change zipfile to be a WITHOUT ROWID virtual table and table-valued function.
FossilOrigin-Name: 931201f64e04247ed613a0301fcc86c3a337c2ed162c6370a80c67a1dd919e7c
This commit is contained in:
@ -57,7 +57,7 @@ typedef unsigned long u32;
|
|||||||
|
|
||||||
static const char ZIPFILE_SCHEMA[] =
|
static const char ZIPFILE_SCHEMA[] =
|
||||||
"CREATE TABLE y("
|
"CREATE TABLE y("
|
||||||
"name," /* 0: Name of file in zip archive */
|
"name PRIMARY KEY," /* 0: Name of file in zip archive */
|
||||||
"mode," /* 1: POSIX mode for file */
|
"mode," /* 1: POSIX mode for file */
|
||||||
"mtime," /* 2: Last modification time (secs since 1970)*/
|
"mtime," /* 2: Last modification time (secs since 1970)*/
|
||||||
"sz," /* 3: Size of object */
|
"sz," /* 3: Size of object */
|
||||||
@ -65,7 +65,7 @@ static const char ZIPFILE_SCHEMA[] =
|
|||||||
"data," /* 5: Uncompressed data */
|
"data," /* 5: Uncompressed data */
|
||||||
"method," /* 6: Compression method (integer) */
|
"method," /* 6: Compression method (integer) */
|
||||||
"file HIDDEN" /* 7: Name of zip file */
|
"file HIDDEN" /* 7: Name of zip file */
|
||||||
");";
|
") WITHOUT ROWID;";
|
||||||
|
|
||||||
#define ZIPFILE_F_COLUMN_IDX 7 /* Index of column "file" in the above */
|
#define ZIPFILE_F_COLUMN_IDX 7 /* Index of column "file" in the above */
|
||||||
#define ZIPFILE_BUFFER_SIZE (64*1024)
|
#define ZIPFILE_BUFFER_SIZE (64*1024)
|
||||||
@ -223,7 +223,6 @@ struct ZipfileLFH {
|
|||||||
typedef struct ZipfileEntry ZipfileEntry;
|
typedef struct ZipfileEntry ZipfileEntry;
|
||||||
struct ZipfileEntry {
|
struct ZipfileEntry {
|
||||||
char *zPath; /* Path of zipfile entry */
|
char *zPath; /* Path of zipfile entry */
|
||||||
i64 iRowid; /* Rowid for this value if queried */
|
|
||||||
u8 *aCdsEntry; /* Buffer containing entire CDS entry */
|
u8 *aCdsEntry; /* Buffer containing entire CDS entry */
|
||||||
int nCdsEntry; /* Size of buffer aCdsEntry[] in bytes */
|
int nCdsEntry; /* Size of buffer aCdsEntry[] in bytes */
|
||||||
int bDeleted; /* True if entry has been deleted */
|
int bDeleted; /* True if entry has been deleted */
|
||||||
@ -830,12 +829,7 @@ static int zipfileColumn(
|
|||||||
** Return the rowid for the current row.
|
** Return the rowid for the current row.
|
||||||
*/
|
*/
|
||||||
static int zipfileRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
|
static int zipfileRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
|
||||||
ZipfileCsr *pCsr = (ZipfileCsr*)cur;
|
assert( 0 );
|
||||||
if( pCsr->pCurrent ){
|
|
||||||
*pRowid = pCsr->pCurrent->iRowid;
|
|
||||||
}else{
|
|
||||||
*pRowid = pCsr->cds.iOffset;
|
|
||||||
}
|
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -999,11 +993,9 @@ static void zipfileAddEntry(ZipfileTab *pTab, ZipfileEntry *pNew){
|
|||||||
assert( (pTab->pFirstEntry==0)==(pTab->pLastEntry==0) );
|
assert( (pTab->pFirstEntry==0)==(pTab->pLastEntry==0) );
|
||||||
assert( pNew->pNext==0 );
|
assert( pNew->pNext==0 );
|
||||||
if( pTab->pFirstEntry==0 ){
|
if( pTab->pFirstEntry==0 ){
|
||||||
pNew->iRowid = 1;
|
|
||||||
pTab->pFirstEntry = pTab->pLastEntry = pNew;
|
pTab->pFirstEntry = pTab->pLastEntry = pNew;
|
||||||
}else{
|
}else{
|
||||||
assert( pTab->pLastEntry->pNext==0 );
|
assert( pTab->pLastEntry->pNext==0 );
|
||||||
pNew->iRowid = pTab->pLastEntry->iRowid+1;
|
|
||||||
pTab->pLastEntry->pNext = pNew;
|
pTab->pLastEntry->pNext = pNew;
|
||||||
pTab->pLastEntry = pNew;
|
pTab->pLastEntry = pNew;
|
||||||
}
|
}
|
||||||
@ -1251,10 +1243,11 @@ static int zipfileUpdate(
|
|||||||
if( nVal>1 ){
|
if( nVal>1 ){
|
||||||
return SQLITE_CONSTRAINT;
|
return SQLITE_CONSTRAINT;
|
||||||
}else{
|
}else{
|
||||||
i64 iDelete = sqlite3_value_int64(apVal[0]);
|
const char *zDelete = (const char*)sqlite3_value_text(apVal[0]);
|
||||||
|
int nDelete = strlen(zDelete);
|
||||||
ZipfileEntry *p;
|
ZipfileEntry *p;
|
||||||
for(p=pTab->pFirstEntry; p; p=p->pNext){
|
for(p=pTab->pFirstEntry; p; p=p->pNext){
|
||||||
if( p->iRowid==iDelete ){
|
if( zipfileComparePath(p->zPath, zDelete, nDelete)==0 ){
|
||||||
p->bDeleted = 1;
|
p->bDeleted = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
|||||||
C Add\stest\scases\sfor\srunning\smultiple\sRBU\soperations\swithin\sthe\ssame\sprocess\nconcurrently.
|
C Change\szipfile\sto\sbe\sa\sWITHOUT\sROWID\svirtual\stable\sand\stable-valued\sfunction.
|
||||||
D 2018-01-11T16:16:03.148
|
D 2018-01-11T17:33:48.340
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F Makefile.in 38f84f301cbef443b2d269f67a74b8cc536469831f70df7c3e912acc04932cc2
|
F Makefile.in 38f84f301cbef443b2d269f67a74b8cc536469831f70df7c3e912acc04932cc2
|
||||||
@ -303,7 +303,7 @@ F ext/misc/vfsstat.c bf10ef0bc51e1ad6756629e1edb142f7a8db1178
|
|||||||
F ext/misc/vtablog.c 31d0d8f4406795679dcd3a67917c213d3a2a5fb3ea5de35f6e773491ed7e13c9
|
F ext/misc/vtablog.c 31d0d8f4406795679dcd3a67917c213d3a2a5fb3ea5de35f6e773491ed7e13c9
|
||||||
F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd
|
F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd
|
||||||
F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
|
F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
|
||||||
F ext/misc/zipfile.c cbf9dfaf94c25dfd835e79c1474fdc75517a45a37916dec66623b0937af10e51
|
F ext/misc/zipfile.c e42d3ae79511ee86545bed07e9e5e7321f8139b55cdf73f60849352070bf12ad
|
||||||
F ext/rbu/rbu.c ea7d1b7eb44c123a2a619332e19fe5313500705c4a58aaa1887905c0d83ffc2e
|
F ext/rbu/rbu.c ea7d1b7eb44c123a2a619332e19fe5313500705c4a58aaa1887905c0d83ffc2e
|
||||||
F ext/rbu/rbu1.test 43836fac8c7179a358eaf38a8a1ef3d6e6285842
|
F ext/rbu/rbu1.test 43836fac8c7179a358eaf38a8a1ef3d6e6285842
|
||||||
F ext/rbu/rbu10.test 1846519a438697f45e9dcb246908af81b551c29e1078d0304fae83f1fed7e9ee
|
F ext/rbu/rbu10.test 1846519a438697f45e9dcb246908af81b551c29e1078d0304fae83f1fed7e9ee
|
||||||
@ -1599,7 +1599,7 @@ F test/wordcount.c cb589cec469a1d90add05b1f8cee75c7210338d87a5afd65260ed5c0f4bbf
|
|||||||
F test/writecrash.test f1da7f7adfe8d7f09ea79b42e5ca6dcc41102f27f8e334ad71539501ddd910cc
|
F test/writecrash.test f1da7f7adfe8d7f09ea79b42e5ca6dcc41102f27f8e334ad71539501ddd910cc
|
||||||
F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa
|
F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa
|
||||||
F test/zerodamage.test e59a56443d6298ecf7435f618f0b27654f0c849e
|
F test/zerodamage.test e59a56443d6298ecf7435f618f0b27654f0c849e
|
||||||
F test/zipfile.test e7132ca60031ca5d1df684cf644952bb3f253de3671a5b502780c5de3126a453
|
F test/zipfile.test a5cd98e91aebf343e21a32b97fadd6aefe02d249d5c6a1a3c2e624b88d7bdbe2
|
||||||
F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5
|
F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5
|
||||||
F tool/GetTclKit.bat 8995df40c4209808b31f24de0b58f90930239a234f7591e3675d45bfbb990c5d
|
F tool/GetTclKit.bat 8995df40c4209808b31f24de0b58f90930239a234f7591e3675d45bfbb990c5d
|
||||||
F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91
|
F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91
|
||||||
@ -1698,7 +1698,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 4f68bed3b9a63a349a2a2d7f26609491577e9717034ad86af404cf9eed9d6aaf
|
P 407b5ed35c178bb0dbc69c8b902652038a0653d55a58a7543f9d4857c6baf3ea
|
||||||
R b4712b12dc6463238ee69f57e3b3a2cb
|
R 6ae1fe2ba1a1ad2ab58089676c32c82f
|
||||||
U dan
|
U dan
|
||||||
Z e742283e882b3ab287b40d1d09763224
|
Z df7413e90ffcbb11e6d9a408fc886735
|
||||||
|
@ -1 +1 @@
|
|||||||
407b5ed35c178bb0dbc69c8b902652038a0653d55a58a7543f9d4857c6baf3ea
|
931201f64e04247ed613a0301fcc86c3a337c2ed162c6370a80c67a1dd919e7c
|
@ -27,7 +27,7 @@ do_execsql_test 1.0 {
|
|||||||
CREATE VIRTUAL TABLE temp.zz USING zipfile('test.zip');
|
CREATE VIRTUAL TABLE temp.zz USING zipfile('test.zip');
|
||||||
PRAGMA table_info(zz);
|
PRAGMA table_info(zz);
|
||||||
} {
|
} {
|
||||||
0 name {} 0 {} 0
|
0 name {} 1 {} 1
|
||||||
1 mode {} 0 {} 0
|
1 mode {} 0 {} 0
|
||||||
2 mtime {} 0 {} 0
|
2 mtime {} 0 {} 0
|
||||||
3 sz {} 0 {} 0
|
3 sz {} 0 {} 0
|
||||||
@ -160,6 +160,10 @@ foreach {tn fname} {
|
|||||||
} {1 {constraint failed}}
|
} {1 {constraint failed}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_catchsql_test 3.2 {
|
||||||
|
SELECT rowid FROM x1
|
||||||
|
} {1 {no such column: rowid}}
|
||||||
|
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user