mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Add the "(database.)freelist_count" PRAGMA. For querying the size of the
database free-list. (CVS 4112) FossilOrigin-Name: 1fb4251a707d0b79d250d6ea2022913b371d5f14
This commit is contained in:
26
src/pragma.c
26
src/pragma.c
@@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** This file contains code used to implement the PRAGMA command.
|
||||
**
|
||||
** $Id: pragma.c,v 1.139 2007/05/23 13:50:24 danielk1977 Exp $
|
||||
** $Id: pragma.c,v 1.140 2007/06/24 08:00:43 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@@ -1006,17 +1006,27 @@ void sqlite3Pragma(
|
||||
** The user-version is not used internally by SQLite. It may be used by
|
||||
** applications for any purpose.
|
||||
*/
|
||||
if( sqlite3StrICmp(zLeft, "schema_version")==0 ||
|
||||
sqlite3StrICmp(zLeft, "user_version")==0 ){
|
||||
if( sqlite3StrICmp(zLeft, "schema_version")==0
|
||||
|| sqlite3StrICmp(zLeft, "user_version")==0
|
||||
|| sqlite3StrICmp(zLeft, "freelist_count")==0
|
||||
){
|
||||
|
||||
int iCookie; /* Cookie index. 0 for schema-cookie, 6 for user-cookie. */
|
||||
if( zLeft[0]=='s' || zLeft[0]=='S' ){
|
||||
iCookie = 0;
|
||||
}else{
|
||||
iCookie = 5;
|
||||
switch( zLeft[0] ){
|
||||
case 's': case 'S':
|
||||
iCookie = 0;
|
||||
break;
|
||||
case 'f': case 'F':
|
||||
iCookie = 1;
|
||||
iDb = (-1*(iDb+1));
|
||||
assert(iDb<=0);
|
||||
break;
|
||||
default:
|
||||
iCookie = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
if( zRight ){
|
||||
if( zRight && iDb>=0 ){
|
||||
/* Write the specified cookie value */
|
||||
static const VdbeOpList setCookie[] = {
|
||||
{ OP_Transaction, 0, 1, 0}, /* 0 */
|
||||
|
||||
Reference in New Issue
Block a user