X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/92feab9112e64b8aab280cb90d5a5fef75646e3b..2d2b6d7ed8826d3034f5224ece94aa5f0f1b0e6a:/vendor/gems/composite_primary_keys-2.2.2/lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb diff --git a/vendor/gems/composite_primary_keys-2.2.2/lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb b/vendor/gems/composite_primary_keys-2.2.2/lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb deleted file mode 100644 index 65fce48f6..000000000 --- a/vendor/gems/composite_primary_keys-2.2.2/lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb +++ /dev/null @@ -1,53 +0,0 @@ -module ActiveRecord - module ConnectionAdapters - class PostgreSQLAdapter < AbstractAdapter - - # This mightn't be in Core, but count(distinct x,y) doesn't work for me - def supports_count_distinct? #:nodoc: - false - end - - def concat(*columns) - columns = columns.map { |c| "CAST(#{c} AS varchar)" } - "(#{columns.join('||')})" - end - - # Executes an INSERT query and returns the new record's ID - def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil) - # Extract the table from the insert sql. Yuck. - table = sql.split(" ", 4)[2].gsub('"', '') - - # Try an insert with 'returning id' if available (PG >= 8.2) - if supports_insert_with_returning? - pk, sequence_name = *pk_and_sequence_for(table) unless pk - if pk - quoted_pk = if pk.is_a?(Array) - pk.map { |col| quote_column_name(col) }.join(ID_SEP) - else - quote_column_name(pk) - end - id = select_value("#{sql} RETURNING #{quoted_pk}") - clear_query_cache - return id - end - end - - # Otherwise, insert then grab last_insert_id. - if insert_id = super - insert_id - else - # If neither pk nor sequence name is given, look them up. - unless pk || sequence_name - pk, sequence_name = *pk_and_sequence_for(table) - end - - # If a pk is given, fallback to default sequence name. - # Don't fetch last insert id for a table without a pk. - if pk && sequence_name ||= default_sequence_name(table, pk) - last_insert_id(table, sequence_name) - end - end - end - end - end -end