good morning!!!!

Skip to content
Snippets Groups Projects
Commit 15b24f53 authored by José Carlos Nieto's avatar José Carlos Nieto
Browse files

Moving codeblock.

parent 6d282038
Branches
Tags
No related merge requests found
......@@ -385,6 +385,29 @@ func (self *Table) Append(items ...interface{}) ([]db.Id, error) {
return ids, nil
}
/*
Returns true if the collection exists.
*/
func (self *Table) Exists() bool {
result, err := self.source.doQuery(
fmt.Sprintf(`
SELECT name
FROM sqlite_master
WHERE type = 'table' AND name = '%s'
`,
self.Name(),
),
)
if err != nil {
return false
}
if result.Next() == true {
result.Close()
return true
}
return false
}
/*
Converts a Go value into internal database representation.
*/
......@@ -414,26 +437,3 @@ func toInternal(val interface{}) string {
func toNative(val interface{}) interface{} {
return val
}
/*
Returns true if the collection exists.
*/
func (self *Table) Exists() bool {
result, err := self.source.doQuery(
fmt.Sprintf(`
SELECT name
FROM sqlite_master
WHERE type = 'table' AND name = '%s'
`,
self.Name(),
),
)
if err != nil {
return false
}
if result.Next() == true {
result.Close()
return true
}
return false
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment