Golang C.sqlite3_close_v2类(方法)实例源码

下面列出了Golang C.sqlite3_close_v2 类(方法)源码代码实例,从而了解它的用法。

作者:nts    项目:go-sqlite   
// Close the connection.
func (c *SQLiteConn) Close() error {
	rv := C.sqlite3_close_v2(c.db)
	if rv != C.SQLITE_OK {
		return c.lastError()
	}
	c.db = nil
	return nil
}

作者:Wishing-Wal    项目:wishingwal   
// Close the connection.
func (c *SQLiteConn) Close() error {
	rv := C.sqlite3_close_v2(c.db)
	if rv != C.SQLITE_OK {
		return c.lastError()
	}
	c.db = nil
	runtime.SetFinalizer(c, nil)
	return nil
}

作者:gidde    项目:cloudlu   
// Close releases all resources associated with the connection. If any prepared
// statements, incremental I/O operations, or backup operations are still
// active, the connection becomes an unusable "zombie" and is closed after all
// remaining statements and operations are destroyed. A BUSY error code is
// returned if the connection is left in this "zombie" status, which may
// indicate a programming error where some previously allocated resource is not
// properly released.
// [http://www.sqlite.org/c3ref/close.html]
func (c *Conn) Close() error {
	if db := c.db; db != nil {
		c.db = nil
		runtime.SetFinalizer(c, nil)
		if rc := C.sqlite3_close(db); rc != OK {
			err := libErr(rc, db)
			if rc == BUSY {
				C.sqlite3_close_v2(db)
			}
			return err
		}
		*c = Conn{} // Clear callback handlers only if db was closed
	}
	return nil
}


问题


面经


文章

微信
公众号

扫码关注公众号