Ejemplo n.º 1
0
// 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
}
Ejemplo n.º 2
0
// 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
}