Permalink
Browse files

Merge pull request #1155 from sam0410/DoubleQuotes

Double quotes to SQL queries
  • Loading branch information...
henare committed Aug 31, 2017
2 parents 6be93f4 + bd6af03 commit 2324a756dc11176dd3f3f27a57212b1c0f82e6a2
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/morph/database.rb
View
@@ -128,7 +128,7 @@ def sql_query_safe(query, readonly = true)
# Returns 0 if table doesn't exists (or there is some other problem)
def no_rows(table = table_names.first)
q = sql_query_safe("select count(*) from '#{table}'")
q = sql_query_safe(%{select count(*) from "#{table}"})
q ? q.first.values.first : 0
rescue *CORRUPT_DATABASE_EXCEPTIONS
0
@@ -163,16 +163,16 @@ def write_sqlite_database(content)
end
def standardise_table_name(table_name)
sql_query_safe("ALTER TABLE '#{table_name}' " \
"RENAME TO '#{Database.sqlite_table_name}'", false)
sql_query_safe(%{ALTER TABLE "#{table_name}" \
RENAME TO "#{Database.sqlite_table_name}"}, false)
end
def select_first_ten(table = table_names.first)
"select * from '#{table}' limit 10"
%{select * from "#{table}" limit 10}
end
def select_all(table = table_names.first)
"select * from '#{table}'"
%{select * from "#{table}"}
end
def first_ten_rows(table = table_names.first)

0 comments on commit 2324a75

Please sign in to comment.