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

NAME

Win32::SqlServer::DTS::Application - a Perl class to emulate Microsoft SQL Server 2000 DTS Application object

SYNOPSIS

    use Win32::SqlServer::DTS::Application;

    my $app = Win32::SqlServer::DTS::Application->new( 
               { 
                   server                 => $server, 
                   user                   => $user, 
                   password               => $password, 
                   use_trusted_connection => 0 
               }
    );

    # fetchs a list of packages
    my @list = qw( LoadData ChangeData ExportData);

    foreach my $name ( @list ) {

        my $package = $self->get_db_package( { name => $name } ) );
        print $package->to_string;

    }

DESCRIPTION

This Perl class represents the Application object from the MS SQL Server 2000 API. Before fetching any package from a server one must instantiate a Win32::SqlServer::DTS::Application object that will provide methods to fetch packages without having to provide autentication each time.

EXPORT

None by default.

METHODS

new

Instantiate a new object from Win32::SqlServer::DTS::Application class. The expected parameter is a hash reference with the following keys:

  • server: the name of a database server already configured in the Enterprise Manager.

  • user: a string of the user used to authenticate against the database server. Not necessary to specify if use_trusted_connection is true.

  • password: a string of the password used to authenticate against the database server. Not necessary to specify if use_trusted_connection is true.

  • use_trusted_connection: a true/false value (1 or 0, respectivally) to specify if a Trusted Connection will be the authentication method to be used.

See SYNOPSIS for an example.

get_db_package

Fetchs a single package from a MS SQL server and returns a respective Win32::SqlServer::DTS::Package object. Expects a hash reference as a parameter, having the following keys defined:

  • id: the uniq package ID. Obligatory if a package name is not provided.

  • version_id: the version ID of the package. If not provided, the last version of the package will be fetched.

  • name: the name of the package. Obligatory if a package id is not provided.

  • package_password: the password used to restrict access to the package. Not obligatory if no password is used.

get_db_package_regex

Expect an regular expression as a parameter. The regular expression is case sensitive.

Returns a Win32::SqlServer::DTS::Package object which name matches the regular expression passed as an argument. Only one object is returned (the first one in a sorted list) even if there are more packages names that matches.

regex_pkgs_names

Expect an string, as regular expression, as a parameter. The parameter is case insensitive and the string is compiled internally in the method, so there is not need to use qr or something like that to increase performance.

Returns an array reference with all the packages names that matched the regular expression passed as an argument.

list_pkgs_names

Returns an array reference with all the packages names available in the database of the MS SQL Server. The items in the array are sorted for convenience.

CAVEATS

Several methods from MS SQL Server DTS Application class were not implemented, specially those available in PackageSQLServer and PackageRepository classes.

SEE ALSO

  • Win32::OLE at perldoc.

  • 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.

AUTHOR

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

COPYRIGHT AND LICENSE

Copyright (C) 2006 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.