Module: Torque::PostgreSQL::Adapter
- Includes:
- DatabaseStatements, Quoting, SchemaOverrides, SchemaStatements
- Defined in:
- lib/torque/postgresql/adapter.rb,
lib/torque/postgresql/adapter/oid/box.rb,
lib/torque/postgresql/adapter/quoting.rb,
lib/torque/postgresql/adapter/oid/enum.rb,
lib/torque/postgresql/adapter/oid/line.rb,
lib/torque/postgresql/adapter/oid/array.rb,
lib/torque/postgresql/adapter/oid/range.rb,
lib/torque/postgresql/adapter/oid/circle.rb,
lib/torque/postgresql/adapter/oid/segment.rb,
lib/torque/postgresql/adapter/oid/enum_set.rb,
lib/torque/postgresql/adapter/oid/interval.rb,
lib/torque/postgresql/adapter/schema_dumper.rb,
lib/torque/postgresql/adapter/schema_creation.rb,
lib/torque/postgresql/adapter/schema_overrides.rb,
lib/torque/postgresql/adapter/schema_statements.rb,
lib/torque/postgresql/adapter/schema_definitions.rb,
lib/torque/postgresql/adapter/database_statements.rb
Defined Under Namespace
Modules: ColumnMethods, DatabaseStatements, Definition, OID, Quoting, SchemaCreation, SchemaDumper, SchemaOverrides, SchemaStatements, TableDefinition Classes: DeduplicatableArray
Constant Summary
Constants included from DatabaseStatements
DatabaseStatements::EXTENDED_DATABASE_TYPES
Constants included from Quoting
Quoting::Column, Quoting::ColumnDefinition, Quoting::Name, Quoting::QUOTED_TYPE_NAMES, Quoting::Utils
Instance Method Summary collapse
-
#build_insert_sql(insert) ⇒ Object
Allow filtered bulk insert by adding the where clause.
-
#extract_table_options!(options) ⇒ Object
Add ‘inherits` and `schema` to the list of extracted table options.
-
#version ⇒ Object
Get the current PostgreSQL version as a Gem Version.
Methods included from SchemaOverrides
#drop_table, #quote_table_name
Methods included from SchemaStatements
#add_enum_values, #add_search_language, #add_search_vector, #assume_migrated_upto_version, #data_source_sql, #drop_type, #enum_values, #insert_versions_sql, #quoted_scope, #rename_type, #table_options, #valid_table_definition_options
Methods included from DatabaseStatements
#column_definitions, #dump_mode!, #extended_types, #filter_by_schema, #inherited_tables, #initialize_type_map, #list_versioned_commands, #load_additional_types, #schema_exists?, #schemas_blacklist, #schemas_search_path_sanitized, #schemas_whitelist, #torque_load_additional_types, #torque_load_additional_types?, #type_exists?, #user_defined_schemas, #user_defined_schemas_sql, #user_defined_types, #valid_type?
Methods included from Quoting
#quote_default_expression, #quote_identifier_name, #quote_type_name
Instance Method Details
#build_insert_sql(insert) ⇒ Object
Allow filtered bulk insert by adding the where clause. This method is only used by InsertAll, so it somewhat safe to override it
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/torque/postgresql/adapter.rb', line 41 def build_insert_sql(insert) super.tap do |sql| if insert.update_duplicates? && insert.where_condition? if insert.returning sql.sub!(' RETURNING ', " WHERE #{insert.where} RETURNING ") else sql << " WHERE #{insert.where}" end end end end |
#extract_table_options!(options) ⇒ Object
Add ‘inherits` and `schema` to the list of extracted table options
35 36 37 |
# File 'lib/torque/postgresql/adapter.rb', line 35 def () super.merge(.extract!(:inherits, :schema)) end |
#version ⇒ Object
Get the current PostgreSQL version as a Gem Version.
28 29 30 31 32 |
# File 'lib/torque/postgresql/adapter.rb', line 28 def version @version ||= Gem::Version.new( select_value('SELECT version()').match(/#{Adapter::ADAPTER_NAME} ([\d\.]+)/)[1] ) end |