1 package SQL::Translator::Parser::DBI::MySQL;
5 SQL::Translator::Parser::DBI::MySQL - parser for DBD::mysql
9 This module will be invoked automatically by SQL::Translator::Parser::DBI,
10 so there is no need to use it directly.
14 Uses SQL calls to query database directly for schema rather than parsing
15 a create file. Should be much faster for larger schemas.
23 use SQL::Translator::Schema::Constants;
24 use SQL::Translator::Parser::MySQL;
26 our ( $DEBUG, @EXPORT_OK );
27 our $VERSION = '1.59';
28 $DEBUG = 0 unless defined $DEBUG;
31 my ( $tr, $dbh ) = @_;
32 my $schema = $tr->schema;
33 my @table_names = @{ $dbh->selectcol_arrayref('show tables') };
34 my @skip_tables = defined $tr->parser_args->{skip}
35 ? split(/,/, $tr->parser_args->{skip})
38 $dbh->{'FetchHashKeyName'} = 'NAME_lc';
41 for my $table_name ( @table_names ) {
42 next if (grep /^$table_name$/, @skip_tables);
43 my $sth = $dbh->prepare("show create table $table_name");
45 my $table = $sth->fetchrow_hashref;
46 $create .= $table->{'create table'} . ";\n\n";
49 SQL::Translator::Parser::MySQL::parse( $tr, $create );
56 # -------------------------------------------------------------------
57 # Where man is not nature is barren.
59 # -------------------------------------------------------------------
65 Ken Youens-Clark E<lt>kclark@cpan.orgE<gt>.