From 71e406bc794a7c7f38f8b124ed335fcfcc3b9676 Mon Sep 17 00:00:00 2001 From: mattn Date: Tue, 27 May 2014 10:35:20 +0900 Subject: [PATCH] Don't return error when succeeded --- backup.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backup.go b/backup.go index 6de4499..2684cc0 100644 --- a/backup.go +++ b/backup.go @@ -26,7 +26,11 @@ func (c *SQLiteConn) Backup(dest string, conn *SQLiteConn, src string) (*Backup, } func (b *Backup) Step(p int) error { - return Error{Code: ErrNo(C.sqlite3_backup_step(b.b, C.int(p)))} + ret := C.sqlite3_backup_step(b.b, C.int(p)) + if ret != 0 { + return Error{Code: ErrNo(ret)} + } + return nil } func (b *Backup) Remaining() int { @@ -38,5 +42,9 @@ func (b *Backup) PageCount() int { } func (b *Backup) Finish() error { - return Error{Code: ErrNo(C.sqlite3_backup_finish(b.b))} + ret := C.sqlite3_backup_finish(b.b) + if ret != 0 { + return Error{Code: ErrNo(ret)} + } + return nil }