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
3ecfccaf
Commit
3ecfccaf
authored
Aug 27, 2011
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SqliteAuthorizer return type.
parent
51f4586d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
sqlite_test.go
sqlite_test.go
+2
-2
trace.go
trace.go
+10
-4
No files found.
sqlite_test.go
View file @
3ecfccaf
...
@@ -11,9 +11,9 @@ func trace(d interface{}, t string) {
...
@@ -11,9 +11,9 @@ func trace(d interface{}, t string) {
fmt
.
Printf
(
"%s: %s
\n
"
,
d
,
t
)
fmt
.
Printf
(
"%s: %s
\n
"
,
d
,
t
)
}
}
func
authorizer
(
d
interface
{},
action
int
,
arg1
,
arg2
,
arg3
,
arg4
string
)
int
{
func
authorizer
(
d
interface
{},
action
int
,
arg1
,
arg2
,
arg3
,
arg4
string
)
Auth
{
fmt
.
Printf
(
"%s: %d, %s, %s, %s, %s
\n
"
,
d
,
action
,
arg1
,
arg2
,
arg3
,
arg4
)
fmt
.
Printf
(
"%s: %d, %s, %s, %s, %s
\n
"
,
d
,
action
,
arg1
,
arg2
,
arg3
,
arg4
)
return
0
return
AUTH_OK
}
}
func
open
(
t
*
testing
.
T
)
*
Conn
{
func
open
(
t
*
testing
.
T
)
*
Conn
{
...
...
trace.go
View file @
3ecfccaf
...
@@ -53,8 +53,14 @@ func (c *Conn) Trace(f SqliteTrace, arg interface{}) {
...
@@ -53,8 +53,14 @@ 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
Auth
int
type
SqliteAuthorizer
func
(
d
interface
{},
action
int
,
arg1
,
arg2
,
arg3
,
arg4
string
)
int
const
(
AUTH_OK
Auth
=
C
.
SQLITE_OK
AUTH_DENY
Auth
=
C
.
SQLITE_DENY
AUTH_IGNORE
Auth
=
C
.
SQLITE_IGNORE
)
type
SqliteAuthorizer
func
(
d
interface
{},
action
int
,
arg1
,
arg2
,
arg3
,
arg4
string
)
Auth
type
sqliteAuthorizer
struct
{
type
sqliteAuthorizer
struct
{
f
SqliteAuthorizer
f
SqliteAuthorizer
...
@@ -63,13 +69,13 @@ type sqliteAuthorizer struct {
...
@@ -63,13 +69,13 @@ type sqliteAuthorizer struct {
//export goXAuth
//export goXAuth
func
goXAuth
(
pUserData
unsafe
.
Pointer
,
action
C
.
int
,
arg1
,
arg2
,
arg3
,
arg4
*
C
.
char
)
C
.
int
{
func
goXAuth
(
pUserData
unsafe
.
Pointer
,
action
C
.
int
,
arg1
,
arg2
,
arg3
,
arg4
*
C
.
char
)
C
.
int
{
var
result
int
var
result
Auth
if
pUserData
!=
nil
{
if
pUserData
!=
nil
{
arg
:=
(
*
sqliteAuthorizer
)(
pUserData
)
arg
:=
(
*
sqliteAuthorizer
)(
pUserData
)
result
=
arg
.
f
(
arg
.
d
,
int
(
action
),
C
.
GoString
(
arg1
),
C
.
GoString
(
arg2
),
C
.
GoString
(
arg3
),
C
.
GoString
(
arg4
))
result
=
arg
.
f
(
arg
.
d
,
int
(
action
),
C
.
GoString
(
arg1
),
C
.
GoString
(
arg2
),
C
.
GoString
(
arg3
),
C
.
GoString
(
arg4
))
}
else
{
}
else
{
fmt
.
Printf
(
"ERROR - %v
\n
"
,
pUserData
)
fmt
.
Printf
(
"ERROR - %v
\n
"
,
pUserData
)
result
=
0
result
=
AUTH_OK
}
}
return
C
.
int
(
result
)
return
C
.
int
(
result
)
}
}
...
...
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