Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove exception dependency on Mysql and ActiveRecord, and make it work

with mysql2 (by not using fetch_row)
  • Loading branch information...
commit 6eb665df37a4254a469ca3c053b195fbbf0b9b35 1 parent 9fe3eef
@tiegz tiegz authored
Showing with 7 additions and 3 deletions.
  1. +2 −2 lib/lhm/sql_helper.rb
  2. +5 −1 lib/lhm/table.rb
View
4 lib/lhm/sql_helper.rb
@@ -28,7 +28,7 @@ def sql(statements)
[statements].flatten.each do |statement|
connection.execute(tagged(statement))
end
- rescue ActiveRecord::StatementInvalid, Mysql::Error => e
+ rescue => e
error e.message
end
@@ -36,7 +36,7 @@ def update(statements)
[statements].flatten.inject(0) do |memo, statement|
memo += connection.update(tagged(statement))
end
- rescue ActiveRecord::StatementInvalid, Mysql::Error => e
+ rescue => e
error e.message
end
View
6 lib/lhm/table.rb
@@ -38,7 +38,11 @@ def initialize(table_name, connection)
def ddl
sql = "show create table `#{ @table_name }`"
- @connection.execute(sql).fetch_row.last
+ results = []
+ @connection.execute(sql).each(:as => :array) do |r|
+ results << r
+ end
+ results.first.last
end
def parse
Please sign in to comment.
Something went wrong with that request. Please try again.