lib/arjdbc/sqlite3/adapter.rb
# DIFFERENCE: Some common constant names to reduce differences in rest of this module from AR5 version
Some common constant names to reduce differences in rest of this module from AR5 version
Some common constant names to reduce differences in rest of this module from AR5 version
def exec_query(sql, name = nil, binds = [], prepare: false)
      type_casted_binds = binds.map { |attr| type_cast(attr.value_for_database) }
      log(sql, name, binds) do
        unless prepare
          stmt    = @connection.prepare(sql)
          begin
            cols    = stmt.columns
            unless without_prepared_statement?(binds)
              stmt.bind_params(type_casted_binds)
            end
            records = stmt.to_a
          ensure
            stmt.close
          end
          stmt = records
        else
          cache = @statements[sql] ||= {
              :stmt => @connection.prepare(sql)
          }
          stmt = cache[:stmt]
          cols = cache[:cols] ||= stmt.columns
          stmt.reset!
          stmt.bind_params(type_casted_binds)
        end
        ActiveRecord::Result.new(cols, stmt.to_a)
      end
    end
def exec_query ( sql , name = nil , binds = [ ] , prepare : false ) type_casted_binds = binds . map { | attr | type_cast ( attr . value_for_database ) } log ( sql , name , binds ) do unless prepare stmt = @connection . prepare ( sql ) begin cols = stmt . columns unless without_prepared_statement? ( binds ) stmt . bind_params ( type_casted_binds ) end records = stmt . to_a ensure stmt . close end stmt = records else cache = @statements [ sql ] ||= { :stmt => @connection . prepare ( sql ) } stmt = cache [ :stmt ] cols = cache [ :cols ] ||= stmt . columns stmt . reset! stmt . bind_params ( type_casted_binds ) end ActiveRecord :: Result . new ( cols , stmt . to_a ) end end
DIFFERENCE: Some common constant names to reduce differences in rest of this module from AR5 version
DIFFERENCE : Some common constant names to reduce differences in rest of this module from AR5 version
# Don't cache statements if they are not prepared
sql
<not_specific>
name
<not_specific>
binds
<not_specific>
prepare
<not_specific>