Module: Lhm::SqlHelper
- Extended by:
- SqlHelper
- Included in:
- Chunker, Connection::ActiveRecordConnection, Connection::DataMapperConnection, Entangler, Invoker, LockedSwitcher, Migrator, SqlHelper, Table::Parser
- Defined in:
- lib/lhm/sql_helper.rb
Instance Method Summary collapse
- #annotation ⇒ Object
- #idx_name(table_name, cols) ⇒ Object
- #idx_spec(cols) ⇒ Object
- #version_string ⇒ Object
Instance Method Details
#annotation ⇒ Object
8 9 10 |
# File 'lib/lhm/sql_helper.rb', line 8 def annotation '/* large hadron migration */' end |
#idx_name(table_name, cols) ⇒ Object
12 13 14 15 |
# File 'lib/lhm/sql_helper.rb', line 12 def idx_name(table_name, cols) column_names = column_definition(cols).map(&:first) "index_#{ table_name }_on_#{ column_names.join('_and_') }" end |
#idx_spec(cols) ⇒ Object
17 18 19 20 21 |
# File 'lib/lhm/sql_helper.rb', line 17 def idx_spec(cols) column_definition(cols).map do |name, length| "`#{ name }`#{ length }" end.join(', ') end |
#version_string ⇒ Object
23 24 25 26 27 |
# File 'lib/lhm/sql_helper.rb', line 23 def version_string row = connection.select_one("show variables like 'version'") value = struct_key(row, 'Value') row[value] end |