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
eb98c92c
Commit
eb98c92c
authored
Jan 12, 2013
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improves fix for
https://code.google.com/p/go/issues/detail?id=4459
parent
e8065407
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
sqlite_test.go
sqlite_test.go
+18
-0
stmt.go
stmt.go
+4
-1
No files found.
sqlite_test.go
View file @
eb98c92c
...
@@ -374,6 +374,24 @@ func TestOpenSameMemoryDb(t *testing.T) {
...
@@ -374,6 +374,24 @@ func TestOpenSameMemoryDb(t *testing.T) {
checkNoError
(
t
,
err
,
"exists error: %s"
)
checkNoError
(
t
,
err
,
"exists error: %s"
)
}
}
func
TestStmtWithClosedDb
(
t
*
testing
.
T
)
{
db
:=
open
(
t
)
defer
db
.
Close
()
db
.
SetCacheSize
(
0
)
s
,
err
:=
db
.
Prepare
(
"select 1"
)
checkNoError
(
t
,
err
,
"prepare error: %s"
)
defer
s
.
Finalize
()
err
=
db
.
Close
()
checkNoError
(
t
,
err
,
"close error: %s"
)
err
=
s
.
Finalize
()
assert
(
t
,
"error expected"
,
err
!=
nil
)
//println(err.Error())
}
func
assertEquals
(
t
*
testing
.
T
,
format
string
,
expected
,
actual
interface
{})
{
func
assertEquals
(
t
*
testing
.
T
,
format
string
,
expected
,
actual
interface
{})
{
if
expected
!=
actual
{
if
expected
!=
actual
{
t
.
Errorf
(
format
,
expected
,
actual
)
t
.
Errorf
(
format
,
expected
,
actual
)
...
...
stmt.go
View file @
eb98c92c
...
@@ -910,7 +910,7 @@ func (s *Stmt) Finalize() error {
...
@@ -910,7 +910,7 @@ func (s *Stmt) Finalize() error {
if
s
==
nil
{
if
s
==
nil
{
return
errors
.
New
(
"nil sqlite statement"
)
return
errors
.
New
(
"nil sqlite statement"
)
}
}
if
s
.
Cacheable
{
if
s
.
Cacheable
&&
s
.
c
!=
nil
&&
s
.
c
.
db
!=
nil
{
return
s
.
c
.
stmtCache
.
release
(
s
)
return
s
.
c
.
stmtCache
.
release
(
s
)
}
}
return
s
.
finalize
()
return
s
.
finalize
()
...
@@ -919,6 +919,9 @@ func (s *Stmt) finalize() error {
...
@@ -919,6 +919,9 @@ func (s *Stmt) finalize() error {
if
s
==
nil
{
if
s
==
nil
{
return
errors
.
New
(
"nil sqlite statement"
)
return
errors
.
New
(
"nil sqlite statement"
)
}
}
if
s
.
stmt
==
nil
{
return
nil
}
if
s
.
c
==
nil
||
s
.
c
.
db
==
nil
{
if
s
.
c
==
nil
||
s
.
c
.
db
==
nil
{
return
errors
.
New
(
"sqlite statement with already closed database connection"
)
return
errors
.
New
(
"sqlite statement with already closed database connection"
)
}
}
...
...
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