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

Dataset class for Firebird datasets

### Methods

fetch_rows insert insert_returning_pk_sql insert_returning_sql insert_select requires_sql_standard_datetimes? select_clause_methods select_limit_sql supports_intersect_except?

### Constants

BOOL_TRUE | = | '1'.freeze
BOOL_FALSE | = | '0'.freeze
NULL | = | LiteralString.new('NULL').freeze
COMMA_SEPARATOR | = | ', '.freeze
SELECT_CLAUSE_METHODS | = | clause_methods(:select, %w'with distinct limit columns from join where group having compounds order')

### Public Instance methods

fetch_rows(sql) {|h| ...}

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

[Source]

         # File lib/sequel/adapters/firebird.rb, line 211
    211:       def fetch_rows(sql, &block)
    212:         execute(sql) do |s|
    213:           begin
    214:             @columns = s.fields.map{|c| output_identifier(c.name)}
    215:             s.fetchall(:symbols_hash).each do |r|
    216:               h = {}
    217:               r.each{|k,v| h[output_identifier(k)] = v}
    218:               yield h
    219:             end
    220:           ensure
    221:             s.close
    222:           end
    223:         end
    224:         self
    225:       end

insert(*values)

Insert given values into the database.

[Source]

         # File lib/sequel/adapters/firebird.rb, line 228
    228:       def insert(*values)
    229:         if !@opts[:sql]
    230:           clone(default_server_opts(:sql=>insert_returning_pk_sql(*values))).single_value
    231:         else
    232:           execute_insert(insert_sql(*values), :table=>opts[:from].first,
    233:             :values=>values.size == 1 ? values.first : values)
    234:         end
    235:       end

insert_returning_pk_sql(*values)

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

[Source]

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

insert_returning_sql(returning, *values)

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

[Source]

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

insert_select(*values)

Insert a record returning the record inserted

[Source]

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

requires_sql_standard_datetimes?()

[Source]

         # File lib/sequel/adapters/firebird.rb, line 253
    253:       def requires_sql_standard_datetimes?
    254:         true
    255:       end

select_clause_methods()

The order of clauses in the SELECT SQL statement

[Source]

         # File lib/sequel/adapters/firebird.rb, line 258
    258:       def select_clause_methods
    259:         SELECT_CLAUSE_METHODS
    260:       end

select_limit_sql(sql)

[Source]

         # File lib/sequel/adapters/firebird.rb, line 262
    262:       def select_limit_sql(sql)
    263:         sql << " FIRST #{@opts[:limit]}" if @opts[:limit]
    264:         sql << " SKIP #{@opts[:offset]}" if @opts[:offset]
    265:       end

supports_intersect_except?()

Firebird does not support INTERSECT or EXCEPT

[Source]

         # File lib/sequel/adapters/firebird.rb, line 268
    268:       def supports_intersect_except?
    269:         false
    270:       end

[Validate]