Class Sequel::Firebird::Dataset
In: lib/sequel/adapters/firebird.rb
Parent: Sequel::Dataset

Dataset class for Firebird datasets

Methods

Included Modules

UnsupportedIntersectExcept

Constants

BOOL_TRUE = '1'.freeze
BOOL_FALSE = '0'.freeze
NULL = LiteralString.new('NULL').freeze
COMMA_SEPARATOR = ', '.freeze
FIREBIRD_TIMESTAMP_FORMAT = "TIMESTAMP '%Y-%m-%d %H:%M:%S".freeze
SELECT_CLAUSE_ORDER = %w'distinct limit columns from join where group having compounds order'.freeze

Public Instance methods

Yield all rows returned by executing the given SQL and converting the types.

[Source]

     # File lib/sequel/adapters/firebird.rb, line 231
231:       def fetch_rows(sql, &block)
232:         execute(sql) do |s|
233:           begin
234:             @columns = s.fields.map{|c| output_identifier(c.name)}
235:             s.fetchall(:symbols_hash).each do |r|
236:               h = {}
237:               r.each{|k,v| h[output_identifier(k)] = v}
238:               yield h
239:             end
240:           ensure
241:             s.close
242:           end
243:         end
244:         self
245:       end

Insert given values into the database.

[Source]

     # File lib/sequel/adapters/firebird.rb, line 248
248:       def insert(*values)
249:         if !@opts[:sql]
250:           clone(default_server_opts(:sql=>insert_returning_pk_sql(*values))).single_value
251:         else
252:           execute_insert(insert_sql(*values), :table=>opts[:from].first,
253:             :values=>values.size == 1 ? values.first : values)
254:         end
255:       end

Use the RETURNING clause to return the primary key of the inserted record, if it exists

[Source]

     # File lib/sequel/adapters/firebird.rb, line 258
258:       def insert_returning_pk_sql(*values)
259:         pk = db.primary_key(opts[:from].first)
260:         insert_returning_sql(pk ? Sequel::SQL::Identifier.new(pk) : NULL, *values)
261:       end

Use the RETURNING clause to return the columns listed in returning.

[Source]

     # File lib/sequel/adapters/firebird.rb, line 264
264:       def insert_returning_sql(returning, *values)
265:         "#{insert_sql(*values)} RETURNING #{column_list(Array(returning))}"
266:       end

Insert a record returning the record inserted

[Source]

     # File lib/sequel/adapters/firebird.rb, line 269
269:       def insert_select(*values)
270:         naked.clone(default_server_opts(:sql=>insert_returning_sql(nil, *values))).single_record
271:       end

The order of clauses in the SELECT SQL statement

[Source]

     # File lib/sequel/adapters/firebird.rb, line 274
274:       def select_clause_order
275:         SELECT_CLAUSE_ORDER
276:       end

[Source]

     # File lib/sequel/adapters/firebird.rb, line 278
278:       def select_limit_sql(sql, opts)
279:         sql << " FIRST #{opts[:limit]}" if opts[:limit]
280:         sql << " SKIP #{opts[:offset]}" if opts[:offset]
281:       end

[Validate]