Class Sequel::Oracle::Dataset
In: lib/sequel/adapters/oracle.rb
Parent: Sequel::Dataset

Methods

Included Modules

DatasetMethods

Classes and Modules

Module Sequel::Oracle::Dataset::ArgumentMapper
Module Sequel::Oracle::Dataset::BindArgumentMethods
Module Sequel::Oracle::Dataset::PreparedStatementMethods

Constants

DatasetClass = self
PREPARED_ARG_PLACEHOLDER = ':'.freeze

Public Instance methods

Execute the given type of statement with the hash of values.

[Source]

     # File lib/sequel/adapters/oracle.rb, line 361
361:       def call(type, bind_vars={}, *values, &block)
362:         ps = to_prepared_statement(type, values)
363:         ps.extend(BindArgumentMethods)
364:         ps.call(bind_vars, &block)
365:       end

[Source]

     # File lib/sequel/adapters/oracle.rb, line 380
380:       def fetch_rows(sql)
381:         execute(sql) do |cursor|
382:           offset = @opts[:offset]
383:           rn = row_number_column
384:           cps = db.conversion_procs
385:           cols = columns = cursor.get_col_names.map{|c| output_identifier(c)}
386:           metadata = cursor.column_metadata
387:           cm = cols.zip(metadata).map{|c, m| [c, cps[m.data_type]]}
388:           columns = cols.reject{|x| x == rn} if offset
389:           @columns = columns
390:           while r = cursor.fetch
391:             row = {}
392:             r.zip(cm).each{|v, (c, cp)| row[c] = ((v && cp) ? cp.call(v) : v)}
393:             row.delete(rn) if offset
394:             yield row
395:           end
396:         end
397:         self
398:       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.

[Source]

     # File lib/sequel/adapters/oracle.rb, line 370
370:       def prepare(type, name=nil, *values)
371:         ps = to_prepared_statement(type, values)
372:         ps.extend(PreparedStatementMethods)
373:         if name
374:           ps.prepared_statement_name = name
375:           db.prepared_statements[name] = ps
376:         end
377:         ps
378:       end

Create a named prepared statement that is stored in the database (and connection) for reuse.

[Source]

     # File lib/sequel/adapters/oracle.rb, line 402
402:       def prepare(type, name=nil, *values)
403:         ps = to_prepared_statement(type, values)
404:         ps.extend(PreparedStatementMethods)
405:         if name
406:           ps.prepared_statement_name = name
407:           db.prepared_statements[name] = ps
408:         end
409:         ps
410:       end

Oracle requires type specifiers for placeholders, at least if you ever want to use a nil/NULL value as the value for the placeholder.

[Source]

     # File lib/sequel/adapters/oracle.rb, line 415
415:       def requires_placeholder_type_specifiers?
416:         true
417:       end

[Validate]