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
878a8077
Commit
878a8077
authored
Mar 04, 2012
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test Stmt misuse.
parent
7321b68b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
1 deletion
+34
-1
blob_test.go
blob_test.go
+0
-1
sqlite_test.go
sqlite_test.go
+28
-0
stmt.go
stmt.go
+6
-0
No files found.
blob_test.go
View file @
878a8077
...
...
@@ -48,7 +48,6 @@ func TestBlobMisuse(t *testing.T) {
defer
db
.
Close
()
bw
,
err
:=
db
.
NewBlobReadWriter
(
"main"
,
"test"
,
"content"
,
0
)
//t.Logf("%#v", err)
if
bw
!=
nil
||
err
==
nil
{
t
.
Errorf
(
"error expected"
)
}
...
...
sqlite_test.go
View file @
878a8077
...
...
@@ -370,3 +370,31 @@ func TestScanNull(t *testing.T) {
t
.
Errorf
(
"Expected nil but got %p
\n
"
,
ps
)
}
}
func
TestCloseTwice
(
t
*
testing
.
T
)
{
db
:=
open
(
t
)
s
,
err
:=
db
.
Prepare
(
"SELECT 1"
)
checkNoError
(
t
,
err
,
"prepare error: %s"
)
err
=
s
.
Finalize
()
checkNoError
(
t
,
err
,
"finalize error: %s"
)
err
=
s
.
Finalize
()
checkNoError
(
t
,
err
,
"finalize error: %s"
)
err
=
db
.
Close
()
checkNoError
(
t
,
err
,
"close error: %s"
)
err
=
db
.
Close
()
checkNoError
(
t
,
err
,
"close error: %s"
)
}
func
TestStmtMisuse
(
t
*
testing
.
T
)
{
db
:=
open
(
t
)
defer
db
.
Close
()
s
,
err
:=
db
.
Prepare
(
"MISUSE"
)
if
s
!=
nil
||
err
==
nil
{
t
.
Error
(
"error expected"
)
}
err
=
s
.
Finalize
()
if
err
==
nil
{
t
.
Error
(
"error expected"
)
}
}
stmt.go
View file @
878a8077
...
...
@@ -902,12 +902,18 @@ func (s *Stmt) Busy() bool {
// Destroy a prepared statement
// (See http://sqlite.org/c3ref/finalize.html)
func
(
s
*
Stmt
)
Finalize
()
error
{
if
s
==
nil
{
return
errors
.
New
(
"nil sqlite statement"
)
}
if
s
.
Cacheable
{
return
s
.
c
.
stmtCache
.
release
(
s
)
}
return
s
.
finalize
()
}
func
(
s
*
Stmt
)
finalize
()
error
{
if
s
==
nil
{
return
errors
.
New
(
"nil sqlite statement"
)
}
rv
:=
C
.
sqlite3_finalize
(
s
.
stmt
)
if
rv
!=
C
.
SQLITE_OK
{
return
s
.
error
(
rv
)
...
...
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