| Class | Sequel::Oracle::Dataset |
| In: |
lib/sequel/adapters/oracle.rb
|
| Parent: | Sequel::Dataset |
| DatasetClass | = | self |
| PREPARED_ARG_PLACEHOLDER | = | ':'.freeze |
Execute the given type of statement with the hash of values.
# File lib/sequel/adapters/oracle.rb, line 357
357: def call(type, bind_vars={}, *values, &block)
358: ps = to_prepared_statement(type, values)
359: ps.extend(BindArgumentMethods)
360: ps.call(bind_vars, &block)
361: end
# File lib/sequel/adapters/oracle.rb, line 376
376: def fetch_rows(sql)
377: execute(sql) do |cursor|
378: offset = @opts[:offset]
379: rn = row_number_column
380: cps = db.conversion_procs
381: cols = columns = cursor.get_col_names.map{|c| output_identifier(c)}
382: metadata = cursor.column_metadata
383: cm = cols.zip(metadata).map{|c, m| [c, cps[m.data_type]]}
384: columns = cols.reject{|x| x == rn} if offset
385: @columns = columns
386: while r = cursor.fetch
387: row = {}
388: r.zip(cm).each{|v, (c, cp)| row[c] = ((v && cp) ? cp.call(v) : v)}
389: row.delete(rn) if offset
390: yield row
391: end
392: end
393: self
394: end
Prepare the given type of query with the given name and store it in the database. Note that a new native prepared statement is created on each call to this prepared statement.
# File lib/sequel/adapters/oracle.rb, line 366
366: def prepare(type, name=nil, *values)
367: ps = to_prepared_statement(type, values)
368: ps.extend(PreparedStatementMethods)
369: if name
370: ps.prepared_statement_name = name
371: db.prepared_statements[name] = ps
372: end
373: ps
374: end
Create a named prepared statement that is stored in the database (and connection) for reuse.
# File lib/sequel/adapters/oracle.rb, line 398
398: def prepare(type, name=nil, *values)
399: ps = to_prepared_statement(type, values)
400: ps.extend(PreparedStatementMethods)
401: if name
402: ps.prepared_statement_name = name
403: db.prepared_statements[name] = ps
404: end
405: ps
406: end