Class: Fx::Adapters::Sqlserver::Triggers Private

Inherits:
Object
  • Object
show all
Defined in:
lib/fx/adapters/sqlserver/triggers.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Fetches defined triggers from the sqlserver connection.

Constant Summary collapse

TRIGGERS_WITH_DEFINITIONS_QUERY =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The query must return two attributes, name and definition

<<-STR
  SELECT
    t.name AS name,
    m.definition AS definition
  FROM sys.triggers t,
      sys.sql_modules m
  WHERE
    t.type = 'TR'
    AND t.object_id = m.object_id
STR

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Triggers

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Triggers.



30
31
32
# File 'lib/fx/adapters/sqlserver/triggers.rb', line 30

def initialize(connection)
  @connection = connection
end

Class Method Details

.all(*args) ⇒ Array<Fx::Trigger>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Wraps #all as a static facade.

Returns:

  • (Array<Fx::Trigger>)


26
27
28
# File 'lib/fx/adapters/sqlserver/triggers.rb', line 26

def self.all(*args)
  new(*args).all
end

Instance Method Details

#allArray<Fx::Trigger>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

All of the triggers that this connection has defined.

Returns:

  • (Array<Fx::Trigger>)


37
38
39
# File 'lib/fx/adapters/sqlserver/triggers.rb', line 37

def all
  triggers_from_sqlserver.map { |trigger| to_fx_trigger(trigger) }
end