Esempio n. 1
0
int uredo(BW *bw)
{
	UNDOREC *upto;
	UNDOREC *ptr;
	UNDO *undo = bw->b->undo;

	if (!undo)
		return -1;
	if (!undo->ptr)
		return -1;
	if (undo->ptr == &undo->recs)
		return -1;
	upto = undo->recs.link.prev->unit;
	do {
		ptr = undo->recs.link.prev;
		pgoto(bw->cursor, ptr->where);
		inredo = 1;
		doundo(bw, ptr);
		inredo = 0;
		frrec(deque_f(UNDOREC, link, ptr)); /* Delete record created by undo command */
		undo->ptr = undo->ptr->link.next;
	} while (upto && upto != ptr);
	/* We just deleted one undo record */
	--undo->nrecs;
	return 0;
}
Esempio n. 2
0
int uundo(BW *bw)
{
	UNDOREC *upto;
	UNDO *undo = bw->b->undo;

	if (!undo)
		return -1;
	if (!undo->nrecs)
		return -1;
	if (!undo->ptr) {
		pgoto(bw->cursor, undo->recs.link.prev->where);
		undo->ptr = &undo->recs;
		/* If this return is uncommented, then uundo will jump
		   to where the undo is about to occur before actually
		   undoing anything */
		/* return 0; */
	}
	if (undo->ptr->link.prev == &undo->recs)
		return -1;
	upto = undo->ptr->link.prev->unit;
	do {
		undo->ptr = undo->ptr->link.prev;
		pgoto(bw->cursor, undo->ptr->where);
		inundo = 1;
		doundo(bw, undo->ptr);
		inundo = 0;
	} while (upto && upto != undo->ptr);
	return 0;
}
Esempio n. 3
0
/* Undo any frames written (but not committed) to the log */
int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx)
{
	return doundo(pWal,xUndo, pUndoCtx,1);
}