1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Allow read transactions to be freely opened and closed by SQL statements run from within the implementation of user-functions if the user-function is called by a SELECT statement that does not access any database tables (e.g. "SELECT user_function();").

FossilOrigin-Name: f308c4851726b4b75636f714466f2314f56e3ec0
This commit is contained in:
dan
2013-06-28 19:41:43 +00:00
parent 40aa936f7f
commit c0537fe59b
6 changed files with 26 additions and 20 deletions

View File

@@ -413,6 +413,8 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
}else if( opcode==OP_Transaction ){
if( pOp->p2!=0 ) p->readOnly = 0;
p->bIsReader = 1;
}else if( opcode==OP_AutoCommit || opcode==OP_Savepoint ){
p->bIsReader = 1;
}else if( opcode==OP_Vacuum
|| opcode==OP_JournalMode
#ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -447,6 +449,7 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
sqlite3DbFree(p->db, p->aLabel);
p->aLabel = 0;
*pMaxFuncArgs = nMaxArgs;
assert( p->bIsReader!=0 || p->btreeMask==0 );
}
/*
@@ -2133,8 +2136,9 @@ int sqlite3VdbeHalt(Vdbe *p){
}
checkActiveVdbeCnt(db);
/* No commit or rollback needed if the program never started */
if( p->pc>=0 ){
/* No commit or rollback needed if the program never started or if the
** SQL statement does not read or write a database file. */
if( p->pc>=0 && p->bIsReader ){
int mrc; /* Primary error code from p->rc */
int eStatementOp = 0;
int isSpecialError; /* Set to true if a 'special' error */