| version 1.34, 2008/08/23 19:21:26 |
version 1.35, 2008/08/23 20:40:12 |
|
|
| #!/usr/bin/perl |
#!/usr/bin/perl |
| |
|
| # $Platon: scripts/perl/oracle/oracledump.pl,v 1.33 2008-08-23 18:54:00 nepto Exp $ |
# $Platon: scripts/perl/oracle/oracledump.pl,v 1.34 2008-08-23 19:21:26 nepto Exp $ |
| |
|
| use strict; |
use strict; |
| |
|
| Line 391 foreach $table (@opt_tables) |
|
| Line 391 foreach $table (@opt_tables) |
|
| my @column_types; |
my @column_types; |
| my @row; |
my @row; |
| my $table_out; |
my $table_out; |
| |
my $table_for_select; |
| |
my $record_count; |
| |
|
| |
|
| |
$table_for_select = $table; |
| |
if (defined $opt_owner) { |
| |
$table_for_select = "$opt_owner.$table"; |
| |
} |
| |
|
| |
## Check number of record |
| |
|
| |
$query = 'SELECT COUNT(*) FROM '.$table_for_select; |
| |
$sth = $dbh->prepare($query); |
| |
$sth->execute() || die $DBI::errstr; |
| |
while (@row = $sth->fetchrow_array()) { |
| |
$record_count = $row[0]; |
| |
} |
| |
|
| $table_out = $table; |
$table_out = $table; |
| $table = uc $table; |
$table = uc $table; |
|
|
| |
|
| $CM |
$CM |
| $CM Dumping data for table: $table_out |
$CM Dumping data for table: $table_out |
| |
$CM Records: $record_count |
| @{[ (scalar @opt_where > 0) |
@{[ (scalar @opt_where > 0) |
| ? "$CM WHERE: " . join(' AND ', @opt_where) . "\n$CM\n" |
? "$CM WHERE: " . join(' AND ', @opt_where) . "\n$CM\n" |
| : "$CM\n" ]} |
: "$CM\n" ]} |
|
|
| ## Query for data then output SQL |
## Query for data then output SQL |
| |
|
| $query = sprintf( 'SELECT "%s" FROM %s', |
$query = sprintf( 'SELECT "%s" FROM %s', |
| join ( '","', @column_names ), defined $opt_owner ? "$opt_owner.$table" : $table ); |
join ( '","', @column_names ), $table_for_select); |
| $query .= ' WHERE ' . join ( ' AND ', @opt_where ) if ( scalar @opt_where > 0 ); |
$query .= ' WHERE ' . join ( ' AND ', @opt_where ) if ( scalar @opt_where > 0 ); |
| |
|
| $sth = $dbh->prepare($query); |
$sth = $dbh->prepare($query); |