From 6a00344355577859ce7f7b533dc62526992dfeeb Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Sat, 26 Jul 2014 08:37:45 +0800 Subject: [PATCH] Fix check HasColumn for sqlite3 --- sqlite3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite3.go b/sqlite3.go index 0aab7d34..00408782 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -68,6 +68,6 @@ func (s *sqlite3) HasTable(scope *Scope, tableName string) bool { func (s *sqlite3) HasColumn(scope *Scope, tableName string, columnName string) bool { var count int - scope.DB().QueryRow(fmt.Sprintf("SELECT count(*) FROM sqlite_master WHERE tbl_name = '%v' AND (sql LIKE '%%(\"%v\" %%' OR sql LIKE '%%,\"%v\" %%' OR sql LIKE '%%( %v %%' OR sql LIKE '%%, %v %%');\n", tableName, columnName, columnName, columnName, columnName)).Scan(&count) + scope.DB().QueryRow(fmt.Sprintf("SELECT count(*) FROM sqlite_master WHERE tbl_name = '%v' AND (sql LIKE '%%(\"%v\" %%' OR sql LIKE '%%,\"%v\" %%' OR sql LIKE '%%( %v %%' OR sql LIKE '%%, %v %%');\n", tableName, columnName, columnName, columnName, columnName)).Scan(&count) return count > 0 }