mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Add tests. Deal issues surrounding aborting recovery from within the SQL callback, and avoiding the pending-byte page.
FossilOrigin-Name: 4e97dd31f5240d9231167ae172a5116426c42177a1ed3c5422b9d51b762d5a87
This commit is contained in:
@ -42,8 +42,16 @@ static int xSqlCallback(void *pSqlArg, const char *zSql){
|
||||
if( res ){
|
||||
Tcl_BackgroundError(p->interp);
|
||||
return TCL_ERROR;
|
||||
}else{
|
||||
Tcl_Obj *pObj = Tcl_GetObjResult(p->interp);
|
||||
if( Tcl_GetCharLength(pObj)==0 ){
|
||||
res = 0;
|
||||
}else if( Tcl_GetIntFromObj(p->interp, pObj, &res) ){
|
||||
Tcl_BackgroundError(p->interp);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
return SQLITE_OK;
|
||||
return res;
|
||||
}
|
||||
|
||||
static int getDbPointer(Tcl_Interp *interp, Tcl_Obj *pObj, sqlite3 **pDb){
|
||||
@ -60,7 +68,7 @@ static int getDbPointer(Tcl_Interp *interp, Tcl_Obj *pObj, sqlite3 **pDb){
|
||||
** Implementation of the command created by [sqlite3_recover_init]:
|
||||
**
|
||||
** $cmd config OP ARG
|
||||
** $cmd step
|
||||
** $cmd run
|
||||
** $cmd errmsg
|
||||
** $cmd errcode
|
||||
** $cmd finalize
|
||||
@ -77,7 +85,7 @@ static int testRecoverCmd(
|
||||
const char *zMsg;
|
||||
} aSub[] = {
|
||||
{ "config", 2, "REBASE-BLOB" }, /* 0 */
|
||||
{ "step", 0, "" }, /* 1 */
|
||||
{ "run", 0, "" }, /* 1 */
|
||||
{ "errmsg", 0, "" }, /* 2 */
|
||||
{ "errcode", 0, "" }, /* 3 */
|
||||
{ "finish", 0, "" }, /* 4 */
|
||||
@ -145,7 +153,7 @@ static int testRecoverCmd(
|
||||
Tcl_SetObjResult(interp, Tcl_NewIntObj(res));
|
||||
break;
|
||||
}
|
||||
case 1: assert( sqlite3_stricmp("step", aSub[iSub].zSub)==0 ); {
|
||||
case 1: assert( sqlite3_stricmp("run", aSub[iSub].zSub)==0 ); {
|
||||
int res = sqlite3_recover_run(pTest->p);
|
||||
Tcl_SetObjResult(interp, Tcl_NewIntObj(res));
|
||||
break;
|
||||
|
Reference in New Issue
Block a user