Skip Menu |

This queue is for tickets about the DBIx-DBH CPAN distribution.

Report information
The Basics
Id: 18053
Status: resolved
Worked: 10 min
Priority: 0/
Queue: DBIx-DBH

People
Owner: metaperl [...] gmail.com
Requestors: mark [...] summersault.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.09
Fixed in: (no value)



Subject: PATCH: add SQLite driver
Attached is a patch to add a SQLite driver, including code tests and docs. It's validated a bit different than the others. I didn't like the idea of hardcoded all the current SQLite or DBI attributes into the module, as this will require maintenance when those interfaces change. The provided design is helpful for the project I'm working on now where host => undef may be provided to SQLite driver. Although SQLite doesn't use the host option, I'd still like to accept it. Mark
Subject: sqlite.patch
Tue Mar 7 21:46:38 EST 2006 Mark Stosberg <mark@summersault.com> * Add SQLite driver diff -rN -u old-DBIx-DBH-0.09/ChangeLog new-DBIx-DBH-0.09/ChangeLog --- old-DBIx-DBH-0.09/ChangeLog 2006-03-07 21:47:25.000000000 -0500 +++ new-DBIx-DBH-0.09/ChangeLog 2006-03-07 21:47:25.000000000 -0500 @@ -1,4 +1,6 @@ + * Add SQLite driver (Mark Stosberg) + * Allow new drivers to published and used without modifying DBIx::DBH (Mark Stosberg) 2004-12-01 Terrence Brannon <terry@hcoop.net> diff -rN -u old-DBIx-DBH-0.09/lib/DBIx/DBH/SQLite.pm new-DBIx-DBH-0.09/lib/DBIx/DBH/SQLite.pm --- old-DBIx-DBH-0.09/lib/DBIx/DBH/SQLite.pm 1969-12-31 19:00:00.000000000 -0500 +++ new-DBIx-DBH-0.09/lib/DBIx/DBH/SQLite.pm 2006-03-07 21:47:25.000000000 -0500 @@ -0,0 +1,49 @@ +package DBIx::DBH::SQLite; + +use base qw(DBIx::DBH); +use Params::Validate qw( :all ); + +sub connect_data { + my $class = shift; + my %p = validate_with( + params => \@_, + spec => { + driver => { type => SCALAR }, + dbname => { type => SCALAR }, + attr => { type => SCALAR | UNDEF, optional => 1 }, + user => { type => SCALAR | UNDEF, optional => 1 }, + password => { type => SCALAR | UNDEF, optional => 1 }, + host => { type => SCALAR | UNDEF, optional => 1 }, + port => { type => SCALAR | UNDEF, optional => 1 }, + }, + # allow_extra => 1, + ); + + my $dsn = "DBI:$p{driver}:$p{dbname}"; + + return ($dsn, $p{user}, $p{password}, $p{attr}); + +} + + +1; + +=head1 NAME + + DBIx::DBH::SQLite - SQLite DBI database handle connection specifics. + +=head1 connect() + +dbname is probably the only one param you need. We pass through C<user>, C<password>, +and C<attr>, ignoring other attributes. + +=head1 SEE ALSO + +L<DBIx::DBH> +L<DBD::SQLite> + +=head1 AUTHOR + +Mark Stosberg, mark@summersault.com + +=cut diff -rN -u old-DBIx-DBH-0.09/t/SQLite.t new-DBIx-DBH-0.09/t/SQLite.t --- old-DBIx-DBH-0.09/t/SQLite.t 1969-12-31 19:00:00.000000000 -0500 +++ new-DBIx-DBH-0.09/t/SQLite.t 2006-03-07 21:47:25.000000000 -0500 @@ -0,0 +1,16 @@ +use Test::More qw/no_plan/; +use DBIx::DBH; + +my @dat = ( + driver => 'SQLite', + dbname => 'db_terry', + user => 'terry', + password => 'markso' , + host => 'foo', + port => 'zoo', +) ; + +sub make_data { return DBIx::DBH->form_dsn( @dat ); } + +is(make_data, 'DBI:SQLite:db_terry'); +
From: mark [...] summersault.com
Thanks for accepting this patch. It looks like the patch didn't update the MANIFEST, and in turn it wasn't included in the new release. So 0.10 doesn't have SQLite support. Mark
Subject: Re: [rt.cpan.org #18053] PATCH: add SQLite driver
Date: Wed, 8 Mar 2006 07:33:14 -0800
To: bug-DBIx-DBH [...] rt.cpan.org
From: "Terrence Brannon" <metaperl [...] gmail.com>
Ack. 0.11 will have it. On 3/8/06, Guest via RT <bug-DBIx-DBH@rt.cpan.org> wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=18053 > > > Thanks for accepting this patch. > > It looks like the patch didn't update the MANIFEST, and in turn it > wasn't included in the new release. So 0.10 doesn't have SQLite support. > > Mark >
Ok added. New OO API is now standard.