Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gosqlite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gosqlite
Commits
a09c1c19
Commit
a09c1c19
authored
Aug 11, 2012
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add binding to sqlite3_config(SQLITE_CONFIG_MEMSTATUS|SQLITE_CONFIG_URI).
parent
5a25a02d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
7 deletions
+37
-7
trace.c
trace.c
+4
-0
trace.go
trace.go
+27
-5
trace_test.go
trace_test.go
+6
-2
No files found.
trace.c
View file @
a09c1c19
...
...
@@ -48,4 +48,8 @@ int goSqlite3ConfigLog(void *udp) {
int
goSqlite3ConfigThreadMode
(
int
mode
)
{
return
sqlite3_config
(
mode
);
}
int
goSqlite3Config
(
int
op
,
int
mode
)
{
return
sqlite3_config
(
op
,
mode
);
}
\ No newline at end of file
trace.go
View file @
a09c1c19
...
...
@@ -21,6 +21,7 @@ static void my_log(int iErrCode, char *msg) {
int goSqlite3ConfigLog(void *udp);
int goSqlite3ConfigThreadMode(int mode);
int goSqlite3Config(int op, int mode);
*/
import
"C"
...
...
@@ -303,19 +304,40 @@ func ConfigLog(f Logger, udp interface{}) error {
return
Errno
(
rv
)
}
type
ThreadMode
int
type
Thread
ing
Mode
int
const
(
SINGLETHREAD
ThreadMode
=
C
.
SQLITE_CONFIG_SINGLETHREAD
MULTITHREAD
ThreadMode
=
C
.
SQLITE_CONFIG_MULTITHREAD
SERIALIZED
ThreadMode
=
C
.
SQLITE_CONFIG_SERIALIZED
SINGLETHREAD
Thread
ing
Mode
=
C
.
SQLITE_CONFIG_SINGLETHREAD
MULTITHREAD
Thread
ing
Mode
=
C
.
SQLITE_CONFIG_MULTITHREAD
SERIALIZED
Thread
ing
Mode
=
C
.
SQLITE_CONFIG_SERIALIZED
)
// Alters threading mode
// (See sqlite3_config(SQLITE_CONFIG_SINGLETHREAD|SQLITE_CONFIG_MULTITHREAD|SQLITE_CONFIG_SERIALIZED): http://sqlite.org/c3ref/config.html)
func
ConfigThread
Mode
(
mode
Thread
Mode
)
error
{
func
ConfigThread
ingMode
(
mode
Threading
Mode
)
error
{
rv
:=
C
.
goSqlite3ConfigThreadMode
(
C
.
int
(
mode
))
if
rv
==
C
.
SQLITE_OK
{
return
nil
}
return
Errno
(
rv
)
}
// Enables or disables the collection of memory allocation statistics
// (See sqlite3_config(SQLITE_CONFIG_MEMSTATUS): http://sqlite.org/c3ref/config.html)
func
ConfigMemStatus
(
b
bool
)
error
{
rv
:=
C
.
goSqlite3Config
(
C
.
SQLITE_CONFIG_MEMSTATUS
,
btocint
(
b
))
if
rv
==
C
.
SQLITE_OK
{
return
nil
}
return
Errno
(
rv
)
}
// Enables or disables URI handling
// (See sqlite3_config(SQLITE_CONFIG_URI): http://sqlite.org/c3ref/config.html)
func
ConfigUri
(
b
bool
)
error
{
rv
:=
C
.
goSqlite3Config
(
C
.
SQLITE_CONFIG_URI
,
btocint
(
b
))
if
rv
==
C
.
SQLITE_OK
{
return
nil
}
return
Errno
(
rv
)
}
trace_test.go
View file @
a09c1c19
...
...
@@ -11,9 +11,13 @@ import (
)
func
init
()
{
err
:=
ConfigThreadMode
(
SERIALIZED
)
err
:=
ConfigThread
ing
Mode
(
SERIALIZED
)
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"cannot change thread mode: '%s'"
,
err
))
panic
(
fmt
.
Sprintf
(
"cannot change threading mode: '%s'"
,
err
))
}
err
=
ConfigMemStatus
(
true
)
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"cannot activate mem status: '%s'"
,
err
))
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment