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:         log_info(sql)
    47:         begin
    48:           synchronize(opts[:server]) do |conn|
    49:             r = conn.execute(sql)
    50:             yield(r) if block_given?
    51:             r
    52:           end
    53:         rescue => e
    54:           log_info(e.message)
    55:           raise_error(e, :classes=>[Fb::Error])
    56:         end
    57:       end

primary_key(table, server=nil)

Return primary key for the given table.

[Source]

        # File lib/sequel/adapters/firebird.rb, line 60
    60:       def primary_key(table, server=nil)
    61:         synchronize(server){|conn| primary_key_for_table(conn, table)}
    62:       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 67
    67:       def primary_key_for_table(conn, table)
    68:         @primary_keys[quote_identifier(table)] ||= conn.table_primary_key(quote_identifier(table))
    69:       end

restart_sequence(*args)

[Source]

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

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

[Source]

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

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

[Source]

        # File lib/sequel/adapters/firebird.rb, line 80
    80:       def tables(opts={})
    81:         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")
    82:         block_given? ? yield(ds) : ds.map{|r| ds.send(:output_identifier, r["rdb$relation_name""rdb$relation_name"])}
    83:       end

[Validate]