The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Win32::SqlServer::DTS::Package::Step - a Perl class to access Microsoft SQL Server 2000 DTS Package's steps

SYNOPSIS

    use Win32::SqlServer::DTS::Package::Step;

        # previously Win32::SqlServer::DTS::Package recovered
    my $steps   = $package->get_sibling()->Steps;

        foreach my $step ( in( $steps ) ) {

                my $new_step = Win32::SqlServer::DTS::Package::Step->new($step);
                print $new_step->get_exec_status(), "\n";

    }

DESCRIPTION

Win32::SqlServer::DTS::Package::Step implements the DTS Package Step class in Perl. It implements all features of the original class, offering pure Perl interface with some additional methods to easy of use.

You probably will want to deal with this class internals only if you need to extended it or fix a bug. Otherwise, keep to fetching Win32::SqlServer::DTS::Package::Step objects directly from a Win32::SqlServer::DTS::Package object.

EXPORT

Nothing.

METHODS

new

Instantiates a new Win32::SqlServer::DTS::Package::Step object. Expects as a parameter the original DTS Package Step.

Almost all attributes from the original objects (Step and Step2) were implement, except the Parent attribute. This class has a hash that defines the convertion from the original attributes names to those implements in Win32::SqlServer::DTS::Package::Step. It's possible to check them out by looking at the %attrib_convertion hash.

Win32::SqlServer::DTS::Package::Step inherits all methods defined in the DTS class.

read and write attributes

The following attributes have their get_/set_ methods available (for example, name attribute will have a get_name and set_name methods):

  • name

  • task_name

  • script_lang

  • activex

  • description

  • func_name

read only attributes

The following attributes are read only, so they will have only get_ attributes:

  • exec_status_code

  • start_time

  • exec_time

  • finish_time

  • exec_result

is_disable

Returns true if the step is disabled or false otherwise.

disable_step

Disables the step.

Abort program execution if the _sibling attribute is not defined.

enable_step

Enables the step. This changes the Win32::SqlServer::DTS::Package object, that must have it's appropriate methods to save it's state back to the server (or file).

Abort program execution if the _sibling attribute is not defined.

_error_message

"Private" method. It expects a attribute name as a parameter (string) and returns a default error message when trying to update the original Step object when the _sibling attribute is not defined.

set

Overriding Class::Accessor method to check for _sibling attribute. This is used internally by the module and should not be used unless the behaviour of the class must be changed.

get_exec_error_info

Same as GetExecutionErrorInfo method from the original DTS Step object.

Returns a Win32::SqlServer::DTS::Package::Step::Result object. It will fail if the sibling object is not available.

get_exec_status

Returns a string telling the execution status instead of a numeric code as get_exec_status_code does.

Convertion table was fetched from MSDN documentation and reproduced in the package @exec_status array.

add_global_vars

Returns true if the property AddGlobalVariables is enabled, false otherwise.

enable_global_vars

Enable the property AddGlobalVariables.

disable_global_vars

Disable the property AddGlobalVariables.

close_conn

Returns true if the CloseConnection attribute is active, false otherwise.

enable_close_conn

Enables the CloseConnection attribute.

disable_close_conn

Disables the CloseConnection attribute.

fail_on_error

Returns true if the FailPackageOnError attribute is active, false otherwise.

enable_fail_on_error

Enables the FailPackageOnError attribute.

disable_fail_on_error

Enables the FailPackageOnError attribute.

CAVEATS

Any change to Win32::SqlServer::DTS::Package::Step must be saved by using the proper methods in the Win32::SqlServer::DTS::Package object or they will be lost as soons as the Step object is eliminated by the garbage collector.

All methods that changes object state and needs to sincronize with the original DTS Package Step object will abort program execution if the _sibling attribute does not exists or does not have a valid value.

SEE ALSO

  • Win32::OLE at perldoc.

  • Win32::SqlServer::DTS::Package at perldoc to see how to fetch Win32::SqlServer::DTS::Package::Step objects.

  • MSDN on Microsoft website and MS SQL Server 2000 Books Online are a reference about using DTS' object hierarchy, but one will need to convert examples written in VBScript to Perl code. Specially, there is all attributes description there.

AUTHOR

Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Alceu Rodrigues de Freitas Junior

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.