Sha256: 2a3f9be467d706e45cca7a36ccee36938510cecb3eaa409dbadc806303b9bd85

Contents?: true

Size: 1.55 KB

Versions: 12

Compression:

Stored size: 1.55 KB

Contents

module ActiveRecord
  module Bulkoperation
    module OracleEnhancedAdapter
  
      def find_foreign_master_tables_sql_array(table_name)
        sql = "select
                 m.table_name
               from
                 user_constraints m join user_constraints d on (m.constraint_name = d.r_constraint_name)
               where
                 d.table_name = ?"
        [sql, table_name.upcase]
      end

      def find_foreign_detail_tables_sql_array(table_name)
        sql = "select
                 d.table_name
               from
                 user_constraints m join user_constraints d on (m.constraint_name = d.r_constraint_name)
               where
             m.table_name = ?"
        [sql, table_name.upcase]
      end

      def find_detail_references_sql_array(table_name)
        sql = "select
          m.table_name master_table,
          ( select listagg( column_name, ',' ) within group (order by position) from user_cons_columns where constraint_name = m.constraint_name ) master_columns,
          d.table_name detail_table,
          ( select listagg( column_name, ',' ) within group (order by position) from user_cons_columns where constraint_name = d.constraint_name ) detail_columns
          from
          user_constraints m join user_constraints d on( m.constraint_name = d.r_constraint_name )
          where m.table_name = ?"
        [sql, table_name.upcase]
      end

      def find_by_sequence_name_sql_array(name)
        sql = 'select * from user_sequences where sequence_name = ?'
        [sql, name.upcase]
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
activerecord_bulkoperation-0.2.3 lib/activerecord_bulkoperation/adapters/oracle_enhanced_adapter.rb
activerecord_bulkoperation-0.2.2 lib/activerecord_bulkoperation/adapters/oracle_enhanced_adapter.rb
activerecord_bulkoperation-0.2.1 lib/activerecord_bulkoperation/adapters/oracle_enhanced_adapter.rb
activerecord_bulkoperation-0.2.0 lib/activerecord_bulkoperation/adapters/oracle_enhanced_adapter.rb
activerecord_bulkoperation-0.1.0 lib/activerecord_bulkoperation/adapters/oracle_enhanced_adapter.rb
activerecord_bulkoperation-0.0.8 lib/activerecord_bulkoperation/adapters/oracle_enhanced_adapter.rb
activerecord_bulkoperation-0.0.7 lib/activerecord_bulkoperation/adapters/oracle_enhanced_adapter.rb
activerecord_bulkoperation-0.0.6 lib/activerecord_bulkoperation/adapters/oracle_enhanced_adapter.rb
activerecord_bulkoperation-0.0.5 lib/activerecord_bulkoperation/adapters/oracle_enhanced_adapter.rb
activerecord_bulkoperation-0.0.4 lib/activerecord_bulkoperation/adapters/oracle_enhanced_adapter.rb
activerecord_bulkoperation-0.0.3 lib/activerecord_bulkoperation/adapters/oracle_enhanced_adapter.rb
activerecord_bulkoperation-0.0.2 lib/activerecord_bulkoperation/adapters/oracle_enhanced_adapter.rb