Class: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
- Defined in:
- lib/tasks/db_mock.rb
Class Method Summary collapse
Instance Method Summary collapse
- #async_exec(sql, params_result_format) ⇒ Object
-
#clear_cache! ⇒ Object
do nothing.
- #columns(table_name) ⇒ Object
- #escape(s) ⇒ Object
- #execute(sql, name = nil) ⇒ Object
- #initialize_type_map(m) ⇒ Object
- #quote_string(s) ⇒ Object
- #server_version ⇒ Object
- #skip?(sql) ⇒ Boolean
- #table_exists?(name) ⇒ Boolean
Class Method Details
.existing_tables=(existing_tables) ⇒ Object
38 39 40 |
# File 'lib/tasks/db_mock.rb', line 38 def self.existing_tables= existing_tables @@existing_tables = existing_tables end |
.server_version=(server_version) ⇒ Object
41 42 43 |
# File 'lib/tasks/db_mock.rb', line 41 def self.server_version= server_version @@server_version = server_version end |
Instance Method Details
#async_exec(sql, params_result_format) ⇒ Object
24 25 26 27 |
# File 'lib/tasks/db_mock.rb', line 24 def async_exec(sql, params_result_format) $tmp_to_run.append sql unless skip? sql return FakeResult.new end |
#clear_cache! ⇒ Object
do nothing
50 51 |
# File 'lib/tasks/db_mock.rb', line 50 def clear_cache! end |
#columns(table_name) ⇒ Object
35 36 37 |
# File 'lib/tasks/db_mock.rb', line 35 def columns(table_name) return @@existing_tables[table_name] end |
#escape(s) ⇒ Object
56 57 58 |
# File 'lib/tasks/db_mock.rb', line 56 def escape(s) return PG::Connection.quote_ident s end |
#execute(sql, name = nil) ⇒ Object
20 21 22 23 |
# File 'lib/tasks/db_mock.rb', line 20 def execute(sql, name = nil) $tmp_to_run.append sql unless skip? sql return FakeResult.new end |
#initialize_type_map(m) ⇒ Object
47 48 49 |
# File 'lib/tasks/db_mock.rb', line 47 def initialize_type_map m # do nothing end |
#quote_string(s) ⇒ Object
52 53 54 55 |
# File 'lib/tasks/db_mock.rb', line 52 def quote_string s # hack to prevent double-quoting when setting default return s end |
#server_version ⇒ Object
44 45 46 |
# File 'lib/tasks/db_mock.rb', line 44 def server_version return @@server_version end |
#skip?(sql) ⇒ Boolean
28 29 30 31 |
# File 'lib/tasks/db_mock.rb', line 28 def skip? sql return true if sql.end_with?("'::regtype::oid") and sql.start_with?("SELECT '") return false end |
#table_exists?(name) ⇒ Boolean
32 33 34 |
# File 'lib/tasks/db_mock.rb', line 32 def table_exists?(name) false end |