good morning!!!!

Skip to content
Snippets Groups Projects
Commit c7f20253 authored by Carlos Nieto's avatar Carlos Nieto
Browse files

Adding explicit close on some SELECT statements.

parent 095313db
Branches
Tags
No related merge requests found
...@@ -222,7 +222,7 @@ func (self *Table) Append(item interface{}) (db.Id, error) { ...@@ -222,7 +222,7 @@ func (self *Table) Append(item interface{}) (db.Id, error) {
// Returns true if the collection exists. // Returns true if the collection exists.
func (self *Table) Exists() bool { func (self *Table) Exists() bool {
result, err := self.source.doQuery( rows, err := self.source.doQuery(
fmt.Sprintf(` fmt.Sprintf(`
SELECT name SELECT name
FROM sqlite_master FROM sqlite_master
...@@ -236,9 +236,9 @@ func (self *Table) Exists() bool { ...@@ -236,9 +236,9 @@ func (self *Table) Exists() bool {
return false return false
} }
defer result.Close() defer rows.Close()
return result.Next() return rows.Next()
} }
func toInternalInterface(val interface{}) interface{} { func toInternalInterface(val interface{}) interface{} {
......
...@@ -217,6 +217,8 @@ func (self *Source) Collections() ([]string, error) { ...@@ -217,6 +217,8 @@ func (self *Source) Collections() ([]string, error) {
return nil, err return nil, err
} }
defer rows.Close()
for rows.Next() { for rows.Next() {
rows.Scan(&collection) rows.Scan(&collection)
collections = append(collections, collection) collections = append(collections, collection)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment