mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Merge recent trunk changes, include the R-Tree enhancement that allows
8-byte BLOB arguments to geometry functions, and the fix for the TEXT affinity problem that could cause corrupt indexes. FossilOrigin-Name: 0a0de8b72ca24f287f9c84766a14e12ea4564b59
This commit is contained in:
55
src/vdbe.c
55
src/vdbe.c
@@ -306,6 +306,7 @@ static void applyAffinity(
|
||||
if( 0==(pRec->flags&MEM_Str) && (pRec->flags&(MEM_Real|MEM_Int)) ){
|
||||
sqlite3VdbeMemStringify(pRec, enc, 1);
|
||||
}
|
||||
pRec->flags &= ~(MEM_Real|MEM_Int);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -977,12 +978,11 @@ case OP_Halt: {
|
||||
assert( zType!=0 || pOp->p4.z!=0 );
|
||||
zLogFmt = "abort at %d in [%s]: %s";
|
||||
if( zType && pOp->p4.z ){
|
||||
sqlite3SetString(&p->zErrMsg, db, "%s constraint failed: %s",
|
||||
zType, pOp->p4.z);
|
||||
sqlite3VdbeError(p, "%s constraint failed: %s", zType, pOp->p4.z);
|
||||
}else if( pOp->p4.z ){
|
||||
sqlite3SetString(&p->zErrMsg, db, "%s", pOp->p4.z);
|
||||
sqlite3VdbeError(p, "%s", pOp->p4.z);
|
||||
}else{
|
||||
sqlite3SetString(&p->zErrMsg, db, "%s constraint failed", zType);
|
||||
sqlite3VdbeError(p, "%s constraint failed", zType);
|
||||
}
|
||||
sqlite3_log(pOp->p1, zLogFmt, pcx, p->zSql, p->zErrMsg);
|
||||
}
|
||||
@@ -1614,7 +1614,7 @@ case OP_Function: {
|
||||
/* If the function returned an error, throw an exception */
|
||||
if( ctx.fErrorOrAux ){
|
||||
if( ctx.isError ){
|
||||
sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(ctx.pOut));
|
||||
sqlite3VdbeError(p, "%s", sqlite3_value_text(ctx.pOut));
|
||||
rc = ctx.isError;
|
||||
}
|
||||
sqlite3VdbeDeleteAuxData(p, (int)(pOp - aOp), pOp->p1);
|
||||
@@ -2801,8 +2801,7 @@ case OP_Savepoint: {
|
||||
/* A new savepoint cannot be created if there are active write
|
||||
** statements (i.e. open read/write incremental blob handles).
|
||||
*/
|
||||
sqlite3SetString(&p->zErrMsg, db, "cannot open savepoint - "
|
||||
"SQL statements in progress");
|
||||
sqlite3VdbeError(p, "cannot open savepoint - SQL statements in progress");
|
||||
rc = SQLITE_BUSY;
|
||||
}else{
|
||||
nName = sqlite3Strlen30(zName);
|
||||
@@ -2853,15 +2852,14 @@ case OP_Savepoint: {
|
||||
iSavepoint++;
|
||||
}
|
||||
if( !pSavepoint ){
|
||||
sqlite3SetString(&p->zErrMsg, db, "no such savepoint: %s", zName);
|
||||
sqlite3VdbeError(p, "no such savepoint: %s", zName);
|
||||
rc = SQLITE_ERROR;
|
||||
}else if( db->nVdbeWrite>0 && p1==SAVEPOINT_RELEASE ){
|
||||
/* It is not possible to release (commit) a savepoint if there are
|
||||
** active write statements.
|
||||
*/
|
||||
sqlite3SetString(&p->zErrMsg, db,
|
||||
"cannot release savepoint - SQL statements in progress"
|
||||
);
|
||||
sqlite3VdbeError(p, "cannot release savepoint - "
|
||||
"SQL statements in progress");
|
||||
rc = SQLITE_BUSY;
|
||||
}else{
|
||||
|
||||
@@ -2967,23 +2965,12 @@ case OP_AutoCommit: {
|
||||
assert( db->nVdbeActive>0 ); /* At least this one VM is active */
|
||||
assert( p->bIsReader );
|
||||
|
||||
#if 0
|
||||
if( turnOnAC && iRollback && db->nVdbeActive>1 ){
|
||||
/* If this instruction implements a ROLLBACK and other VMs are
|
||||
** still running, and a transaction is active, return an error indicating
|
||||
** that the other VMs must complete first.
|
||||
*/
|
||||
sqlite3SetString(&p->zErrMsg, db, "cannot rollback transaction - "
|
||||
"SQL statements in progress");
|
||||
rc = SQLITE_BUSY;
|
||||
}else
|
||||
#endif
|
||||
if( turnOnAC && !iRollback && db->nVdbeWrite>0 ){
|
||||
/* If this instruction implements a COMMIT and other VMs are writing
|
||||
** return an error indicating that the other VMs must complete first.
|
||||
*/
|
||||
sqlite3SetString(&p->zErrMsg, db, "cannot commit transaction - "
|
||||
"SQL statements in progress");
|
||||
sqlite3VdbeError(p, "cannot commit transaction - "
|
||||
"SQL statements in progress");
|
||||
rc = SQLITE_BUSY;
|
||||
}else if( desiredAutoCommit!=db->autoCommit ){
|
||||
if( iRollback ){
|
||||
@@ -3010,7 +2997,7 @@ case OP_AutoCommit: {
|
||||
}
|
||||
goto vdbe_return;
|
||||
}else{
|
||||
sqlite3SetString(&p->zErrMsg, db,
|
||||
sqlite3VdbeError(p,
|
||||
(!desiredAutoCommit)?"cannot start a transaction within a transaction":(
|
||||
(iRollback)?"cannot rollback - no transaction is active":
|
||||
"cannot commit - no transaction is active"));
|
||||
@@ -5493,7 +5480,7 @@ case OP_Program: { /* jump */
|
||||
|
||||
if( p->nFrame>=db->aLimit[SQLITE_LIMIT_TRIGGER_DEPTH] ){
|
||||
rc = SQLITE_ERROR;
|
||||
sqlite3SetString(&p->zErrMsg, db, "too many levels of trigger recursion");
|
||||
sqlite3VdbeError(p, "too many levels of trigger recursion");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -5796,7 +5783,7 @@ case OP_AggStep: {
|
||||
ctx.skipFlag = 0;
|
||||
(ctx.pFunc->xStep)(&ctx, n, apVal); /* IMP: R-24505-23230 */
|
||||
if( ctx.isError ){
|
||||
sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(&t));
|
||||
sqlite3VdbeError(p, "%s", sqlite3_value_text(&t));
|
||||
rc = ctx.isError;
|
||||
}
|
||||
if( ctx.skipFlag ){
|
||||
@@ -5828,7 +5815,7 @@ case OP_AggFinal: {
|
||||
assert( (pMem->flags & ~(MEM_Null|MEM_Agg))==0 );
|
||||
rc = sqlite3VdbeMemFinalize(pMem, pOp->p4.pFunc);
|
||||
if( rc ){
|
||||
sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(pMem));
|
||||
sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem));
|
||||
}
|
||||
sqlite3VdbeChangeEncoding(pMem, encoding);
|
||||
UPDATE_MAX_BLOBSIZE(pMem);
|
||||
@@ -5933,7 +5920,7 @@ case OP_JournalMode: { /* out2 */
|
||||
){
|
||||
if( !db->autoCommit || db->nVdbeRead>1 ){
|
||||
rc = SQLITE_ERROR;
|
||||
sqlite3SetString(&p->zErrMsg, db,
|
||||
sqlite3VdbeError(p,
|
||||
"cannot change %s wal mode from within a transaction",
|
||||
(eNew==PAGER_JOURNALMODE_WAL ? "into" : "out of")
|
||||
);
|
||||
@@ -6064,7 +6051,7 @@ case OP_TableLock: {
|
||||
rc = sqlite3BtreeLockTable(db->aDb[p1].pBt, pOp->p2, isWriteLock);
|
||||
if( (rc&0xFF)==SQLITE_LOCKED ){
|
||||
const char *z = pOp->p4.z;
|
||||
sqlite3SetString(&p->zErrMsg, db, "database table is locked: %s", z);
|
||||
sqlite3VdbeError(p, "database table is locked: %s", z);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -6612,7 +6599,7 @@ vdbe_return:
|
||||
** is encountered.
|
||||
*/
|
||||
too_big:
|
||||
sqlite3SetString(&p->zErrMsg, db, "string or blob too big");
|
||||
sqlite3VdbeError(p, "string or blob too big");
|
||||
rc = SQLITE_TOOBIG;
|
||||
goto vdbe_error_halt;
|
||||
|
||||
@@ -6620,7 +6607,7 @@ too_big:
|
||||
*/
|
||||
no_mem:
|
||||
db->mallocFailed = 1;
|
||||
sqlite3SetString(&p->zErrMsg, db, "out of memory");
|
||||
sqlite3VdbeError(p, "out of memory");
|
||||
rc = SQLITE_NOMEM;
|
||||
goto vdbe_error_halt;
|
||||
|
||||
@@ -6631,7 +6618,7 @@ abort_due_to_error:
|
||||
assert( p->zErrMsg==0 );
|
||||
if( db->mallocFailed ) rc = SQLITE_NOMEM;
|
||||
if( rc!=SQLITE_IOERR_NOMEM ){
|
||||
sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3ErrStr(rc));
|
||||
sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));
|
||||
}
|
||||
goto vdbe_error_halt;
|
||||
|
||||
@@ -6642,6 +6629,6 @@ abort_due_to_interrupt:
|
||||
assert( db->u1.isInterrupted );
|
||||
rc = SQLITE_INTERRUPT;
|
||||
p->rc = rc;
|
||||
sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3ErrStr(rc));
|
||||
sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));
|
||||
goto vdbe_error_halt;
|
||||
}
|
||||
|
Reference in New Issue
Block a user