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

Dataset class for Firebird datasets

Methods

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

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, &block)
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 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

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

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

[Source]

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

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

[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

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]