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 206
    206:       def fetch_rows(sql)
    207:         execute(sql) do |s|
    208:           begin
    209:             @columns = s.fields.map{|c| output_identifier(c.name)}
    210:             s.fetchall(:symbols_hash).each do |r|
    211:               h = {}
    212:               r.each{|k,v| h[output_identifier(k)] = v}
    213:               yield h
    214:             end
    215:           ensure
    216:             s.close
    217:           end
    218:         end
    219:         self
    220:       end

insert(*values)

Insert given values into the database.

[Source]

         # File lib/sequel/adapters/firebird.rb, line 223
    223:       def insert(*values)
    224:         if !@opts[:sql]
    225:           clone(default_server_opts(:sql=>insert_returning_pk_sql(*values))).single_value
    226:         else
    227:           execute_insert(insert_sql(*values), :table=>opts[:from].first,
    228:             :values=>values.size == 1 ? values.first : values)
    229:         end
    230:       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 233
    233:       def insert_returning_pk_sql(*values)
    234:         pk = db.primary_key(opts[:from].first)
    235:         insert_returning_sql(pk ? Sequel::SQL::Identifier.new(pk) : NULL, *values)
    236:       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 239
    239:       def insert_returning_sql(returning, *values)
    240:         "#{insert_sql(*values)} RETURNING #{column_list(Array(returning))}"
    241:       end

insert_select(*values)

Insert a record returning the record inserted

[Source]

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

requires_sql_standard_datetimes?()

[Source]

         # File lib/sequel/adapters/firebird.rb, line 248
    248:       def requires_sql_standard_datetimes?
    249:         true
    250:       end

select_clause_methods()

The order of clauses in the SELECT SQL statement

[Source]

         # File lib/sequel/adapters/firebird.rb, line 253
    253:       def select_clause_methods
    254:         SELECT_CLAUSE_METHODS
    255:       end

select_limit_sql(sql)

[Source]

         # File lib/sequel/adapters/firebird.rb, line 257
    257:       def select_limit_sql(sql)
    258:         sql << " FIRST #{@opts[:limit]}" if @opts[:limit]
    259:         sql << " SKIP #{@opts[:offset]}" if @opts[:offset]
    260:       end

supports_intersect_except?()

Firebird does not support INTERSECT or EXCEPT

[Source]

         # File lib/sequel/adapters/firebird.rb, line 263
    263:       def supports_intersect_except?
    264:         false
    265:       end

[Validate]