本文整理汇总了Golang中C.sqlite3_finalize函数的典型用法代码示例。如果您正苦于以下问题:Golang sqlite3_finalize函数的具体用法?Golang sqlite3_finalize怎么用?Golang sqlite3_finalize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqlite3_finalize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Close
func (stmt Stmt) Close() error {
r := C.sqlite3_finalize(stmt.stmt)
if r != C.SQLITE_OK {
return driver.ErrBadConn
}
return nil
}
示例2: Finalize
func (s *Stmt) Finalize() error {
rv := C.sqlite3_finalize(s.stmt)
if rv != 0 {
return s.c.error(rv)
}
return nil
}
示例3: Close
// Close closes a database connection and any dangling statements.
// (See http://sqlite.org/c3ref/close.html)
func (c *Conn) Close() error {
if c == nil {
return errors.New("nil sqlite database")
}
if c.db == nil {
return nil
}
c.stmtCache.flush()
// Dangling statements
stmt := C.sqlite3_next_stmt(c.db, nil)
for stmt != nil {
if C.sqlite3_stmt_busy(stmt) != 0 {
Log(C.SQLITE_MISUSE, "Dangling statement (not reset): \""+C.GoString(C.sqlite3_sql(stmt))+"\"")
} else {
Log(C.SQLITE_MISUSE, "Dangling statement (not finalize): \""+C.GoString(C.sqlite3_sql(stmt))+"\"")
}
C.sqlite3_finalize(stmt)
stmt = C.sqlite3_next_stmt(c.db, nil)
}
rv := C.sqlite3_close(c.db)
if rv != C.SQLITE_OK {
Log(int(rv), "error while closing Conn")
return c.error(rv, "Conn.Close")
}
c.db = nil
return nil
}
示例4: Close
func (s *SQLiteStmt) Close() error {
rv := C.sqlite3_finalize(s.s)
if rv != C.SQLITE_OK {
return errors.New(C.GoString(C.sqlite3_errmsg(s.c.db)))
}
return nil
}
示例5: Finalize
func (s *Stmt) Finalize() error {
if s == nil {
return errors.New("Finalize called on nil Statement")
}
rv := C.sqlite3_finalize(s.stmt)
if rv != 0 {
return s.c.error(rv)
}
return nil
}
示例6: Close
// Close releases all resources associated with the prepared statement. This
// method can be called at any point in the statement's life cycle.
// [http://www.sqlite.org/c3ref/finalize.html]
func (s *Stmt) Close() error {
if stmt := s.stmt; stmt != nil {
*s = Stmt{Tail: s.Tail, conn: s.conn, text: s.text}
runtime.SetFinalizer(s, nil)
if rc := C.sqlite3_finalize(stmt); rc != OK {
return libErr(rc, s.conn.db)
}
}
return nil
}
示例7: finalize
func (s *Stmt) finalize() error {
if s == nil {
return errors.New("nil sqlite statement")
}
rv := C.sqlite3_finalize(s.stmt)
s.stmt = nil
if rv != C.SQLITE_OK {
Log(int(rv), "error while finalizing Stmt")
return s.error(rv, "Stmt.finalize")
}
return nil
}
示例8: Close
func (c *SQLiteConn) Close() error {
s := C.sqlite3_next_stmt(c.db, nil)
for s != nil {
C.sqlite3_finalize(s)
s = C.sqlite3_next_stmt(c.db, nil)
}
rv := C.sqlite3_close(c.db)
if rv != C.SQLITE_OK {
return errors.New("sqlite succeeded without returning a database")
}
c.db = nil
return nil
}
示例9: Close
// Close the connection.
func (c *SQLiteConn) Close() error {
s := C.sqlite3_next_stmt(c.db, nil)
for s != nil {
C.sqlite3_finalize(s)
s = C.sqlite3_next_stmt(c.db, nil)
}
rv := C.sqlite3_close(c.db)
if rv != C.SQLITE_OK {
return ErrNo(rv)
}
c.db = nil
return nil
}
示例10: Close
// Close the connection.
func (c *SQLiteConn) Close() error {
s := C.sqlite3_next_stmt(c.db, nil)
for s != nil {
C.sqlite3_finalize(s)
s = C.sqlite3_next_stmt(c.db, nil)
}
rv := C.sqlite3_close(c.db)
if rv != C.SQLITE_OK {
return errors.New("error while closing sqlite database connection")
}
c.db = nil
return nil
}
示例11: Close
func (s *stmt) Close() error {
if s.rows {
panic("database/sql/driver: misuse of sqlite driver: Close with active Rows")
}
if s.closed {
panic("database/sql/driver: misuse of sqlite driver: double Close of Stmt")
}
s.closed = true
rv := C.sqlite3_finalize(s.stmt)
if rv != 0 {
return s.c.error(rv)
}
return nil
}
示例12: Close
// Close the statement.
func (s *SQLiteStmt) Close() error {
if s.closed {
return nil
}
s.closed = true
if s.c == nil || s.c.db == nil {
return errors.New("sqlite statement with already closed database connection")
}
rv := C.sqlite3_finalize(s.s)
if rv != C.SQLITE_OK {
return s.c.lastError()
}
runtime.SetFinalizer(s, nil)
return nil
}
示例13: finalize
func (s *Stmt) finalize() error {
if s == nil {
return errors.New("nil sqlite statement")
}
if s.stmt == nil {
return nil
}
if s.c == nil || s.c.db == nil {
Log(C.SQLITE_MISUSE, "sqlite statement with already closed database connection")
return errors.New("sqlite statement with already closed database connection")
}
rv := C.sqlite3_finalize(s.stmt)
s.stmt = nil
if rv != C.SQLITE_OK {
Log(int32(rv), "error while finalizing Stmt")
return s.error(rv, "Stmt.finalize")
}
return nil
}
示例14: Finalize
// called to delete a prepared statement
func (h *Statement) Finalize() int {
return int(C.sqlite3_finalize(h.cptr))
}
示例15: Finalize
// Finalize is used to delete a prepared statement in the SQLite engine.
func (s *Statement) Finalize() (e error) {
return SQLiteError(C.sqlite3_finalize(s.cptr))
}