Re: CDBI::DATA::Schema idea
[prev]
[thread]
[next]
[Date index for 2004/05/24]
On Sat, May 22, 2004 at 04:02:16PM +0100, Tony Bowden wrote:
> On Sat, May 22, 2004 at 03:17:02PM +0100, Simon Cozens wrote:
> > Since not everyone uses the same RDBMS, and not all RDBMSes use the same SQL,
> > CDBI::DATA::Schema helpfully has an undocumented "translate" option which
> > rewrites the schema for a different database.
>
> Using the equally undocumented cache option is very useful here too, as
> SQL::Translator is rather slow...
>
> But it's a very nice feature. I use it for running test-suites against a
> disposable SQLite database, even though the live code runs against
> MySQL.
>
> >
> > $self->set_db(Main => @params);
> > my ($dbd) = $params[0] =~ /dbi:(\w+):/;
Use /dbi:(\w+)/ instead of /dbi:(\w+):/ because DBI DSN's may look like
dbi:Foo(Attr1=foo,Attr2=bar):...
(The next DBI release will have a DBI->parse_dsn method)
Tim.
> After a set_db call (although you should really be using connection()
> now, btw), that will already be set in $class->__driver. Yes, it's
> 'private', but it should be fairly stable.
>
> Tony