// Close closes a BLOB handle. // (See http://sqlite.org/c3ref/blob_close.html) func (r *BlobReader) Close() error { if r == nil { return errors.New("nil sqlite blob") } rv := C.sqlite3_blob_close(r.bl) if rv != C.SQLITE_OK { return r.c.error(rv, "BlobReader.Close") } r.bl = nil return nil }
// Close closes a BLOB handle. // (See http://sqlite.org/c3ref/blob_close.html) func (r *BlobReader) Close() error { if r == nil { return errors.New("nil sqlite blob") } if r.bl == nil { return nil } rv := C.sqlite3_blob_close(r.bl) // must be called only once r.bl = nil if rv != C.SQLITE_OK { return r.c.error(rv, "BlobReader.Close") } return nil }
func (c *Conn) blob_open(db, table, column string, row int64, write bool) (*C.sqlite3_blob, error) { zDb := C.CString(db) defer C.free(unsafe.Pointer(zDb)) zTable := C.CString(table) defer C.free(unsafe.Pointer(zTable)) zColumn := C.CString(column) defer C.free(unsafe.Pointer(zColumn)) var bl *C.sqlite3_blob rv := C.sqlite3_blob_open(c.db, zDb, zTable, zColumn, C.sqlite3_int64(row), btocint(write), &bl) if rv != C.SQLITE_OK { if bl != nil { C.sqlite3_blob_close(bl) } return nil, c.error(rv, fmt.Sprintf("Conn.blob_open(db: %q, tbl: %q, col: %q, row: %d)", db, table, column, row)) } if bl == nil { return nil, errors.New("sqlite succeeded without returning a blob") } return bl, nil }