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

Simplifications to vdbe.c to promote better test coverage. (CVS 6802)

FossilOrigin-Name: 3ffc93d762b64fd84f47c4b6d68ab56b69ea98a9
This commit is contained in:
drh
2009-06-23 14:15:04 +00:00
parent 1c84ac596d
commit 35f6b936ce
5 changed files with 24 additions and 26 deletions

View File

@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.861 2009/06/22 19:05:41 drh Exp $
** $Id: vdbe.c,v 1.862 2009/06/23 14:15:04 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
@@ -4248,7 +4248,7 @@ case OP_IdxRowid: { /* out2-prerelease */
assert( pC->deferredMoveto==0 );
assert( pC->isTable==0 );
if( !pC->nullRow ){
rc = sqlite3VdbeIdxRowid(pCrsr, &rowid);
rc = sqlite3VdbeIdxRowid(db, pCrsr, &rowid);
if( rc!=SQLITE_OK ){
goto abort_due_to_error;
}
@@ -5319,9 +5319,7 @@ case OP_VRename: {
pName = &p->aMem[pOp->p1];
assert( pVtab->pModule->xRename );
REGISTER_TRACE(pOp->p1, pName);
Stringify(pName, encoding);
assert( pName->flags & MEM_Str );
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
sqlite3VtabLock(pVtab);
rc = pVtab->pModule->xRename(pVtab, pName->z);
@@ -5372,10 +5370,7 @@ case OP_VUpdate: {
pModule = (sqlite3_module *)pVtab->pModule;
nArg = pOp->p2;
assert( pOp->p4type==P4_VTAB );
if( pModule->xUpdate==0 ){
sqlite3SetString(&p->zErrMsg, db, "read-only table");
rc = SQLITE_ERROR;
}else{
if( ALWAYS(pModule->xUpdate) ){
apArg = p->apArg;
pX = &p->aMem[pOp->p3];
for(i=0; i<nArg; i++){
@@ -5391,7 +5386,7 @@ case OP_VUpdate: {
pVtab->zErrMsg = 0;
sqlite3VtabUnlock(db, pVtab);
if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
if( pOp->p1 && rc==SQLITE_OK ){
if( rc==SQLITE_OK && pOp->p1 ){
assert( nArg>1 && apArg[0] && (apArg[0]->flags&MEM_Null) );
db->lastRowid = rowid;
}
@@ -5414,7 +5409,10 @@ case OP_Pagecount: { /* out2-prerelease */
p1 = pOp->p1;
pPager = sqlite3BtreePager(db->aDb[p1].pBt);
rc = sqlite3PagerPagecount(pPager, &nPage);
if( rc==SQLITE_OK ){
/* OP_Pagecount is always called from within a read transaction. The
** page count has already been successfully read and cached. So the
** sqlite3PagerPagecount() call above cannot fail. */
if( ALWAYS(rc==SQLITE_OK) ){
pOut->flags = MEM_Int;
pOut->u.i = nPage;
}

View File

@@ -15,7 +15,7 @@
** 6000 lines long) it was split up into several smaller files and
** this header information was factored out.
**
** $Id: vdbeInt.h,v 1.173 2009/06/22 00:55:31 drh Exp $
** $Id: vdbeInt.h,v 1.174 2009/06/23 14:15:04 drh Exp $
*/
#ifndef _VDBEINT_H_
#define _VDBEINT_H_
@@ -329,7 +329,7 @@ void sqlite3VdbeDeleteAuxData(VdbeFunc*, int);
int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*);
int sqlite3VdbeIdxRowid(BtCursor *, i64 *);
int sqlite3VdbeIdxRowid(sqlite3*, BtCursor *, i64 *);
int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);
int sqlite3VdbeExec(Vdbe*);
int sqlite3VdbeList(Vdbe*);

View File

@@ -14,7 +14,7 @@
** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out.
**
** $Id: vdbeaux.c,v 1.463 2009/06/22 19:05:41 drh Exp $
** $Id: vdbeaux.c,v 1.464 2009/06/23 14:15:04 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
@@ -2577,7 +2577,7 @@ int sqlite3VdbeRecordCompare(
** pCur might be pointing to text obtained from a corrupt database file.
** So the content cannot be trusted. Do appropriate checks on the content.
*/
int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){
int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){
i64 nCellKey = 0;
int rc;
u32 szHdr; /* Size of the header */
@@ -2594,7 +2594,7 @@ int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){
/* Read in the complete content of the index entry */
m.flags = 0;
m.db = 0;
m.db = db;
m.zMalloc = 0;
rc = sqlite3VdbeMemFromBtree(pCur, 0, (int)nCellKey, 1, &m);
if( rc ){