From: Ken Youens-Clark Date: Fri, 3 Oct 2003 20:39:53 +0000 (+0000) Subject: Some mods. X-Git-Tag: v0.04~144 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9d53a6a271b4ecffeca12d9724cc33e56010b2ec;p=dbsrgits%2FSQL-Translator.git Some mods. --- diff --git a/lib/SQL/Translator/Parser/DBI.pm b/lib/SQL/Translator/Parser/DBI.pm index 20a62b4..c9a2790 100644 --- a/lib/SQL/Translator/Parser/DBI.pm +++ b/lib/SQL/Translator/Parser/DBI.pm @@ -1,7 +1,7 @@ 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 , # darren chamberlain @@ -84,14 +84,16 @@ The password to use for connecting to a database. 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); @@ -103,7 +105,6 @@ 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'}; @@ -112,7 +113,14 @@ sub parse { 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; @@ -122,10 +130,6 @@ sub parse { 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";