Commit 5a25a02d authored by gwenn's avatar gwenn

Add binding to...

Add binding to sqlite3_config(SQLITE_CONFIG_SINGLETHREAD|SQLITE_CONFIG_MULTITHREAD|SQLITE_CONFIG_SERIALIZED)
parent cb4fb030
......@@ -45,3 +45,7 @@ int goSqlite3ConfigLog(void *udp) {
return sqlite3_config(SQLITE_CONFIG_LOG, NULL, NULL);
}
}
int goSqlite3ConfigThreadMode(int mode) {
return sqlite3_config(mode);
}
\ No newline at end of file
......@@ -20,6 +20,7 @@ static void my_log(int iErrCode, char *msg) {
}
int goSqlite3ConfigLog(void *udp);
int goSqlite3ConfigThreadMode(int mode);
*/
import "C"
......@@ -301,3 +302,20 @@ func ConfigLog(f Logger, udp interface{}) error {
}
return Errno(rv)
}
type ThreadMode int
const (
SINGLETHREAD ThreadMode = C.SQLITE_CONFIG_SINGLETHREAD
MULTITHREAD ThreadMode = C.SQLITE_CONFIG_MULTITHREAD
SERIALIZED ThreadMode = C.SQLITE_CONFIG_SERIALIZED
)
// (See sqlite3_config(SQLITE_CONFIG_SINGLETHREAD|SQLITE_CONFIG_MULTITHREAD|SQLITE_CONFIG_SERIALIZED): http://sqlite.org/c3ref/config.html)
func ConfigThreadMode(mode ThreadMode) error {
rv := C.goSqlite3ConfigThreadMode(C.int(mode))
if rv == C.SQLITE_OK {
return nil
}
return Errno(rv)
}
......@@ -10,6 +10,13 @@ import (
"testing"
)
func init() {
err := ConfigThreadMode(SERIALIZED)
if err != nil {
panic(fmt.Sprintf("cannot change thread mode: '%s'", err))
}
}
func trace(d interface{}, sql string) {
if t, ok := d.(*testing.T); ok {
t.Logf("TRACE: %s\n", sql)
......
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