Commit 53988358 authored by gwenn's avatar gwenn

First draft of an "intarray" (not tested)

parent b9a61d0a
......@@ -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) DestroyModule() { // nothing to do
}
type csvTab struct {
......
......@@ -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)
......
......@@ -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.DestroyModule()
// 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
DestroyModule() // 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
......
......@@ -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) DestroyModule() {
//println("testModule.DestroyModule")
}
func (v *testVTab) BestIndex() error {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment