package SQL::Translator::Parser::DBI;
# -------------------------------------------------------------------
-# $Id: DBI.pm,v 1.1 2003-10-03 00:21:41 kycl4rk Exp $
+# $Id: DBI.pm,v 1.2 2003-10-03 20:39:53 kycl4rk Exp $
# -------------------------------------------------------------------
# Copyright (C) 2003 Ken Y. Clark <kclark@cpan.org>,
# darren chamberlain <darren@cpan.org>
use strict;
use DBI;
use vars qw($VERSION @EXPORT);
-$VERSION = sprintf "%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/;
use constant DRIVERS => {
+ mysql => 'MySQL',
sqlite => 'SQLite',
};
use Exporter;
use SQL::Translator::Utils qw(debug normalize_name);
+use SQL::Translator::Parser::DBI::MySQL;
use SQL::Translator::Parser::DBI::SQLite;
use base qw(Exporter);
sub parse {
my ( $tr, $data ) = @_;
- $tr->debug( "in DBI\n" );
my $args = $tr->parser_args;
my $dbh = $args->{'dbh'};
my $dsn = $args->{'dsn'};
unless ( $dbh ) {
die 'No DSN' unless $dsn;
- $dbh = DBI->connect( $dsn, $db_user, $db_password, {RaiseError=>1} );
+ $dbh = DBI->connect( $dsn, $db_user, $db_password,
+ {
+ FetchHashKeyName => 'NAME_lc',
+ LongReadLen => 3000,
+ LongTruncOk => 1,
+ RaiseError => 1,
+ }
+ );
}
die 'No database handle' unless defined $dbh;
my $pkg = "SQL::Translator::Parser::DBI::$driver";
my $sub = $pkg.'::parse';
- $tr->debug( "Calling sub '$sub'\n" );
-
-# $tr->load( $pkg );
-
{
no strict 'refs';
&{ $sub }( $tr, $dbh ) or die "No result from $pkg";