Commit e3e38eeb authored by gwenn's avatar gwenn

Add binding to sqlite3_compileoption_used

parent d956d9c8
......@@ -18,6 +18,8 @@ int goSqlite3Config(int op, int mode);
*/
import "C"
import "unsafe"
// ThreadingMode enumerates SQLite threading mode
// See ConfigThreadingMode
type ThreadingMode int32
......@@ -117,3 +119,11 @@ func (c *Conn) queryOrSetEnableDbConfig(key, i C.int) (bool, error) {
func (c *Conn) EnableExtendedResultCodes(b bool) error {
return c.error(C.sqlite3_extended_result_codes(c.db, btocint(b)), "Conn.EnableExtendedResultCodes")
}
// CompileOptionUsed returns false or true indicating whether the specified option was defined at compile time.
// (See http://sqlite.org/c3ref/compileoption_get.html)
func CompileOptionUsed(optName string) bool {
cOptName := C.CString(optName)
defer C.free(unsafe.Pointer(cOptName))
return C.sqlite3_compileoption_used(cOptName) == 1
}
......@@ -63,3 +63,8 @@ func TestConnSettings(t *testing.T) {
err := db.SetRecursiveTriggers("main", true)
checkNoError(t, err, "SetRecursiveTriggers error: %s")
}
func TestCompileOptionUsed(t *testing.T) {
b := CompileOptionUsed("SQLITE_ENABLE_COLUMN_METADATA")
assert.T(t, b, "COLUMN_METADATA disabled")
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment