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
92e3a38c
Commit
92e3a38c
authored
Jan 01, 2012
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Context#Value.
parent
7453f923
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
function.go
function.go
+24
-0
trace.go
trace.go
+1
-1
No files found.
function.go
View file @
92e3a38c
...
@@ -77,6 +77,7 @@ type Context struct {
...
@@ -77,6 +77,7 @@ type Context struct {
argv
**
C
.
sqlite3_value
argv
**
C
.
sqlite3_value
}
}
// Set the result of an SQL function
func
(
c
*
Context
)
ResultBool
(
b
bool
)
{
func
(
c
*
Context
)
ResultBool
(
b
bool
)
{
if
b
{
if
b
{
c
.
ResultInt
(
1
)
c
.
ResultInt
(
1
)
...
@@ -205,6 +206,11 @@ func (c *Context) SetAuxData(n int, ad interface{}, d AuxDataDestructor) {
...
@@ -205,6 +206,11 @@ func (c *Context) SetAuxData(n int, ad interface{}, d AuxDataDestructor) {
C
.
goSqlite3SetAuxdata
(
c
.
context
,
C
.
int
(
n
),
unsafe
.
Pointer
(
adp
))
C
.
goSqlite3SetAuxdata
(
c
.
context
,
C
.
int
(
n
),
unsafe
.
Pointer
(
adp
))
}
}
// The leftmost value is number 0.
func
(
c
*
Context
)
Bool
(
i
int
)
bool
{
return
c
.
Int
(
i
)
==
1
}
// The leftmost value is number 0.
// The leftmost value is number 0.
// Calls sqlite3_value_blob and sqlite3_value_bytes, http://sqlite.org/c3ref/value_blob.html
// Calls sqlite3_value_blob and sqlite3_value_bytes, http://sqlite.org/c3ref/value_blob.html
func
(
c
*
Context
)
Blob
(
i
int
)
(
value
[]
byte
)
{
func
(
c
*
Context
)
Blob
(
i
int
)
(
value
[]
byte
)
{
...
@@ -259,6 +265,24 @@ func (c *Context) NumericType(i int) Type {
...
@@ -259,6 +265,24 @@ func (c *Context) NumericType(i int) Type {
return
Type
(
C
.
my_value_numeric_type
(
c
.
argv
,
C
.
int
(
i
)))
return
Type
(
C
.
my_value_numeric_type
(
c
.
argv
,
C
.
int
(
i
)))
}
}
func
(
c
*
Context
)
Value
(
i
int
)
(
value
interface
{})
{
switch
c
.
Type
(
i
)
{
case
Null
:
value
=
nil
case
Text
:
value
=
c
.
Text
(
i
)
case
Integer
:
value
=
c
.
Int64
(
i
)
case
Float
:
value
=
c
.
Double
(
i
)
case
Blob
:
value
=
c
.
Blob
(
i
)
default
:
panic
(
"The value type is not one of SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT, SQLITE_BLOB, or SQLITE_NULL"
)
}
return
}
type
ScalarFunction
func
(
ctx
*
Context
,
nArg
int
)
type
ScalarFunction
func
(
ctx
*
Context
,
nArg
int
)
type
DestroyFunctionData
func
(
pApp
interface
{})
type
DestroyFunctionData
func
(
pApp
interface
{})
...
...
trace.go
View file @
92e3a38c
...
@@ -315,7 +315,7 @@ func goXLog(udp unsafe.Pointer, err int, msg *C.char) {
...
@@ -315,7 +315,7 @@ func goXLog(udp unsafe.Pointer, err int, msg *C.char) {
var
logger
*
sqliteLogger
var
logger
*
sqliteLogger
// Configur
ing
the logger of the SQLite library
// Configur
e
the logger of the SQLite library
// Calls sqlite3_config(SQLITE_CONFIG_LOG,...)
// Calls sqlite3_config(SQLITE_CONFIG_LOG,...)
func
ConfigLog
(
f
Logger
,
udp
interface
{})
error
{
func
ConfigLog
(
f
Logger
,
udp
interface
{})
error
{
var
rv
C
.
int
var
rv
C
.
int
...
...
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