Module: JdbcSpec::FoxPro
- Defined in:
- lib/active_record/connection_adapters/jdbcdbf_adapter.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#add_limit_offset!(sql, options) ⇒ Object
:nodoc:.
- #columns(table_name, name = nil) ⇒ Object
- #quoted_date(value) ⇒ Object
- #quoted_false ⇒ Object
- #quoted_true ⇒ Object
- #select(sql, name = nil) ⇒ Object
- #supports_migrations? ⇒ Boolean
Class Method Details
.adapter_matcher(name) ⇒ Object
24 25 26 |
# File 'lib/active_record/connection_adapters/jdbcdbf_adapter.rb', line 24 def self.adapter_matcher(name, *) name =~ /dbf/i ? self : false end |
Instance Method Details
#add_limit_offset!(sql, options) ⇒ Object
:nodoc:
27 28 29 30 31 32 33 |
# File 'lib/active_record/connection_adapters/jdbcdbf_adapter.rb', line 27 def add_limit_offset!(sql, ) # :nodoc: if [:limit] find_select = /\b(SELECT(?:\s+DISTINCT)?)\b(.*)/i whole, select, rest = find_select.match(sql).to_a "#{select} TOP #{[:lmit]} #{rest}" end end |
#columns(table_name, name = nil) ⇒ Object
34 35 36 |
# File 'lib/active_record/connection_adapters/jdbcdbf_adapter.rb', line 34 def columns(table_name, name = nil) super.each { |column| column.name.downcase! } end |
#quoted_date(value) ⇒ Object
43 |
# File 'lib/active_record/connection_adapters/jdbcdbf_adapter.rb', line 43 def quoted_date(value); "#{value.strftime("%Y-%m-%d")}"; end |
#quoted_false ⇒ Object
41 |
# File 'lib/active_record/connection_adapters/jdbcdbf_adapter.rb', line 41 def quoted_false; 'true'; end |
#quoted_true ⇒ Object
40 |
# File 'lib/active_record/connection_adapters/jdbcdbf_adapter.rb', line 40 def quoted_true; 'false'; end |
#select(sql, name = nil) ⇒ Object
37 38 39 |
# File 'lib/active_record/connection_adapters/jdbcdbf_adapter.rb', line 37 def select(sql, name=nil) (super sql, name).map { |row| row.inject({}) { |new_row, pair| new_row[pair[0].downcase] = pair[1]; new_row } } end |
#supports_migrations? ⇒ Boolean
42 |
# File 'lib/active_record/connection_adapters/jdbcdbf_adapter.rb', line 42 def supports_migrations?; false; end |