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
53988358
Commit
53988358
authored
Apr 01, 2014
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First draft of an "intarray" (not tested)
parent
b9a61d0a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
15 deletions
+21
-15
csv.go
csv.go
+1
-1
sqlite.go
sqlite.go
+8
-2
vtab.go
vtab.go
+10
-10
vtab_test.go
vtab_test.go
+2
-2
No files found.
csv.go
View file @
53988358
...
...
@@ -106,7 +106,7 @@ func (m csvModule) Connect(c *Conn, args []string) (VTab, error) {
return
m
.
Create
(
c
,
args
)
}
func
(
m
csvModule
)
Destroy
()
{
// nothing to do
func
(
m
csvModule
)
Destroy
Module
()
{
// nothing to do
}
type
csvTab
struct
{
...
...
sqlite.go
View file @
53988358
...
...
@@ -234,17 +234,23 @@ func OpenVfs(filename string, vfsname string, flags ...OpenFlag) (*Conn, error)
}
c
:=
&
Conn
{
db
:
db
,
stmtCache
:
newCache
(),
DefaultTimeLayout
:
"2006-01-02 15:04:05.000Z07:00"
}
if
os
.
Getenv
(
"SQLITE_DEBUG"
)
!=
""
{
c
.
SetAuthorizer
(
authorizer
,
c
.
db
)
c
.
SetCacheSize
(
0
)
//c.SetAuthorizer(authorizer, c.db)
c
.
Trace
(
trace
,
"TRACE"
)
//c.SetCacheSize(0)
}
return
c
,
nil
}
/*
func authorizer(d interface{}, action Action, arg1, arg2, dbName, triggerName string) Auth {
fmt.Fprintf(os.Stderr, "%p: %v, %s, %s, %s, %s\n", d, action, arg1, arg2, dbName, triggerName)
return AuthOk
}
*/
func
trace
(
d
interface
{},
sql
string
)
{
fmt
.
Fprintf
(
os
.
Stderr
,
"%s: %s
\n
"
,
d
,
sql
)
}
// BusyTimeout sets a busy timeout.
// (See http://sqlite.org/c3ref/busy_timeout.html)
...
...
vtab.go
View file @
53988358
...
...
@@ -122,7 +122,7 @@ func goVClose(pCursor unsafe.Pointer) *C.char {
//export goMDestroy
func
goMDestroy
(
pClientData
unsafe
.
Pointer
)
{
m
:=
(
*
sqliteModule
)(
pClientData
)
m
.
module
.
Destroy
()
m
.
module
.
Destroy
Module
()
// TODO Check m.vts is empty
m
.
vts
=
nil
delete
(
m
.
c
.
modules
,
m
.
name
)
...
...
@@ -181,16 +181,16 @@ func goVRowid(pCursor unsafe.Pointer, pRowid *C.sqlite3_int64) *C.char {
type
Module
interface
{
Create
(
c
*
Conn
,
args
[]
string
)
(
VTab
,
error
)
// See http://sqlite.org/vtab.html#xcreate
Connect
(
c
*
Conn
,
args
[]
string
)
(
VTab
,
error
)
// See http://sqlite.org/vtab.html#xconnect
Destroy
()
// See http://sqlite.org/c3ref/create_module.html
Destroy
Module
()
// See http://sqlite.org/c3ref/create_module.html
}
// VTab describes a particular instance of the virtual table.
// (See http://sqlite.org/c3ref/vtab.html)
type
VTab
interface
{
BestIndex
(
/*sqlite3_index_info**/
)
error
// See http://sqlite.org/vtab.html#xbestindex
Disconnect
()
error
// See http://sqlite.org/vtab.html#xdisconnect
Destroy
()
error
// See http://sqlite.org/vtab.html#sqlite3_module.xDestroy
Open
()
(
VTabCursor
,
error
)
// See http://sqlite.org/vtab.html#xopen
BestIndex
(
/*sqlite3_index_info**/
)
error
// See http://sqlite.org/vtab.html#xbestindex
Disconnect
()
error
// See http://sqlite.org/vtab.html#xdisconnect
Destroy
()
error
// See http://sqlite.org/vtab.html#sqlite3_module.xDestroy
Open
()
(
VTabCursor
,
error
)
// See http://sqlite.org/vtab.html#xopen
}
// VTabExtended lists optional/extended functions.
...
...
@@ -215,10 +215,10 @@ type VTabExtended interface {
// VTabCursor describes cursors that point into the virtual table and are used to loop through the virtual table.
// (See http://sqlite.org/c3ref/vtab_cursor.html)
type
VTabCursor
interface
{
Close
()
error
// See http://sqlite.org/vtab.html#xclose
Filter
(
/*idxNum int, idxStr string, int argc, sqlite3_value **argv*/
)
error
// See http://sqlite.org/vtab.html#xfilter
Next
()
error
// See http://sqlite.org/vtab.html#xnext
Eof
()
bool
// See http://sqlite.org/vtab.html#xeof
Close
()
error
// See http://sqlite.org/vtab.html#xclose
Filter
(
/*idxNum int, idxStr string, int argc, sqlite3_value **argv*/
)
error
// See http://sqlite.org/vtab.html#xfilter
Next
()
error
// See http://sqlite.org/vtab.html#xnext
Eof
()
bool
// See http://sqlite.org/vtab.html#xeof
// col is zero-based so the first column is numbered 0
Column
(
c
*
Context
,
col
int
)
error
// See http://sqlite.org/vtab.html#xcolumn
Rowid
()
(
int64
,
error
)
// See http://sqlite.org/vtab.html#xrowid
...
...
vtab_test.go
View file @
53988358
...
...
@@ -46,8 +46,8 @@ func (m testModule) Connect(c *Conn, args []string) (VTab, error) {
return
m
.
Create
(
c
,
args
)
}
func
(
m
testModule
)
Destroy
()
{
//println("testModule.Destroy")
func
(
m
testModule
)
Destroy
Module
()
{
//println("testModule.Destroy
Module
")
}
func
(
v
*
testVTab
)
BestIndex
()
error
{
...
...
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