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
51f4586d
Commit
51f4586d
authored
Aug 27, 2011
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SetAuthorizer return type.
parent
adbe176b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
sqlite_test.go
sqlite_test.go
+6
-1
trace.go
trace.go
+5
-4
No files found.
sqlite_test.go
View file @
51f4586d
...
@@ -25,7 +25,12 @@ func open(t *testing.T) *Conn {
...
@@ -25,7 +25,12 @@ func open(t *testing.T) *Conn {
t
.
Fatal
(
"opened database is nil"
)
t
.
Fatal
(
"opened database is nil"
)
}
}
//db.Trace(trace, "TRACE")
//db.Trace(trace, "TRACE")
//db.SetAuthorizer(authorizer, "AUTH")
/*
err = db.SetAuthorizer(authorizer, "AUTH")
if err != nil {
t.Fatal("couldn't set an authorizer", err)
}
*/
return
db
return
db
}
}
...
...
trace.go
View file @
51f4586d
...
@@ -26,6 +26,7 @@ import "C"
...
@@ -26,6 +26,7 @@ import "C"
import
(
import
(
"fmt"
"fmt"
"os"
"unsafe"
"unsafe"
)
)
...
@@ -52,6 +53,7 @@ func (c *Conn) Trace(f SqliteTrace, arg interface{}) {
...
@@ -52,6 +53,7 @@ func (c *Conn) Trace(f SqliteTrace, arg interface{}) {
C
.
goSqlite3Trace
(
c
.
db
,
pArg
)
C
.
goSqlite3Trace
(
c
.
db
,
pArg
)
}
}
// TODO SQLITE_DENY, SQLITE_IGNORE, SQLITE_OK
type
SqliteAuthorizer
func
(
d
interface
{},
action
int
,
arg1
,
arg2
,
arg3
,
arg4
string
)
int
type
SqliteAuthorizer
func
(
d
interface
{},
action
int
,
arg1
,
arg2
,
arg3
,
arg4
string
)
int
type
sqliteAuthorizer
struct
{
type
sqliteAuthorizer
struct
{
...
@@ -73,11 +75,10 @@ func goXAuth(pUserData unsafe.Pointer, action C.int, arg1, arg2, arg3, arg4 *C.c
...
@@ -73,11 +75,10 @@ func goXAuth(pUserData unsafe.Pointer, action C.int, arg1, arg2, arg3, arg4 *C.c
}
}
// Calls http://sqlite.org/c3ref/set_authorizer.html
// Calls http://sqlite.org/c3ref/set_authorizer.html
func
(
c
*
Conn
)
SetAuthorizer
(
f
SqliteAuthorizer
,
arg
interface
{})
int
{
func
(
c
*
Conn
)
SetAuthorizer
(
f
SqliteAuthorizer
,
arg
interface
{})
os
.
Error
{
// c.authorizer = f
if
f
==
nil
{
if
f
==
nil
{
return
int
(
C
.
sqlite3_set_authorizer
(
c
.
db
,
nil
,
nil
))
return
c
.
error
(
C
.
sqlite3_set_authorizer
(
c
.
db
,
nil
,
nil
))
}
}
pArg
:=
unsafe
.
Pointer
(
&
sqliteAuthorizer
{
f
,
arg
})
pArg
:=
unsafe
.
Pointer
(
&
sqliteAuthorizer
{
f
,
arg
})
return
int
(
C
.
goSqlite3SetAuthorizer
(
c
.
db
,
pArg
))
return
c
.
error
(
C
.
goSqlite3SetAuthorizer
(
c
.
db
,
pArg
))
}
}
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