package SQL::Translator::Parser::DBI;
# -------------------------------------------------------------------
-# $Id: DBI.pm,v 1.5 2004-02-09 22:23:40 kycl4rk Exp $
+# $Id: DBI.pm,v 1.6 2004-09-24 14:06:46 kycl4rk Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use DBI;
use SQL::Translator;
- my $dbh = DBI->connect(...);
+ my $dbh = DBI->connect('dsn', 'user', 'pass',
+ {
+ RaiseError => 1,
+ FetchHashKeyName => 'NAME_lc',
+ }
+ );
my $translator = SQL::Translator->new(
parser => 'DBI',
use SQL::Translator;
- my $translator = SQL::Translator->new(
- parser => 'DBI',
- dsn => 'dbi:mysql:FOO',
- db_user => 'guest',
- db_password => 'password',
+ my $translator = SQL::Translator->new(
+ parser => 'DBI',
+ parser_args => {
+ dsn => 'dbi:mysql:FOO',
+ db_user => 'guest',
+ db_password => 'password',
+ }
);
=head1 DESCRIPTION
=item * dbh
-An open DBI database handle.
+An open DBI database handle. NB: Be sure to create the database with the
+"FetchHashKeyName => 'NAME_lc'" option as all the DBI parsers expect
+lowercased column names.
=item * dsn
use strict;
use DBI;
use vars qw($VERSION @EXPORT);
-$VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/;
use constant DRIVERS => {
mysql => 'MySQL',