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
f5bd5897
Commit
f5bd5897
authored
Jun 07, 2014
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepared statements created by the FTS module should not be finalized.
parent
a52244ac
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
2 deletions
+8
-2
shell/autocomplete.go
shell/autocomplete.go
+1
-0
shell/autocomplete_test.go
shell/autocomplete_test.go
+4
-0
shell/shell.go
shell/shell.go
+1
-0
sqlite.go
sqlite.go
+2
-2
No files found.
shell/autocomplete.go
View file @
f5bd5897
...
@@ -401,6 +401,7 @@ func (cc *CompletionCache) complete(tbl, prefix string) ([]string, error) {
...
@@ -401,6 +401,7 @@ func (cc *CompletionCache) complete(tbl, prefix string) ([]string, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
defer
s
.
Finalize
()
var
names
[]
string
var
names
[]
string
if
err
=
s
.
Select
(
func
(
s
*
sqlite
.
Stmt
)
error
{
if
err
=
s
.
Select
(
func
(
s
*
sqlite
.
Stmt
)
error
{
name
,
_
:=
s
.
ScanText
(
0
)
name
,
_
:=
s
.
ScanText
(
0
)
...
...
shell/autocomplete_test.go
View file @
f5bd5897
...
@@ -20,6 +20,7 @@ func createCache(t *testing.T) *CompletionCache {
...
@@ -20,6 +20,7 @@ func createCache(t *testing.T) *CompletionCache {
func
TestPragmaNames
(
t
*
testing
.
T
)
{
func
TestPragmaNames
(
t
*
testing
.
T
)
{
cc
:=
createCache
(
t
)
cc
:=
createCache
(
t
)
defer
cc
.
Close
()
pragmas
,
err
:=
cc
.
CompletePragma
(
"fo"
)
pragmas
,
err
:=
cc
.
CompletePragma
(
"fo"
)
assert
.
Tf
(
t
,
err
==
nil
,
"%v"
,
err
)
assert
.
Tf
(
t
,
err
==
nil
,
"%v"
,
err
)
assert
.
Equalf
(
t
,
3
,
len
(
pragmas
),
"got %d pragmas; expected %d"
,
len
(
pragmas
),
3
)
assert
.
Equalf
(
t
,
3
,
len
(
pragmas
),
"got %d pragmas; expected %d"
,
len
(
pragmas
),
3
)
...
@@ -27,6 +28,7 @@ func TestPragmaNames(t *testing.T) {
...
@@ -27,6 +28,7 @@ func TestPragmaNames(t *testing.T) {
}
}
func
TestFuncNames
(
t
*
testing
.
T
)
{
func
TestFuncNames
(
t
*
testing
.
T
)
{
cc
:=
createCache
(
t
)
cc
:=
createCache
(
t
)
defer
cc
.
Close
()
funcs
,
err
:=
cc
.
CompleteFunc
(
"su"
)
funcs
,
err
:=
cc
.
CompleteFunc
(
"su"
)
assert
.
Tf
(
t
,
err
==
nil
,
"%v"
,
err
)
assert
.
Tf
(
t
,
err
==
nil
,
"%v"
,
err
)
assert
.
Equal
(
t
,
2
,
len
(
funcs
),
"got %d functions; expected %d"
,
len
(
funcs
),
2
)
assert
.
Equal
(
t
,
2
,
len
(
funcs
),
"got %d functions; expected %d"
,
len
(
funcs
),
2
)
...
@@ -34,6 +36,7 @@ func TestFuncNames(t *testing.T) {
...
@@ -34,6 +36,7 @@ func TestFuncNames(t *testing.T) {
}
}
func
TestCmdNames
(
t
*
testing
.
T
)
{
func
TestCmdNames
(
t
*
testing
.
T
)
{
cc
:=
createCache
(
t
)
cc
:=
createCache
(
t
)
defer
cc
.
Close
()
cmds
,
err
:=
cc
.
CompleteCmd
(
".h"
)
cmds
,
err
:=
cc
.
CompleteCmd
(
".h"
)
assert
.
Tf
(
t
,
err
==
nil
,
"%v"
,
err
)
assert
.
Tf
(
t
,
err
==
nil
,
"%v"
,
err
)
assert
.
Equal
(
t
,
2
,
len
(
cmds
),
"got %d commands; expected %d"
,
len
(
cmds
),
2
)
assert
.
Equal
(
t
,
2
,
len
(
cmds
),
"got %d commands; expected %d"
,
len
(
cmds
),
2
)
...
@@ -44,6 +47,7 @@ func TestCache(t *testing.T) {
...
@@ -44,6 +47,7 @@ func TestCache(t *testing.T) {
assert
.
Tf
(
t
,
err
==
nil
,
"%v"
,
err
)
assert
.
Tf
(
t
,
err
==
nil
,
"%v"
,
err
)
defer
db
.
Close
()
defer
db
.
Close
()
cc
:=
createCache
(
t
)
cc
:=
createCache
(
t
)
defer
cc
.
Close
()
err
=
cc
.
Update
(
db
)
err
=
cc
.
Update
(
db
)
assert
.
Tf
(
t
,
err
==
nil
,
"%v"
,
err
)
assert
.
Tf
(
t
,
err
==
nil
,
"%v"
,
err
)
}
}
shell/shell.go
View file @
f5bd5897
...
@@ -161,6 +161,7 @@ func main() {
...
@@ -161,6 +161,7 @@ func main() {
}()
}()
completionCache
,
err
:=
shell
.
CreateCache
()
completionCache
,
err
:=
shell
.
CreateCache
()
check
(
err
)
check
(
err
)
defer
completionCache
.
Close
()
state
.
SetWordCompleter
(
func
(
line
string
,
pos
int
)
(
string
,
[]
string
,
string
)
{
state
.
SetWordCompleter
(
func
(
line
string
,
pos
int
)
(
string
,
[]
string
,
string
)
{
return
completion
(
completionCache
,
line
,
pos
)
return
completion
(
completionCache
,
line
,
pos
)
})
})
...
...
sqlite.go
View file @
f5bd5897
...
@@ -537,8 +537,8 @@ func (c *Conn) Close() error {
...
@@ -537,8 +537,8 @@ func (c *Conn) Close() error {
}
else
{
}
else
{
Log
(
C
.
SQLITE_MISUSE
,
"Dangling statement (not finalize):
\"
"
+
C
.
GoString
(
C
.
sqlite3_sql
(
stmt
))
+
"
\"
"
)
Log
(
C
.
SQLITE_MISUSE
,
"Dangling statement (not finalize):
\"
"
+
C
.
GoString
(
C
.
sqlite3_sql
(
stmt
))
+
"
\"
"
)
}
}
C
.
sqlite3_finalize
(
stmt
)
//
C.sqlite3_finalize(stmt)
stmt
=
C
.
sqlite3_next_stmt
(
c
.
db
,
nil
)
stmt
=
C
.
sqlite3_next_stmt
(
c
.
db
,
stmt
)
}
}
rv
:=
C
.
sqlite3_close
(
c
.
db
)
rv
:=
C
.
sqlite3_close
(
c
.
db
)
...
...
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