[Dbix-class] Defining storage in schema
Alan Humphrey
alan.humphrey at comcast.net
Thu Jan 12 23:25:57 CET 2006
What are you trying to achieve here? What does NoBindStorage *do*?
NoBindStorage overrides the _execute method of DBIx::Class::Storage::DBI.
I'm using FreeTDS via DBI:Sybase to access a MSSQL database. FreeTDS
doesn't support placeholders/bind variables so I have to swap out the bind
variables before $self->sth($sql) gets called.
I'm still testing, but so far so good.
DBIx::Class::DB provides a storage method to let you set the storage
backend. I guess my question boils down do what's the best way to access
that method in my DB class?
- Alan
-----Original Message-----
From: dbix-class-bounces at lists.rawmode.org
[mailto:dbix-class-bounces at lists.rawmode.org] On Behalf Of Matt S Trout
Sent: Thursday, January 12, 2006 1:16 PM
To: dbix-class at lists.rawmode.org
Subject: Re: [Dbix-class] Defining storage in schema
On Thu, Jan 12, 2006 at 08:35:35AM -0800, Alan Humphrey wrote:
> I'd like to override the storage used by each of the classes in my schema.
> This is what I've got now in my DB class:
>
>
>
> BirdWeb::Admin::Model::BirdWebSchema->compose_connection( __PACKAGE__,
> @conn_info );
>
>
>
> my $store = BirdWeb::Admin::Model::NoBindStorage->new();
>
> $store->connect_info( \@conn_info );
What are you trying to achieve here? What does NoBindStorage *do*?
> my $classes = __PACKAGE__->classes();
>
> foreach my $class (keys ( %{$classes} ) ) {
>
> ${$classes}{$class}->storage( $store );
>
> }
>
>
>
> Is this the best way to go or is there a more straightforward way that I'm
> missing?
>
>
>
> Related: should each class get its own $store?
Absolutely not. Storage is becoming an attribute of the live schema, so
that approach will become fairly suicidal very soon.
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST.
Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM:
http://dbix-class.shadowcatsystems.co.uk/ +
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
More information about the Dbix-class
mailing list