Add the sqlite3PagerWalFramesize() function to pager.c. This is used by zipvfs.

FossilOrigin-Name: 786e24dc56504d1958db0618e645610f2600a087
This commit is contained in:
dan 2012-02-23 15:35:49 +00:00
parent 49dc66df0f
commit b3bdc72ded
6 changed files with 42 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Expose\sthe\ssqlite3_stricmp()\sinterface.\s\sAdd\sthe\sSQLITE_FCNTL_PRAGMA\sfile\ncontrol.
D 2012-02-23T14:28:46.056
C Add\sthe\ssqlite3PagerWalFramesize()\sfunction\sto\spager.c.\sThis\sis\sused\sby\szipvfs.
D 2012-02-23T15:35:49.591
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 3f79a373e57c3b92dabf76f40b065e719d31ac34
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -168,8 +168,8 @@ F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
F src/os_unix.c 0e3d2942d228d0366fb80a3640f35caf413b66d1
F src/os_win.c 5ac061ae1326a71500cee578ed0fd9113b4f6a37
F src/pager.c 2d892f7b901a8867a33bc21742086165a3a99af8
F src/pager.h a435da8421dc7844b7f9c7f37b636c160c50208a
F src/pager.c af82f106e5b22e90cdbccbccdabe14bfa00ced5e
F src/pager.h 0ccc8260fadff8e0ce5193392faea6954178bf3d
F src/parse.y 1ddd71ae55f4b7cbb2672526ea4de023de0f519e
F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
F src/pcache.h 1b5dcc3dc8103d03e625b177023ee67764fa6b7c
@ -250,8 +250,8 @@ F src/vdbemem.c fb0ac964ccbcd94f595eb993c05bfd9c52468a4a
F src/vdbesort.c b25814d385895544ebc8118245c8311ded7f81c9
F src/vdbetrace.c d6e50e04e1ec498150e519058f617d91b8f5c843
F src/vtab.c ab90fb600a3f5e4b7c48d22a4cdb2d6b23239847
F src/wal.c 5f7bcc0610af759953defd769eacebfd98a22bc8
F src/wal.h eaa00b9a403ddda2b56d01b7afc19ef600f9363f
F src/wal.c 176b50fc9e30ef76d3d3c9ba99a40cea6f23eace
F src/wal.h 9a300673e86f04eeb7442348d3557eecc5a9509a
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
F src/where.c af623942514571895818b9b7ae11db95ae3b3d88
F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823
@ -990,7 +990,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
P f8ac826f95ae6b7b981e4765d2e65b6839d0eff9 c81fc40b2b584820ac7d1c3848ebeb7225d4eeeb
R c32d45c36d618b8574dcc1d6ea477e07
U drh
Z 6215aa1a94e7aa4510913be189893b44
P c539cf21ef8f4eb4782790aa97a67d10ae9ffd64
R 9cc56f07006d3b03439dff4deb3c69b5
U dan
Z 4dc0dc11213b3ebf076551ec72da6775

View File

@ -1 +1 @@
c539cf21ef8f4eb4782790aa97a67d10ae9ffd64
786e24dc56504d1958db0618e645610f2600a087

View File

@ -6871,6 +6871,18 @@ int sqlite3PagerCloseWal(Pager *pPager){
return rc;
}
/*
** A read-lock must be held on the pager when this function is called. If
** the pager is in WAL mode and the WAL file currently contains one or more
** frames, return the size in bytes of the page images stored within the
** WAL frames. Otherwise, if this is not a WAL database or the WAL file
** is empty, return 0.
*/
int sqlite3PagerWalFramesize(Pager *pPager){
assert( pPager->eState==PAGER_SHARED );
return sqlite3WalFramesize(pPager->pWal);
}
#ifdef SQLITE_HAS_CODEC
/*
** This function is called by the wal module when writing page content

View File

@ -144,6 +144,8 @@ int sqlite3PagerWalCallback(Pager *pPager);
int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);
int sqlite3PagerCloseWal(Pager *pPager);
int sqlite3PagerWalFramesize(Pager *pPager);
/* Functions used to query pager state and configuration. */
u8 sqlite3PagerIsreadonly(Pager*);
int sqlite3PagerRefcount(Pager*);

View File

@ -3068,4 +3068,15 @@ int sqlite3WalHeapMemory(Wal *pWal){
return (pWal && pWal->exclusiveMode==WAL_HEAPMEMORY_MODE );
}
/*
** If the argument is not NULL, it points to a Wal object that holds a
** read-lock. This function returns the database page-size if it is known,
** or zero if it is not (or if pWal is NULL).
*/
int sqlite3WalFramesize(Wal *pWal){
int nRet = 0;
assert( pWal==0 || pWal->readLock>=0 );
return (pWal ? pWal->szPage : 0);
}
#endif /* #ifndef SQLITE_OMIT_WAL */

View File

@ -43,6 +43,7 @@
# define sqlite3WalCallback(z) 0
# define sqlite3WalExclusiveMode(y,z) 0
# define sqlite3WalHeapMemory(z) 0
# define sqlite3WalFramesize(z) 0
#else
#define WAL_SAVEPOINT_NDATA 4
@ -124,5 +125,10 @@ int sqlite3WalExclusiveMode(Wal *pWal, int op);
*/
int sqlite3WalHeapMemory(Wal *pWal);
/* If the WAL file is not empty, return the number of bytes of content
** stored in each frame (i.e. the db page-size when the WAL was created).
*/
int sqlite3WalFramesize(Wal *pWal);
#endif /* ifndef SQLITE_OMIT_WAL */
#endif /* _WAL_H_ */