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

### Methods

connect create_trigger dataset drop_sequence execute new primary_key primary_key_for_table restart_sequence sequences tables

### Constants

AUTO_INCREMENT | = | ''.freeze
TEMPORARY | = | 'GLOBAL TEMPORARY '.freeze

### Public Class methods

new(*args)

Add the primary_keys and primary_key_sequences instance variables, so we can get the correct return values for inserted rows.

[Source]

        # File lib/sequel/adapters/firebird.rb, line 15
    15:       def initialize(*args)
    16:         super
    17:         @primary_keys = {}
    18:         @primary_key_sequences = {}
    19:       end

### Public Instance methods

connect(server)

[Source]

        # File lib/sequel/adapters/firebird.rb, line 21
    21:       def connect(server)
    22:         opts = server_opts(server)
    23:
    24:         db = Fb::Database.new(
    25:           :database => "#{opts[:host]}:#{opts[:database]}",
    26:           :username => opts[:user],
    27:           :password => opts[:password])
    28:         conn = db.connect
    29:         conn.downcase_names = true
    30:         conn
    31:       end

create_trigger(*args)

[Source]

        # File lib/sequel/adapters/firebird.rb, line 33
    33:       def create_trigger(*args)
    34:         self << create_trigger_sql(*args)
    35:       end

dataset(opts = nil)

[Source]

        # File lib/sequel/adapters/firebird.rb, line 37
    37:       def dataset(opts = nil)
    38:         Firebird::Dataset.new(self, opts)
    39:       end

drop_sequence(name)

[Source]

        # File lib/sequel/adapters/firebird.rb, line 41
    41:       def drop_sequence(name)
    42:         self << drop_sequence_sql(name)
    43:       end

execute(sql, opts={}) {|r| ...}

[Source]

        # File lib/sequel/adapters/firebird.rb, line 45
    45:       def execute(sql, opts={})
    46:         begin
    47:           synchronize(opts[:server]) do |conn|
    48:             r = log_yield(sql){conn.execute(sql)}
    49:             yield(r) if block_given?
    50:             r
    51:           end
    52:         rescue => e
    53:           raise_error(e, :classes=>[Fb::Error])
    54:         end
    55:       end

primary_key(table, server=nil)

Return primary key for the given table.

[Source]

        # File lib/sequel/adapters/firebird.rb, line 58
    58:       def primary_key(table, server=nil)
    59:         synchronize(server){|conn| primary_key_for_table(conn, table)}
    60:       end

primary_key_for_table(conn, table)

Returns primary key for the given table. This information is cached, and if the primary key for a table is changed, the @primary_keys instance variable should be reset manually.

[Source]

        # File lib/sequel/adapters/firebird.rb, line 65
    65:       def primary_key_for_table(conn, table)
    66:         @primary_keys[quote_identifier(table)] ||= conn.table_primary_key(quote_identifier(table))
    67:       end

restart_sequence(*args)

[Source]

        # File lib/sequel/adapters/firebird.rb, line 69
    69:       def restart_sequence(*args)
    70:         self << restart_sequence_sql(*args)
    71:       end

sequences(opts={}) {|ds| ...}

[Source]

        # File lib/sequel/adapters/firebird.rb, line 73
    73:       def sequences(opts={})
    74:         ds = self["rdb$generators""rdb$generators"].server(opts[:server]).filter("rdb$system_flag""rdb$system_flag" => 0).select("rdb$generator_name""rdb$generator_name")
    75:         block_given? ? yield(ds) : ds.map{|r| ds.send(:output_identifier, r["rdb$generator_name""rdb$generator_name"])}
    76:       end

tables(opts={}) {|ds| ...}

[Source]

        # File lib/sequel/adapters/firebird.rb, line 78
    78:       def tables(opts={})
    79:         ds = self["rdb$relations""rdb$relations"].server(opts[:server]).filter("rdb$view_blr""rdb$view_blr" => nil, Sequel::SQL::Function.new(:COALESCE, "rdb$system_flag""rdb$system_flag", 0) => 0).select("rdb$relation_name""rdb$relation_name")
    80:         block_given? ? yield(ds) : ds.map{|r| ds.send(:output_identifier, r["rdb$relation_name""rdb$relation_name"])}
    81:       end

[Validate]