DBIx-BulkUtil
view release on metacpan or search on metacpan
lib/DBIx/BulkUtil.pm view on Meta::CPAN
=item DslOptions
A string or arrayref of connect options to add to the dsl connect string.
E.g.:
DBIx::BulkUtil->connect(
Server => $server,
DslOptions => [ 'interfaces=/my/interfaces_file', 'port=1234' ],
);
Will result in the connect string:
'dbi:Sybase:server=<server_name>;interfaces=/my/interfaces_file;port=1234'
=item NoServer
For Sybase, will not add the 'server=...' argument to the DSL connect string.
For Oracle will not add the database name to the DSL string. The DslOptions
option is necessary if this option is used.
=back
=item connect_cached()
Same as connect method, but calls the DBI connect_cached method to make
the actual database connection, and will return the same database handle
previously returned for the same database, user, and DBI options.
=item syb_connect()
Same as connect method, but calls the DBIx::BulkUtil connect method with the Type option set to 'Sybase'
=item ora_connect()
Same as connect method, but calls the DBIx::BulkUtil connect method with the Type option set to 'Oracle'
=item ora_connect_cached()
Same as connect method, but calls the DBIx::BulkUtil connect_cached method with the Type option set to 'Oracle'
=item iq_connect()
Same as connect method, but calls the DBIx::BulkUtil connect method with the Type option set to 'SybaseIQ'
=item iq_connect_cached()
Same as connect method, but calls the DBIx::BulkUtil connect_cached method with the Type option set to 'SybaseIQ'
=item passwd()
Dummy function to override for determining password.
=back
=head1 UTILITY OBJECT METHODS
Methods that may be called on the utility object that is optionally returned
from the connect or connect_cached DBIX::BulkUtil class methods. These methods
provide convenience and/or make some operations between Oracle and Sybase
databases more transparent.
=over 4
=item now
Returns sql that will return the current date/time of the database (e.g.
to be used as a column in a select statement).
=item add
Returns sql that will add some unit of time to a datetime expression.
E.g. $util->add($util->now(), 10, 'hour') adds 10 hours to the current time.
=item row_select
Given just a select clause (the part after the "SELECT" keyword),
returns sql to select a row from no table (e.g. for fetching the
current time from the database).
=item get
Fetches the row from a select clause with no table. E.g.
$ect_util->get($ect_util->now()) returns the current database date/time.
=item obj_type
Returns T/V/P depending on whether the given object is a Table, View, or
Procedure.
=item sp_sql
Returns sql to execute a given stored procedure with arguments. If
one of the arguments is ":cursor", then for Sybase it is filtered out,
for Oracle we assume it is a parameter name and not a literal
string to be bound.
Sybase stored procedures can return multiple result sets, and also
a list of output parameters. Oracle does not return result sets, but
you can pass in a cursor as an output parameter. When you pass in a
parameter ":cursor", we assume its an output parameter that will
hold a statement handle, so you can return a single result set in a
nearly "backwards compatible" way. But we don't handle "multiple" result
sets (yet), we don't deal with other output parameters, and so this
this method is not meant to be completely transparent for
all stored procedures.
=item sp_sth
Prepares and executes a stored procedure with arguments, and returns
a statement handle for fetching. If one of the arguments is ":cursor",
then we assume for Oracle it is a cursor type output parameter, and the
statement handle for the cursor is returned. For Sybase, we ignore any
":cursor" argument.
=item bcp_in
For Sybase, uses BCP, for Oracle, SQL Loader, to load a pipe-delimited file
into a database table. If the last argument is a hash reference, then
additional options may be specified. Current options are:
=over 8
=item Delimiter
Specifies the delimiter in the bcp file (default: "|").
=item RowDelimiter
Specifies the record terminator in the bcp file (default: "\n").
=item Header
For bcp_in, the number of rows to ignore at the start of the file.
For bcp_out, if true, the first row will be the column names of the table.
=item DirectPath
For Oracle only, if true, does Direct path instead of conventional load.
If value is 'P', also does parallel load. For parallel loads, indexes
are not rebuilt after the load.
=item Constants
(Oracle and SybaseIQ only). A hashref of column names and constant values to
set the columns to which are not in the file.
=item FieldRef
(Oracle only). A hashref of column names and sqlldr expressions to specify the
value of the column. If the expression includes the column itself (e.g. ':column_name'),
then the field will appear in the same position in the control file corresponding
to its position in the table. If it does not (e.g. "to_date('2014-02-01','YYYY-MM-DD')"),
then the column appears at the end of the control file field list (i.e. it assumes the
column is not in the file).
Also, if the expression begins with "~", then assume the expression is position
information for a fixed width file.
=item Filler
Generally used with the ColumnList option, a list of column names
in the file which are filler and not loaded into the database.
=item Default
( run in 2.299 seconds using v1.01-cache-2.11-cpan-fe3c2283af0 )