X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FTranslator%2FProducer%2FDumper.pm;h=7d53ec5a7ea614a30a132ddfbd235e5fecef9088;hb=782b5a43519d2713171767f74a544fe9892542ea;hp=d420f445cc50f4d2407ea6064ce173c8d9f48113;hpb=43cf00a19efb3412e11a009145621d9b79d8ce1e;p=dbsrgits%2FSQL-Translator.git diff --git a/lib/SQL/Translator/Producer/Dumper.pm b/lib/SQL/Translator/Producer/Dumper.pm index d420f44..7d53ec5 100644 --- a/lib/SQL/Translator/Producer/Dumper.pm +++ b/lib/SQL/Translator/Producer/Dumper.pm @@ -1,9 +1,9 @@ package SQL::Translator::Producer::Dumper; # ------------------------------------------------------------------- -# $Id: Dumper.pm,v 1.7 2004-07-20 17:44:43 kycl4rk Exp $ +# $Id$ # ------------------------------------------------------------------- -# Copyright (C) 2002-4 SQLFairy Authors +# Copyright (C) 2002-2006 SQLFairy Authors # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -61,7 +61,7 @@ use vars qw($VERSION); use Data::Dumper; -$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/; +$VERSION = '1.99'; sub produce { my $t = shift; @@ -166,7 +166,8 @@ Usage: --mysql-loadfile Create MySQL's LOAD FILE syntax, not INSERTs --no-comments Suppress comments --skip=t1[,t2] Comma-separated list of tables to skip - --skiplike=regex Comma-separated list of tables to skip + --skiplike=regex Regular expression of table names to skip + --takelike=regex Regular expression of table names to take USAGE exit(0); @@ -242,12 +243,13 @@ for my $table ( @tables ) { print "TRUNCATE TABLE $table_name;\n"; } - my $data = $db->selectall_arrayref( - 'select ' . join(', ', @{ $table->{'fields'} } ) . " from $table_name", - { Columns => {} } - ); + my $sql = + 'select ' . join(', ', @{ $table->{'fields'} } ) . " from $table_name" + ; + my $sth = $db->prepare( $sql ); + $sth->execute; - for my $rec ( @{ $data } ) { + while ( my $rec = $sth->fetchrow_hashref ) { my @vals; for my $fld ( @{ $table->{'fields'} } ) { my $val = $rec->{ $fld }; @@ -299,6 +301,6 @@ EOF =head1 AUTHOR -Ken Y. Clark Ekclark@cpan.orgE. +Ken Youens-Clark Ekclark@cpan.orgE. =cut