class Sequel::ADO::Dataset

Public Instance Methods

fetch_rows(sql) { |h| ... } click to toggle source
    # File lib/sequel/adapters/ado.rb
231 def fetch_rows(sql)
232   execute(sql) do |recordset|
233     cols = []
234     conversion_procs = db.conversion_procs
235 
236     ts_cp = nil
237     recordset.Fields.each do |field|
238       type = field.Type
239       cp = if type == AdDBTimeStamp
240         ts_cp ||= begin
241           nsec_div = 1000000000.0/(10**(timestamp_precision))
242           nsec_mul = 10**(timestamp_precision+3)
243           meth = db.method(:to_application_timestamp)
244           lambda do |v|
245             # Fractional second handling is not correct on ruby <2.2
246             meth.call([v.year, v.month, v.day, v.hour, v.min, v.sec, (v.nsec/nsec_div).round * nsec_mul])
247           end
248         end
249       else
250         conversion_procs[type]
251       end
252       cols << [output_identifier(field.Name), cp]
253     end
254 
255     self.columns = cols.map(&:first)
256     return if recordset.EOF
257     max = cols.length
258 
259     recordset.GetRows.transpose.each do |field_values|
260       h = {}
261 
262       i = -1
263       while (i += 1) < max
264         name, cp = cols[i]
265         h[name] = if (v = field_values[i]) && cp
266           cp.call(v)
267         else
268           v
269         end
270       end
271       
272       yield h
273     end
274   end
275 end
provides_accurate_rows_matched?() click to toggle source

ADO can return for for delete and update statements, depending on the provider.

    # File lib/sequel/adapters/ado.rb
278 def provides_accurate_rows_matched?
279   false
280 end