mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Flag pragmas like vdbe_trace now return their current setting if they
are called with no arguments. (CVS 1257) FossilOrigin-Name: 6a5fb5b89a98307060bb4a92a499b5d3dba74553
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C More\scode\scleanup\sand\ssize\sreduction.\s(CVS\s1256)
|
C Flag\spragmas\slike\svdbe_trace\snow\sreturn\stheir\scurrent\ssetting\sif\sthey\nare\scalled\swith\sno\sarguments.\s(CVS\s1257)
|
||||||
D 2004-02-21T13:31:10
|
D 2004-02-21T14:00:29
|
||||||
F Makefile.in cfd75c46b335881999333a9e4b982fa8491f200b
|
F Makefile.in cfd75c46b335881999333a9e4b982fa8491f200b
|
||||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||||
@@ -44,7 +44,7 @@ F src/os.h 250a3789be609adfee5c5aa20137ce8683276f24
|
|||||||
F src/pager.c 29ddad4dd454f0aaa98e2bcd327710ab9f02f833
|
F src/pager.c 29ddad4dd454f0aaa98e2bcd327710ab9f02f833
|
||||||
F src/pager.h 82332878799280145639a48d88cdb4058925e3f6
|
F src/pager.h 82332878799280145639a48d88cdb4058925e3f6
|
||||||
F src/parse.y 226bbdba2dee362d4b1cacc424bd82f7740071ee
|
F src/parse.y 226bbdba2dee362d4b1cacc424bd82f7740071ee
|
||||||
F src/pragma.c dab17a6093fc249c0faf93c7b65dccc056fec7fb
|
F src/pragma.c a8d43661193ba3114da787f43969d0a34f0ed07c
|
||||||
F src/printf.c ef1838bd06246d5d323600dc592d337b1c0762b0
|
F src/printf.c ef1838bd06246d5d323600dc592d337b1c0762b0
|
||||||
F src/random.c 775913e0b7fbd6295d21f12a7bd35b46387c44b2
|
F src/random.c 775913e0b7fbd6295d21f12a7bd35b46387c44b2
|
||||||
F src/select.c 9a41dace754f0dab5e991e402c05fa3c24d04f19
|
F src/select.c 9a41dace754f0dab5e991e402c05fa3c24d04f19
|
||||||
@@ -189,7 +189,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
|
|||||||
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
||||||
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
||||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||||
P ffa971934867b6bbe943c004154d5f161e0ea697
|
P 8e3eda2a909bd80b2b14ace36ab44303750a4409
|
||||||
R 3a6c0549c38d90190c4b2bf7000765c4
|
R a43c4de14dbe7097b5ca3dff718096d1
|
||||||
U drh
|
U drh
|
||||||
Z dede23b0f1723cf1feddae3af208c31d
|
Z 74241342cf04355015de5f00644a1b7e
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
8e3eda2a909bd80b2b14ace36ab44303750a4409
|
6a5fb5b89a98307060bb4a92a499b5d3dba74553
|
||||||
94
src/pragma.c
94
src/pragma.c
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** This file contains code used to implement the PRAGMA command.
|
** This file contains code used to implement the PRAGMA command.
|
||||||
**
|
**
|
||||||
** $Id: pragma.c,v 1.16 2004/02/21 13:31:10 drh Exp $
|
** $Id: pragma.c,v 1.17 2004/02/21 14:00:29 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
/*
|
/*
|
||||||
** Interpret the given string as a boolean value.
|
** Interpret the given string as a boolean value.
|
||||||
*/
|
*/
|
||||||
static int getBoolean(char *z){
|
static int getBoolean(const char *z){
|
||||||
static char *azTrue[] = { "yes", "on", "true" };
|
static char *azTrue[] = { "yes", "on", "true" };
|
||||||
int i;
|
int i;
|
||||||
if( z[0]==0 ) return 0;
|
if( z[0]==0 ) return 0;
|
||||||
@@ -83,6 +83,46 @@ static int getTempStore(char *z){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Check to see if zRight and zLeft refer to a pragma that queries
|
||||||
|
** or changes one of the flags in db->flags. Return 1 if so and 0 if not.
|
||||||
|
** Also, implement the pragma.
|
||||||
|
*/
|
||||||
|
static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
|
||||||
|
static const struct {
|
||||||
|
const char *zName; /* Name of the pragma */
|
||||||
|
int mask; /* Mask for the db->flags value */
|
||||||
|
} aPragma[] = {
|
||||||
|
{ "vdbe_trace", SQLITE_VdbeTrace },
|
||||||
|
{ "full_column_names", SQLITE_FullColNames },
|
||||||
|
{ "short_column_names", SQLITE_ShortColNames },
|
||||||
|
{ "show_datatypes", SQLITE_ReportTypes },
|
||||||
|
{ "count_changes", SQLITE_CountRows },
|
||||||
|
{ "empty_result_callbacks", SQLITE_NullCallback },
|
||||||
|
};
|
||||||
|
int i;
|
||||||
|
for(i=0; i<sizeof(aPragma)/sizeof(aPragma[0]); i++){
|
||||||
|
if( sqliteStrICmp(zLeft, aPragma[i].zName)==0 ){
|
||||||
|
sqlite *db = pParse->db;
|
||||||
|
Vdbe *v;
|
||||||
|
if( strcmp(zLeft,zRight)==0 && (v = sqliteGetVdbe(pParse))!=0 ){
|
||||||
|
sqliteVdbeAddOp(v, OP_ColumnName, 0, 1);
|
||||||
|
sqliteVdbeChangeP3(v, -1, aPragma[i].zName, P3_STATIC);
|
||||||
|
sqliteVdbeAddOp(v, OP_ColumnName, 1, 0);
|
||||||
|
sqliteVdbeChangeP3(v, -1, "boolean", P3_STATIC);
|
||||||
|
sqliteVdbeAddOp(v, OP_Integer, (db->flags & aPragma[i].mask)!=0, 0);
|
||||||
|
sqliteVdbeAddOp(v, OP_Callback, 1, 0);
|
||||||
|
}else if( getBoolean(zRight) ){
|
||||||
|
db->flags |= aPragma[i].mask;
|
||||||
|
}else{
|
||||||
|
db->flags &= ~aPragma[i].mask;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Process a pragma statement.
|
** Process a pragma statement.
|
||||||
**
|
**
|
||||||
@@ -287,6 +327,7 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
|
|||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
if( sqliteStrICmp(zLeft, "trigger_overhead_test")==0 ){
|
if( sqliteStrICmp(zLeft, "trigger_overhead_test")==0 ){
|
||||||
if( getBoolean(zRight) ){
|
if( getBoolean(zRight) ){
|
||||||
always_code_trigger_setup = 1;
|
always_code_trigger_setup = 1;
|
||||||
@@ -294,53 +335,10 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
|
|||||||
always_code_trigger_setup = 0;
|
always_code_trigger_setup = 0;
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
|
#endif
|
||||||
|
|
||||||
if( sqliteStrICmp(zLeft, "vdbe_trace")==0 ){
|
if( flagPragma(pParse, zLeft, zRight) ){
|
||||||
if( getBoolean(zRight) ){
|
/* The flagPragma() call also generates any necessary code */
|
||||||
db->flags |= SQLITE_VdbeTrace;
|
|
||||||
}else{
|
|
||||||
db->flags &= ~SQLITE_VdbeTrace;
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
|
|
||||||
if( sqliteStrICmp(zLeft, "full_column_names")==0 ){
|
|
||||||
if( getBoolean(zRight) ){
|
|
||||||
db->flags |= SQLITE_FullColNames;
|
|
||||||
}else{
|
|
||||||
db->flags &= ~SQLITE_FullColNames;
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
|
|
||||||
if( sqliteStrICmp(zLeft, "short_column_names")==0 ){
|
|
||||||
if( getBoolean(zRight) ){
|
|
||||||
db->flags |= SQLITE_ShortColNames;
|
|
||||||
}else{
|
|
||||||
db->flags &= ~SQLITE_ShortColNames;
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
|
|
||||||
if( sqliteStrICmp(zLeft, "show_datatypes")==0 ){
|
|
||||||
if( getBoolean(zRight) ){
|
|
||||||
db->flags |= SQLITE_ReportTypes;
|
|
||||||
}else{
|
|
||||||
db->flags &= ~SQLITE_ReportTypes;
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
|
|
||||||
if( sqliteStrICmp(zLeft, "count_changes")==0 ){
|
|
||||||
if( getBoolean(zRight) ){
|
|
||||||
db->flags |= SQLITE_CountRows;
|
|
||||||
}else{
|
|
||||||
db->flags &= ~SQLITE_CountRows;
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
|
|
||||||
if( sqliteStrICmp(zLeft, "empty_result_callbacks")==0 ){
|
|
||||||
if( getBoolean(zRight) ){
|
|
||||||
db->flags |= SQLITE_NullCallback;
|
|
||||||
}else{
|
|
||||||
db->flags &= ~SQLITE_NullCallback;
|
|
||||||
}
|
|
||||||
}else
|
}else
|
||||||
|
|
||||||
if( sqliteStrICmp(zLeft, "table_info")==0 ){
|
if( sqliteStrICmp(zLeft, "table_info")==0 ){
|
||||||
|
|||||||
Reference in New Issue
Block a user