Package DE_EPAGES::ShopTransfer::API::BCP
Helper functions for the shop transfer script. These functions export shop data from the database into text files, one file per database table. The file format is similar to CSV, but without quoting - therefore the field separator and record separator must never be included in the actual data. NULL values are represented by empty strings.
@EXPORT_OK |
Functions
BCPInCommand
Imports a file to database, the $Parameter can be build via GetBcpParameter.
Syntax |
$BcpExitCode = BCPInCommand($FileName, $DBName, $Table, $Parameter); |
Example |
$BcpExitCode = BCPInCommand($FileName, $DBName, $Table, GetBcpParameter($Server, $User, $Password, $FilePath, $Encoding)); |
Input |
|
Return |
|
BCPInIterator
Reads a bcp file and executes the cIterator on each row.
Syntax |
BCPInIterator($FileName, $cIterator, $Encoding); |
Example |
BCPInIterator($FileName, sub { my @Row = @_; }, $Encoding)); |
Input |
|
BCPOutMapper
Read and Writes bcp files, all lines are converted via mapping.
Syntax |
BCPOutMapper($SourceFileName, $TargetFileName, $cMap, $Encoding); |
Input |
|
BCPOutStatement
Writes a bcp file, lines are rows of the result of statement.
Syntax |
BCPOutStatement($FileName, $sth, $Encoding); |
Example |
my $dbi = GetCurrentDBHandle(); my $dbh = $dbi->dbh; my $sth = $dbh->prepare('select * from object'); $sth->execute(); BCPOutStatement($FileName, $sth, $Encoding); $sth->finish(); |
Input |
|
GetBcpParameter
Read and Writes bcp files, all lines are converted via mapping.
Syntax |
$Parameter = GetBcpParameter($Server, $User, $Password, $FilePath, $Encoding); |
Input |
|
Return |
|