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 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
# 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.
# 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.
# 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