lib/active_record/connection_adapters/oracle_enhanced_database_statements.rb
def exec_insert(sql, name, binds, pk = nil, sequence_name = nil)
        type_casted_binds = binds.map { |col, val|
          [col, type_cast(val, col)]
        }
        log(sql, name, type_casted_binds) do
          returning_id_col = returning_id_index = nil
          if without_prepared_statement?(binds)
            cursor = @connection.prepare(sql)
          else
            unless @statements.key? (sql)
              @statements[sql] = @connection.prepare(sql)
            end

            cursor = @statements[sql]

            binds.each_with_index do |bind, i|
              col, val = bind
              if col.returning_id?
                returning_id_col = [col]
                returning_id_index = i + 1
                cursor.bind_returning_param(returning_id_index, Integer)
              else
                cursor.bind_param(i + 1, type_cast(val, col), col)
              end
            end
          end

          cursor.exec_update

          rows = []
          if returning_id_index
            returning_id = cursor.get_returning_param(returning_id_index, Integer)
            rows << [returning_id]
          end
          ActiveRecord::Result.new(returning_id_col || [], rows)
        end
      end
# New method in ActiveRecord 3.1
New method in ActiveRecord 3.1
New method in ActiveRecord 3 . 1
def exec_insert(sql, name, binds, pk = nil, sequence_name = nil)
        type_casted_binds = binds.map { |col, val|
          [col, type_cast(val, col)]
        }
        log(sql, name, type_casted_binds) do
          returning_id_col = returning_id_index = nil
          if without_prepared_statement?(binds)
            cursor = @connection.prepare(sql)
          else
            unless @statements.key? (sql)
              @statements[sql] = @connection.prepare(sql)
            end
            cursor = @statements[sql]
            binds.each_with_index do |bind, i|
              col, val = bind
              if col.returning_id?
                returning_id_col = [col]
                returning_id_index = i + 1
                cursor.bind_returning_param(returning_id_index, Integer)
              else
                cursor.bind_param(i + 1, type_cast(val, col), col)
              end
            end
          end
          cursor.exec_update
          rows = []
          if returning_id_index
            returning_id = cursor.get_returning_param(returning_id_index, Integer)
            rows << [returning_id]
          end
          ActiveRecord::Result.new(returning_id_col || [], rows)
        end
      end
def exec_insert ( sql , name , binds , pk = nil , sequence_name = nil ) type_casted_binds = binds . map { | col , val | [ col , type_cast ( val , col ) ] } log ( sql , name , type_casted_binds ) do returning_id_col = returning_id_index = nil if without_prepared_statement? ( binds ) cursor = @connection . prepare ( sql ) else unless @statements . key? ( sql ) @statements [ sql ] = @connection . prepare ( sql ) end cursor = @statements [ sql ] binds . each_with_index do | bind , i | col , val = bind if col . returning_id? returning_id_col = [ col ] returning_id_index = i + 1 cursor . bind_returning_param ( returning_id_index , Integer ) else cursor . bind_param ( i + 1 , type_cast ( val , col ) , col ) end end end cursor . exec_update rows = [ ] if returning_id_index returning_id = cursor . get_returning_param ( returning_id_index , Integer ) rows << [ returning_id ] end ActiveRecord :: Result . new ( returning_id_col || [ ] , rows ) end end
New method in ActiveRecord 3.1
New method in ActiveRecord 3 . 1
sql
name
binds
pk
sequence_name