コード例 #1
0
ファイル: sqlite.go プロジェクト: npowern/gosqlite
// Readonly determines if a database is read-only.
// (See http://sqlite.org/c3ref/db_readonly.html)
func (c *Conn) Readonly(dbName string) (bool, error) {
	cname := C.CString(dbName)
	defer C.free(unsafe.Pointer(cname))
	rv := C.sqlite3_db_readonly(c.db, cname)
	if rv == -1 {
		return false, c.error(C.SQLITE_ERROR, fmt.Sprintf("%q is not the name of a database", dbName))
	}
	return rv == 1, nil
}
コード例 #2
0
ファイル: sqlite.go プロジェクト: brandondyck/gosqlite
// Readonly determines if a database is read-only.
// (See http://sqlite.org/c3ref/db_readonly.html)
func (c *Conn) Readonly(dbName string) (bool, error) {
	cname := C.CString(dbName)
	rv := C.sqlite3_db_readonly(c.db, cname)
	C.free(unsafe.Pointer(cname))
	if rv == -1 {
		return false, c.specificError("%q is not the name of a database", dbName)
	}
	return rv == 1, nil
}