| Class | Sequel::SQLite::Dataset |
| In: |
lib/sequel/adapters/sqlite.rb
|
| Parent: | Sequel::Dataset |
| PREPARED_ARG_PLACEHOLDER | = | ':'.freeze |
Execute the given type of statement with the hash of values.
# File lib/sequel/adapters/sqlite.rb, line 264
264: def call(type, bind_vars={}, *values, &block)
265: ps = to_prepared_statement(type, values)
266: ps.extend(BindArgumentMethods)
267: ps.call(bind_vars, &block)
268: end
Yield a hash for each row in the dataset.
# File lib/sequel/adapters/sqlite.rb, line 271
271: def fetch_rows(sql)
272: execute(sql) do |result|
273: i = -1
274: cols = result.columns.map{|c| [output_identifier(c), i+=1]}
275: @columns = cols.map{|c| c.first}
276: result.each do |values|
277: row = {}
278: cols.each{|n,i| row[n] = values[i]}
279: yield row
280: end
281: end
282: 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/sqlite.rb, line 287
287: def prepare(type, name=nil, *values)
288: ps = to_prepared_statement(type, values)
289: ps.extend(PreparedStatementMethods)
290: if name
291: ps.prepared_statement_name = name
292: db.prepared_statements[name] = ps
293: end
294: ps.prepared_sql
295: ps
296: end