mirror of
https://github.com/php/php-src.git
synced 2025-08-20 17:34:35 +02:00
Upgrade libsqlite 3 inside PDO sqlite to version 3.3.15
This commit is contained in:
parent
857f992cd3
commit
eb8d30f912
51 changed files with 5351 additions and 3624 deletions
|
@ -62,6 +62,17 @@ static int getBoolean(const char *z){
|
|||
return getSafetyLevel(z)&1;
|
||||
}
|
||||
|
||||
/*
|
||||
** Interpret the given string as a locking mode value.
|
||||
*/
|
||||
static int getLockingMode(const char *z){
|
||||
if( z ){
|
||||
if( 0==sqlite3StrICmp(z, "exclusive") ) return PAGER_LOCKINGMODE_EXCLUSIVE;
|
||||
if( 0==sqlite3StrICmp(z, "normal") ) return PAGER_LOCKINGMODE_NORMAL;
|
||||
}
|
||||
return PAGER_LOCKINGMODE_QUERY;
|
||||
}
|
||||
|
||||
#ifndef SQLITE_OMIT_PAGER_PRAGMAS
|
||||
/*
|
||||
** Interpret the given string as a temp db location. Return 1 for file
|
||||
|
@ -89,7 +100,7 @@ static int getTempStore(const char *z){
|
|||
static int invalidateTempStorage(Parse *pParse){
|
||||
sqlite3 *db = pParse->db;
|
||||
if( db->aDb[1].pBt!=0 ){
|
||||
if( db->flags & SQLITE_InTrans ){
|
||||
if( !db->autoCommit ){
|
||||
sqlite3ErrorMsg(pParse, "temporary storage cannot be changed "
|
||||
"from within a transaction");
|
||||
return SQLITE_ERROR;
|
||||
|
@ -157,7 +168,7 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
|
|||
{ "ignore_check_constraints", SQLITE_IgnoreChecks },
|
||||
#endif
|
||||
/* The following is VERY experimental */
|
||||
{ "writable_schema", SQLITE_WriteSchema },
|
||||
{ "writable_schema", SQLITE_WriteSchema|SQLITE_RecoveryMode },
|
||||
{ "omit_readlock", SQLITE_NoReadlock },
|
||||
|
||||
/* TODO: Maybe it shouldn't be possible to change the ReadUncommitted
|
||||
|
@ -315,6 +326,53 @@ void sqlite3Pragma(
|
|||
sqlite3BtreeSetPageSize(pBt, atoi(zRight), -1);
|
||||
}
|
||||
}else
|
||||
|
||||
/*
|
||||
** PRAGMA [database.]locking_mode
|
||||
** PRAGMA [database.]locking_mode = (normal|exclusive)
|
||||
*/
|
||||
if( sqlite3StrICmp(zLeft,"locking_mode")==0 ){
|
||||
const char *zRet = "normal";
|
||||
int eMode = getLockingMode(zRight);
|
||||
|
||||
if( pId2->n==0 && eMode==PAGER_LOCKINGMODE_QUERY ){
|
||||
/* Simple "PRAGMA locking_mode;" statement. This is a query for
|
||||
** the current default locking mode (which may be different to
|
||||
** the locking-mode of the main database).
|
||||
*/
|
||||
eMode = db->dfltLockMode;
|
||||
}else{
|
||||
Pager *pPager;
|
||||
if( pId2->n==0 ){
|
||||
/* This indicates that no database name was specified as part
|
||||
** of the PRAGMA command. In this case the locking-mode must be
|
||||
** set on all attached databases, as well as the main db file.
|
||||
**
|
||||
** Also, the sqlite3.dfltLockMode variable is set so that
|
||||
** any subsequently attached databases also use the specified
|
||||
** locking mode.
|
||||
*/
|
||||
int ii;
|
||||
assert(pDb==&db->aDb[0]);
|
||||
for(ii=2; ii<db->nDb; ii++){
|
||||
pPager = sqlite3BtreePager(db->aDb[ii].pBt);
|
||||
sqlite3PagerLockingMode(pPager, eMode);
|
||||
}
|
||||
db->dfltLockMode = eMode;
|
||||
}
|
||||
pPager = sqlite3BtreePager(pDb->pBt);
|
||||
eMode = sqlite3PagerLockingMode(pPager, eMode);
|
||||
}
|
||||
|
||||
assert(eMode==PAGER_LOCKINGMODE_NORMAL||eMode==PAGER_LOCKINGMODE_EXCLUSIVE);
|
||||
if( eMode==PAGER_LOCKINGMODE_EXCLUSIVE ){
|
||||
zRet = "exclusive";
|
||||
}
|
||||
sqlite3VdbeSetNumCols(v, 1);
|
||||
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "locking_mode", P3_STATIC);
|
||||
sqlite3VdbeOp3(v, OP_String8, 0, 0, zRet, 0);
|
||||
sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
|
||||
}else
|
||||
#endif /* SQLITE_OMIT_PAGER_PRAGMAS */
|
||||
|
||||
/*
|
||||
|
@ -916,7 +974,7 @@ void sqlite3Pragma(
|
|||
sqlite3VdbeSetNumCols(v, 1);
|
||||
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, P3_TRANSIENT);
|
||||
}
|
||||
}
|
||||
}else
|
||||
#endif /* SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */
|
||||
|
||||
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
|
||||
|
@ -941,7 +999,7 @@ void sqlite3Pragma(
|
|||
if( pBt==0 || (pPager = sqlite3BtreePager(pBt))==0 ){
|
||||
sqlite3VdbeOp3(v, OP_String8, 0, 0, "closed", P3_STATIC);
|
||||
}else{
|
||||
int j = sqlite3pager_lockstate(pPager);
|
||||
int j = sqlite3PagerLockstate(pPager);
|
||||
sqlite3VdbeOp3(v, OP_String8, 0, 0,
|
||||
(j>=0 && j<=4) ? azLockName[j] : "unknown", P3_STATIC);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue