H. Wade Minter wrote:
..
Here's what I ended up with - it's not incredibly robust or portable, but does what I need:
# Get the table schema information my $sth = $dbh->table_info(); while ( my $row = $sth->fetchrow_hashref ) { if ( ( $row->{TABLE_NAME} eq "categories" ) || ( $row->{TABLE_NAME} eq "mrvoice" ) ) { print DUMPFILE "DROP TABLE $row->{TABLE_NAME};\n"; my $schema = $row->{sqlite_sql}; $schema =~ s/\n//g; print DUMPFILE "$schema;\n"; } } # Dump the contents of the categories table my $query = "SELECT * FROM categories"; $sth = $dbh->prepare($query); $sth->execute(); while ( my @row = $sth->fetchrow_array ) { my @quoted; print DUMPFILE "INSERT INTO categories VALUES ("; foreach my $item (@row) { push( @quoted, $dbh->quote($item) ); }
print DUMPFILE join( ",", @quoted ) . ");\n"; }
contents of the mrvoice table $query = "SELECT * FROM mrvoice"; $sth = $dbh->prepare($query); $sth->execute(); while ( my @row = $sth->fetchrow_array ) { my @quoted; print DUMPFILE "INSERT INTO mrvoice VALUES ("; foreach my $item (@row) { push( @quoted, $dbh->quote($item) ); }
print DUMPFILE join( ",", @quoted ) . ");\n"; }
That is nice. I will definitely use this approach for myself. Many thanks for your helpful response.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]