class Fx::Adapters::Sqlserver::Triggers

Fetches defined triggers from the sqlserver connection. @api private

Constants

TRIGGERS_WITH_DEFINITIONS_QUERY

The query must return two attributes, name and definition

Attributes

connection[R]

Public Class Methods

all(*args) click to toggle source

Wraps all as a static facade.

@return [Array<Fx::Trigger>]

# File lib/fx/adapters/sqlserver/triggers.rb, line 26
def self.all(*args)
  new(*args).all
end
new(connection) click to toggle source
# File lib/fx/adapters/sqlserver/triggers.rb, line 30
def initialize(connection)
  @connection = connection
end

Public Instance Methods

all() click to toggle source

All of the triggers that this connection has defined.

@return [Array<Fx::Trigger>]

# File lib/fx/adapters/sqlserver/triggers.rb, line 37
def all
  triggers_from_sqlserver.map { |trigger| to_fx_trigger(trigger) }
end

Private Instance Methods

to_fx_trigger(result) click to toggle source
# File lib/fx/adapters/sqlserver/triggers.rb, line 49
def to_fx_trigger(result)
  Fx::Trigger.new(result)
end
triggers_from_sqlserver() click to toggle source
# File lib/fx/adapters/sqlserver/triggers.rb, line 45
def triggers_from_sqlserver
  connection.exec_query(TRIGGERS_WITH_DEFINITIONS_QUERY)
end