mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Add the "page_count" pragma. Returns a single integer - the number of pages in the specified database file. (CVS 5135)
FossilOrigin-Name: eb6985e69ce2a5e5e7361f6226d1cfc547fd441d
This commit is contained in:
20
src/pragma.c
20
src/pragma.c
@@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** This file contains code used to implement the PRAGMA command.
|
||||
**
|
||||
** $Id: pragma.c,v 1.176 2008/04/17 20:59:38 drh Exp $
|
||||
** $Id: pragma.c,v 1.177 2008/05/15 17:48:20 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -378,6 +378,24 @@ void sqlite3Pragma(
|
||||
returnSingleInt(pParse, "max_page_count", newMax);
|
||||
}else
|
||||
|
||||
/*
|
||||
** PRAGMA [database.]page_count
|
||||
**
|
||||
** Return the number of pages in the specified database.
|
||||
*/
|
||||
if( sqlite3StrICmp(zLeft,"page_count")==0 ){
|
||||
Vdbe *v;
|
||||
int iReg;
|
||||
v = sqlite3GetVdbe(pParse);
|
||||
if( !v || sqlite3ReadSchema(pParse) ) goto pragma_out;
|
||||
sqlite3CodeVerifySchema(pParse, iDb);
|
||||
iReg = ++pParse->nMem;
|
||||
sqlite3VdbeAddOp2(v, OP_Pagecount, iDb, iReg);
|
||||
sqlite3VdbeAddOp2(v, OP_ResultRow, iReg, 1);
|
||||
sqlite3VdbeSetNumCols(v, 1);
|
||||
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "page_count", P4_STATIC);
|
||||
}else
|
||||
|
||||
/*
|
||||
** PRAGMA [database.]locking_mode
|
||||
** PRAGMA [database.]locking_mode = (normal|exclusive)
|
||||
|
||||
Reference in New Issue
Block a user