App-Repository
view release on metacpan or search on metacpan
lib/App/Repository/MySQL.pm view on Meta::CPAN
# [SET col_name = expr,...)]
sub import_rows {
&App::sub_entry if ($App::trace);
my ($self, $table, $columns, $file, $options) = @_;
$columns = $self->_get_default_columns($table) if (!$columns);
my $nrows = 0;
my $import_method = $options->{import_method} || $self->{import_method} || "";
if ($import_method eq "basic") {
$nrows = $self->SUPER::import_rows($table, $columns, $file, $options);
}
elsif ($import_method eq "insert") {
$nrows = $self->insert_rows($table, $columns, $file, $options);
}
elsif ($import_method eq "insert_mysql") {
$nrows = $self->insert_rows_mysql($table, $columns, $file, $options);
}
else {
my $local = $options->{local};
$local = 1 if (!defined $local);
lib/App/Repository/MySQL.pm view on Meta::CPAN
# [ASC | DESC] , ...]
# [LIMIT {[offset,] row_count | row_count OFFSET offset}]
# [PROCEDURE procedure_name(argument_list)]
# [FOR UPDATE | LOCK IN SHARE MODE]]
sub export_rows {
&App::sub_entry if ($App::trace);
my ($self, $table, $params, $file, $options) = @_;
if ($options->{export_method} && $options->{export_method} eq "basic") {
$self->SUPER::export_rows($table, $file, $options);
}
else {
my $columns = $options->{columns} || $self->{table}{$table}{columns};
my $where_clause = $self->_mk_where_clause($table, $params, $options);
my $sql = "select\n " . join(",\n ", @$columns);
$sql .= "\n$where_clause" if ($where_clause);
$sql .= "\ninto outfile '$file'";
if ($options->{field_sep} || $options->{field_quote} || $options->{field_escape}) {
$sql .= "\nfields";
$sql .= "\n terminated by '$options->{field_sep}'" if ($options->{field_sep});
lib/App/SessionObject/RepositoryObjectSet.pm view on Meta::CPAN
=cut
###########################################################################
# Support Routines
###########################################################################
sub _init {
&App::sub_entry if ($App::trace);
my ($self, $args) = @_;
$self->SUPER::_init();
my $table = $self->{table} || die "table not defined";
$self->_clear_cache_if_auto_params_changed() if ($self->{auto_params}); # sets params from auto_params
$self->_clear_cache_if_auto_columns_changed() if ($self->{auto_columns}); # sets columns from auto_columns
if (!$self->{columns} && !$self->{temporary}) {
my $context = $self->{context};
my $repname = $self->{repository};
my $rep = $context->repository($repname);
$self->{columns} = $rep->_get_default_columns($table);
}
&App::sub_exit() if ($App::trace);
( run in 0.221 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )