Exemple #1
0
// Close the database.
// See: http://unqlite.org/c_api/unqlite_close.html
func (u *Unqlite) Close() error {
	if rc := C.unqlite_close(u.db); rc != C.UNQLITE_OK {
		return ErrCode(rc)
	}

	return nil
}
Exemple #2
0
func (u *Unqlite) Close() error {
	var err error
	if u.db != nil {
		e := C.unqlite_close(u.db)
		err = code2Error(e)
		u.db = nil
	}
	return err
}
// Close ...
func (db *Database) Close() (err error) {
	if db.handle != nil {
		res := C.unqlite_close(db.handle)
		if res != C.UNQLITE_OK {
			err = UnQLiteError(res)
		}
		db.handle = nil
	}
	return
}
Exemple #4
0
// Close closes the database handle.
func (h *Handle) Close() error {
	if h == nil || h.db == nil {
		return errors.New("nil unqlite database")
	}
	rv := C.unqlite_close(h.db)
	if rv != C.UNQLITE_OK {
		return Errno(rv)
	}
	h.db = nil
	return nil
}