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 229
229:       def fetch_rows(sql, &block)
230:         execute(sql) do |s|
231:           begin
232:             @columns = s.fields.map{|c| output_identifier(c.name)}
233:             s.fetchall(:symbols_hash).each do |r|
234:               h = {}
235:               r.each{|k,v| h[output_identifier(k)] = v}
236:               yield h
237:             end
238:           ensure
239:             s.close
240:           end
241:         end
242:         self
243:       end

Insert given values into the database.

[Source]

     # File lib/sequel/adapters/firebird.rb, line 246
246:       def insert(*values)
247:         if !@opts[:sql]
248:           clone(default_server_opts(:sql=>insert_returning_pk_sql(*values))).single_value
249:         else
250:           execute_insert(insert_sql(*values), :table=>opts[:from].first,
251:             :values=>values.size == 1 ? values.first : values)
252:         end
253:       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 256
256:       def insert_returning_pk_sql(*values)
257:         pk = db.primary_key(opts[:from].first)
258:         insert_returning_sql(pk ? Sequel::SQL::Identifier.new(pk) : NULL, *values)
259:       end

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

[Source]

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

Insert a record returning the record inserted

[Source]

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

The order of clauses in the SELECT SQL statement

[Source]

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

[Source]

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

[Validate]