module Sequel::Firebird::DatasetMethods

Constants

BOOL_FALSE
BOOL_TRUE
DEFAULT_FROM
FIRST
NULL
SKIP

Public Instance Methods

insert(*values) click to toggle source

Insert given values into the database.

Calls superclass method
# File lib/sequel/adapters/shared/firebird.rb, line 172
def insert(*values)
  if @opts[:sql] || @opts[:returning]
    super
  else
    returning(insert_pk).insert(*values){|r| return r.values.first}
  end
end
insert_select(*values) click to toggle source

Insert a record returning the record inserted

# File lib/sequel/adapters/shared/firebird.rb, line 181
def insert_select(*values)
  with_sql_first(insert_select_sql(*values))
end
insert_select_sql(*values) click to toggle source

The SQL to use for an #insert_select, adds a RETURNING clause to the insert unless the RETURNING clause is already present.

# File lib/sequel/adapters/shared/firebird.rb, line 187
def insert_select_sql(*values)
  ds = opts[:returning] ? self : returning
  ds.insert_sql(*values)
end
requires_sql_standard_datetimes?() click to toggle source
# File lib/sequel/adapters/shared/firebird.rb, line 192
def requires_sql_standard_datetimes?
  true
end
supports_cte?(type=:select) click to toggle source
# File lib/sequel/adapters/shared/firebird.rb, line 196
def supports_cte?(type=:select)
  type == :select
end
supports_insert_select?() click to toggle source
# File lib/sequel/adapters/shared/firebird.rb, line 200
def supports_insert_select?
  true
end
supports_intersect_except?() click to toggle source

Firebird does not support INTERSECT or EXCEPT

# File lib/sequel/adapters/shared/firebird.rb, line 205
def supports_intersect_except?
  false
end
supports_returning?(type) click to toggle source
# File lib/sequel/adapters/shared/firebird.rb, line 209
def supports_returning?(type)
  type == :insert
end

Private Instance Methods

empty_from_sql() click to toggle source
# File lib/sequel/adapters/shared/firebird.rb, line 215
def empty_from_sql
  DEFAULT_FROM
end
insert_pk(*values) click to toggle source
# File lib/sequel/adapters/shared/firebird.rb, line 219
def insert_pk(*values)
  pk = db.primary_key(opts[:from].first)
  pk ? Sequel::SQL::Identifier.new(pk) : NULL
end
literal_false() click to toggle source
# File lib/sequel/adapters/shared/firebird.rb, line 224
def literal_false
  BOOL_FALSE
end
literal_true() click to toggle source
# File lib/sequel/adapters/shared/firebird.rb, line 228
def literal_true
  BOOL_TRUE
end
multi_insert_sql_strategy() click to toggle source

Firebird can insert multiple rows using a UNION

# File lib/sequel/adapters/shared/firebird.rb, line 233
def multi_insert_sql_strategy
  :union
end
select_limit_sql(sql) click to toggle source
# File lib/sequel/adapters/shared/firebird.rb, line 237
def select_limit_sql(sql)
  if l = @opts[:limit]
    sql << FIRST
    literal_append(sql, l)
  end
  if o = @opts[:offset]
    sql << SKIP
    literal_append(sql, o)
  end
end