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
a40e43f9
Commit
a40e43f9
authored
Aug 27, 2011
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Trace.
parent
27311031
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
12 deletions
+15
-12
sqlite.go
sqlite.go
+1
-0
sqlite_test.go
sqlite_test.go
+4
-4
trace.go
trace.go
+10
-8
No files found.
sqlite.go
View file @
a40e43f9
...
...
@@ -136,6 +136,7 @@ func (c *Conn) Error() os.Error {
type
Conn
struct
{
db
*
C
.
sqlite3
authorizer
*
sqliteAuthorizer
trace
*
sqliteTrace
}
// Calls http://sqlite.org/c3ref/libversion.html
...
...
sqlite_test.go
View file @
a40e43f9
...
...
@@ -26,10 +26,10 @@ func open(t *testing.T) *Conn {
}
//db.Trace(trace, "TRACE")
/*
err = db.SetAuthorizer(authorizer, "AUTH")
if err != nil {
t.Fatal("couldn't set an authorizer", err)
}
err = db.SetAuthorizer(authorizer, "AUTH")
if err != nil {
t.Fatal("couldn't set an authorizer", err)
}
*/
return
db
}
...
...
trace.go
View file @
a40e43f9
...
...
@@ -29,10 +29,10 @@ import (
"unsafe"
)
type
SqliteTrace
func
(
d
interface
{},
t
string
)
type
Tracer
func
(
d
interface
{},
t
string
)
type
sqliteTrace
struct
{
f
SqliteTrace
f
Tracer
d
interface
{}
}
...
...
@@ -43,13 +43,15 @@ func goXTrace(pArg unsafe.Pointer, t *C.char) {
}
// Calls sqlite3_trace, http://sqlite.org/c3ref/profile.html
func
(
c
*
Conn
)
Trace
(
f
SqliteTrace
,
arg
interface
{})
{
func
(
c
*
Conn
)
Trace
(
f
Tracer
,
arg
interface
{})
{
if
f
==
nil
{
c
.
trace
=
nil
C
.
sqlite3_trace
(
c
.
db
,
nil
,
nil
)
return
}
pArg
:=
unsafe
.
Pointer
(
&
sqliteTrace
{
f
,
arg
})
C
.
goSqlite3Trace
(
c
.
db
,
pArg
)
// To make sure it is not gced, keep a reference in the connection.
c
.
trace
=
&
sqliteTrace
{
f
,
arg
}
C
.
goSqlite3Trace
(
c
.
db
,
unsafe
.
Pointer
(
c
.
trace
))
}
type
Auth
int
...
...
@@ -98,10 +100,10 @@ const (
COPY
Action
=
C
.
SQLITE_COPY
)
type
Sqlite
Authorizer
func
(
d
interface
{},
action
Action
,
arg1
,
arg2
,
arg3
,
arg4
string
)
Auth
type
Authorizer
func
(
d
interface
{},
action
Action
,
arg1
,
arg2
,
arg3
,
arg4
string
)
Auth
type
sqliteAuthorizer
struct
{
f
Sqlite
Authorizer
f
Authorizer
d
interface
{}
}
...
...
@@ -113,7 +115,7 @@ func goXAuth(pUserData unsafe.Pointer, action C.int, arg1, arg2, arg3, arg4 *C.c
}
// Calls http://sqlite.org/c3ref/set_authorizer.html
func
(
c
*
Conn
)
SetAuthorizer
(
f
Sqlite
Authorizer
,
arg
interface
{})
os
.
Error
{
func
(
c
*
Conn
)
SetAuthorizer
(
f
Authorizer
,
arg
interface
{})
os
.
Error
{
if
f
==
nil
{
c
.
authorizer
=
nil
return
c
.
error
(
C
.
sqlite3_set_authorizer
(
c
.
db
,
nil
,
nil
))
...
...
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