Class: Swift::Adapter::Sql Abstract
- Inherits:
-
Swift::Adapter
- Object
- Swift::Adapter
- Swift::Adapter::Sql
- Extended by:
- Forwardable
- Includes:
- Migrations::InstanceMethods
- Defined in:
- lib/swift/adapter/sql.rb,
lib/swift/migrations.rb
Overview
This class is abstract.
Abstract SQL Adapter.
Constant Summary
Constants inherited from Swift::Adapter
Instance Attribute Summary
Attributes inherited from Swift::Adapter
Instance Method Summary collapse
Methods included from Migrations::InstanceMethods
Methods inherited from Swift::Adapter
#create, #delete, #execute, #get, #identity_map, #initialize, #log_command, #prepare, #trace, #trace?, #update
Constructor Details
This class inherits a constructor from Swift::Adapter
Instance Method Details
#fields(table) ⇒ Object
17 18 19 20 |
# File 'lib/swift/adapter/sql.rb', line 17 def fields table result = execute("select * from #{table} limit 0") Hash[result.fields.map(&:to_sym).zip(result.types)] end |
#tables ⇒ Object
13 14 15 |
# File 'lib/swift/adapter/sql.rb', line 13 def tables raise NotImplementedError end |
#transaction(*args) ⇒ Object
22 23 24 |
# File 'lib/swift/adapter/sql.rb', line 22 def transaction *args db.transaction(*args) {|db| yield self} end |