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 select_clause_order select_limit_sql

### 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

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 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(*values)

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

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 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

insert_returning_sql(returning, *values)

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_select(*values)

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

select_clause_order()

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

select_limit_sql(sql)

[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]