Beispiel #1
0
func (b *Backup) Step(npage int) error {
	rv := C.sqlite3_backup_step(b.sb, C.int(npage))
	if rv == 0 || Errno(rv) == ErrBusy || Errno(rv) == ErrLocked {
		return nil
	}
	return Errno(rv)
}
Beispiel #2
0
func (b *Backup) Step(p int) error {
	ret := C.sqlite3_backup_step(b.b, C.int(p))
	if ret != 0 {
		return Error{Code: ErrNo(ret)}
	}
	return nil
}
Beispiel #3
0
// Backs up for one step. Calls the underlying `sqlite3_backup_step` function.
// This function returns a boolean indicating if the backup is done and
// an error signalling any other error. Done is returned if the underlying C
// function returns SQLITE_DONE (Code 101)
func (b *Backup) Step(p int) (bool, error) {
	ret := C.sqlite3_backup_step(b.b, C.int(p))
	if ret == 101 {
		return true, nil
	} else if ret != 0 {
		return false, Error{Code: ErrNo(ret)}
	}
	return false, nil
}
Beispiel #4
0
// Backs up for one step. Calls the underlying `sqlite3_backup_step` function.
// This function returns a boolean indicating if the backup is done and
// an error signalling any other error. Done is returned if the underlying C
// function returns SQLITE_DONE (Code 101)
func (b *SQLiteBackup) Step(p int) (bool, error) {
	ret := C.sqlite3_backup_step(b.b, C.int(p))
	if ret == C.SQLITE_DONE {
		return true, nil
	} else if ret != 0 && ret != C.SQLITE_LOCKED && ret != C.SQLITE_BUSY {
		return false, Error{Code: ErrNo(ret)}
	}
	return false, nil
}
Beispiel #5
0
// Step copies up to N pages between the source and destination databases.
// (See http://sqlite.org/c3ref/backup_finish.html#sqlite3backupstep)
func (b *Backup) Step(npage int) error {
	if b == nil {
		return errors.New("nil sqlite backup")
	}
	rv := C.sqlite3_backup_step(b.sb, C.int(npage))
	if rv == C.SQLITE_OK || Errno(rv) == ErrBusy || Errno(rv) == ErrLocked { // TODO Trace busy/locked errors
		return nil
	}
	return Errno(rv)
}
Beispiel #6
0
// Step copies up to N pages between the source and destination databases.
// (See http://sqlite.org/c3ref/backup_finish.html#sqlite3backupstep)
func (b *Backup) Step(npage int32) error {
	if b == nil {
		return errors.New("nil sqlite backup")
	}
	rv := C.sqlite3_backup_step(b.sb, C.int(npage))
	if rv == C.SQLITE_OK || Errno(rv) == ErrBusy || Errno(rv) == ErrLocked { // TODO Trace busy/locked errors
		return nil
	} else if rv == C.SQLITE_DONE {
		return Errno(rv)
	}
	return b.dst.error(rv, "backup step failed")
}
Beispiel #7
0
// Step copies up to n pages to the destination database. If n is negative, all
// remaining pages are copied. io.EOF is returned upon successful backup
// completion.
// [http://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep]
func (b *Backup) Step(n int) error {
	if b.bkup == nil {
		return ErrBadBackup
	}
	if rc := C.sqlite3_backup_step(b.bkup, C.int(n)); rc != OK {
		// Do not close automatically since that clears the progress info
		if rc == DONE {
			return io.EOF
		}
		return libErr(rc, b.dst.db)
	}
	return nil
}
Beispiel #8
0
func (b *Backup) Step(p int) error {
	return Error{Code: ErrNo(C.sqlite3_backup_step(b.b, C.int(p)))}
}
Beispiel #9
0
func (b *Backup) Step(pages int) error {
	if e := Errno(C.sqlite3_backup_step(b.cptr, C.int(pages))); e != OK {
		return e
	}
	return nil
}
Beispiel #10
0
// Step will copy up to `pages` between the source and destination database.
// If `pages` is negative, all remaining source pages are copied.
func (b *Backup) Step(pages int) error {
	return SQLiteError(C.sqlite3_backup_step(b.cptr, C.int(pages)))
}