DBD-SQLite2
view release on metacpan or search on metacpan
183184185186187188189190191192193194195196197198199200201202203
pParse->rc = SQLITE_AUTH;
}
else
if
( rc!=SQLITE_OK && rc!=SQLITE_IGNORE ){
rc = SQLITE_DENY;
sqliteAuthBadReturnCode(pParse, rc);
}
return
rc;
}
/*
** Push an authorization context. After this routine is called, the
** zArg3 argument to authorization callbacks will be zContext
until
** popped. Or
if
pParse==0, this routine is a
no
-op.
*/
void sqliteAuthContextPush(
Parse
*pParse
,
AuthContext
*pContext
,
const char
*zContext
){
pContext->pParse = pParse;
if
( pParse ){
pContext->zAuthContext = pParse->zAuthContext;
636465666768697071727374757677787980818283imp_dbh->in_tran = FALSE;
imp_dbh->no_utf8_flag = FALSE;
imp_dbh->functions = newAV();
imp_dbh->aggregates = newAV();
imp_dbh->timeout = SQL_TIMEOUT;
imp_dbh->handle_binary_nulls = FALSE;
sqlite_busy_timeout(imp_dbh->db, SQL_TIMEOUT);
if
((retval = sqlite_exec(imp_dbh->db,
"PRAGMA empty_result_callbacks = ON"
,
NULL, NULL,
&errmsg
)
!= SQLITE_OK))
{
/*
warn
(
"failed to set pragma: %s\n"
, errmsg); */
sqlite2_error(dbh, (imp_xxh_t*)imp_dbh, retval, errmsg);
sqlite_freemem(errmsg);
return
FALSE;
}
if
((retval = sqlite_exec(imp_dbh->db,
"PRAGMA show_datatypes = ON"
,
114115116117118119120121122123124125126127128129130131132133134static
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 ){
sqliteVdbeOp3(v, OP_ColumnName, 0, 1, aPragma[i].zName, P3_STATIC);
sqliteVdbeOp3(v, OP_ColumnName, 1, 0,
"boolean"
, P3_STATIC);
sqliteVdbeCode(v, OP_Integer, (db->flags & aPragma[i].mask)!=0, 0,
597598599600601602603604605606607608609610611612613614615616617618619620621622623624625/*
** Register a function that is called at every invocation of sqlite_exec()
** or sqlite_compile(). This function can be used (
for
example) to generate
** a
log
file of all SQL executed against a database.
*/
void
*sqlite_trace
(sqlite*, void(
*xTrace
)(void*,const char*), void*);
/*** The Callback-Free API
**
** The following routines implement a new way to access SQLite that does not
**
** An sqlite_vm is an opaque object that represents a single SQL statement
** that is ready to be executed.
*/
typedef struct sqlite_vm sqlite_vm;
/*
** to compile the SQL using this routine. The 1st parameter
"db"
is a pointer
** to an sqlite object obtained from sqlite_open(). The 2nd parameter
**
"zSql"
is the text of the SQL to be compiled. The remaining parameters
** are all outputs.
**
**
*pzTail
is made to point to the first character past the end of the first
** SQL statement in zSql. This routine only compiles the first statement
** in zSql, so
*pzTail
is left pointing to what remains uncompiled.
**
**
*ppVm
is left pointing to a
"virtual machine"
that can be used to execute
sqliteInt.h view on Meta::CPAN
921922923924925926927928929930931932933934935936937938939940941
u8 nameClash; /* A permanent table name clashes
with
temp table name */
u8 useAgg; /* If true, extract field
values
from the aggregator
**
while
generating expressions. Normally false */
int
nErr; /* Number of errors seen */
int
nTab; /* Number of previously allocated VDBE cursors */
int
nMem; /* Number of memory cells used so far */
int
nSet; /* Number of sets used so far */
int
nAgg; /* Number of aggregate expressions */
int
nVar; /* Number of
'?'
variables seen in the SQL so far */
AggExpr
*aAgg
; /* An array of aggregate expressions */
const char
*zAuthContext
; /* The 6th parameter to db->xAuth callbacks */
Trigger
*pNewTrigger
; /* Trigger under construct by a CREATE TRIGGER */
TriggerStack
*trigStack
; /* Trigger actions being coded */
};
/*
** An instance of the following structure can be declared on a stack and used
** to save the Parse.zAuthContext value so that it can be restored later.
*/
struct AuthContext {
const char
*zAuthContext
; /* Put saved Parse.zAuthContext here */
217218219220221222223224225226227228229230231232233234235236237*/
int
sqliteRunVacuum(char *
*pzErrMsg
, sqlite
*db
){
#if !defined(SQLITE_OMIT_VACUUM) || SQLITE_OMIT_VACUUM
const char
*zFilename
; /* full pathname of the database file */
int
nFilename; /* number of characters in zFilename[] */
char
*zTemp
= 0; /* a temporary file in same directory as zFilename */
sqlite
*dbNew
= 0; /* The new vacuumed database */
int
rc = SQLITE_OK; /* Return code from service routines */
int
i; /* Loop counter */
char
*zErrMsg
; /* Error message */
vacuumStruct sVac; /* Information passed to callbacks */
/* These are all of the pragmas that need to be transferred over
** to the new database */
static const char
*zPragma
[] = {
"default_synchronous"
,
"default_cache_size"
,
/*
"default_temp_store"
, */
};
if
( db->flags & SQLITE_InTrans ){
448449450451452453454455456457458459460461462463464465466467468** flag on jump instructions, we get a (small) speed improvement.
*/
#define CHECK_FOR_INTERRUPT \
if
( db->flags & SQLITE_Interrupt )
goto
abort_due_to_interrupt;
/*
** Execute as much of a VDBE program as we can then
return
.
**
** sqliteVdbeMakeReady() must be called
before
this routine in order to
**
close
the program
with
a final OP_Halt and to set up the callbacks
** and the error message pointer.
**
** Whenever a row or result data is available, this routine will either
** invoke the result callback (
if
there is one) or
return
with
** SQLITE_ROW.
**
** If an attempt is made to
open
a locked database, then this routine
** will either invoke the busy callback (
if
there is one) or it will
**
return
SQLITE_BUSY.
**
233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272FILE
*trace
; /* Write an execution trace here,
if
not NULL */
int
nOp; /* Number of instructions in the program */
int
nOpAlloc; /* Number of slots allocated
for
aOp[] */
Op
*aOp
; /* Space to hold the virtual machine's program */
int
nLabel; /* Number of labels used */
int
nLabelAlloc; /* Number of slots allocated in aLabel[] */
int
*aLabel
; /* Space to hold the labels */
Mem
*aStack
; /* The operand stack, except string
values
*/
Mem
*pTos
; /* Top entry in the operand stack */
char *
*zArgv
; /* Text
values
used by the callback */
char *
*azColName
; /* Becomes the 4th parameter to callbacks */
int
nCursor; /* Number of slots in aCsr[] */
Cursor
*aCsr
; /* One element of this array
for
each
open
cursor */
Sorter
*pSort
; /* A linked list of objects to be sorted */
FILE
*pFile
; /* At most one
open
file handler */
int
nField; /* Number of file fields */
char *
*azField
; /* Data
for
each
file field */
int
nVar; /* Number of entries in azVariable[] */
char *
*azVar
; /* Values
for
the OP_Variable opcode */
int
*anVar
; /* Length of
each
value in azVariable[] */
u8
*abVar
; /* TRUE
if
azVariable[i] needs to be sqliteFree()ed */
char
*zLine
; /* A single line from the input file */
int
nLineAlloc; /* Number of spaces allocated
for
zLine */
int
magic; /* Magic number
for
sanity checking */
int
nMem; /* Number of memory locations currently allocated */
Mem
*aMem
; /* The memory locations */
Agg agg; /* Aggregate information */
int
nSet; /* Number of sets allocated */
Set
*aSet
; /* An array of sets */
int
nCallback; /* Number of callbacks invoked so far */
Keylist
*pList
; /* A list of ROWIDs */
int
keylistStackDepth; /* The size of the
"keylist"
stack */
Keylist *
*keylistStack
; /* The stack used by opcodes ListPush & ListPop */
int
contextStackDepth; /* The size of the
"context"
stack */
Context
*contextStack
; /* Stack used by opcodes ContextPush & ContextPop*/
int
pc; /* The program counter */
int
rc; /* Value to
return
*/
unsigned uniqueCnt; /* Used by OP_MakeRecord
when
P2!=0 */
int
errorAction; /* Recovery action to
do
in case of an error */
int
undoTransOnError; /* If error, either ROLLBACK or COMMIT */
( run in 0.289 second using v1.01-cache-2.11-cpan-ec4f86ec37b )