Author: spadkins
Date: Mon Sep 18 13:04:31 2006
New Revision: 7842
Modified:
p5ee/trunk/App-Repository/lib/App/Repository/MySQL.pm
Log:
add where clause (params) to export_rows()
Modified: p5ee/trunk/App-Repository/lib/App/Repository/MySQL.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository/MySQL.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/Repository/MySQL.pm Mon Sep 18
13:04:31 2006
@@ -365,14 +365,17 @@
sub export_rows {
&App::sub_entry if ($App::trace);
- my ($self, $table, $file, $options) = @_;
+ my ($self, $table, $params, $file, $options) = @_;
if ($options->{method} && $options->{method} eq "basic") {
$self->SUPER::export_rows($table, $file, $options);
}
else {
my $columns = $options->{columns} || $self->{table}{$table}{columns};
- my $sql = "select\n " . join(",\n ", @$columns) . "\ninto outfile
'$file'";
+ 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});