Re: prefixing table names?

[prev] [thread] [next] [Date index for 2004/10/15]

From: Bowen Dwelle
Subject: Re: prefixing table names?
Date: 23:20 on 15 Oct 2004
The only real ugliness so far is when Class::DBI::DATA::Schema is used 
to create tables... For now I have this hard-coded, can someone advise 
how to look in the right place in the calling stack?

     my $prefix = Email::Store::DBI->TABLE_PREFIX();
     $sql =~ s/TABLE_PREFIX_/$prefix/sg;

thx

-- Bowen

Bowen Dwelle wrote:
> Bradley K. Embree wrote:
> 
>> Could you not set up a TABLE_PREFIX in a parent CDBI class and have 
>> your other classes inherit from that? The problem with this is needing 
>> to be extra careful when rolling your own SQL to use the prefix where 
>> necessary. Of course the __TABLE__ notation provided by Ima::DBI makes 
>> that easier.
>>
>>
>> package My::CDBI;
>>
>> sub TABLE_PREFIX {
>>     return 'foo_';
>> }
>>
>> package My::CDBI::Bar;
>>
>> use base 'My::CDBI';
>>
>> __PACKAGE__->table( __PACKAGE__->TABLE_PREFIX() . 'bar' );
>>
>>
>> Hope that makes some sort of sense,
>>
>> Brad
> 
> 
> In this case the app uses set_up_table(), but that seems to do the same 
> thing.
> 
> I knew there was a simple answer. Thanks!
> 

(message missing)

prefixing table names?
bowen 15:20 on 15 Oct 2004

Re: prefixing table names?
jason 15:36 on 15 Oct 2004

Re: prefixing table names?
Tony Bowden 18:45 on 15 Oct 2004

SQL Generation ( was Re: prefixing table names?)
jason scott gessner 00:08 on 19 Oct 2004

Re: SQL Generation ( was Re: prefixing table names?)
merlyn (Randal L. Schwartz) 09:46 on 19 Oct 2004

Re: SQL Generation ( was Re: prefixing table names?)
merlyn (Randal L. Schwartz) 10:00 on 19 Oct 2004

Re: prefixing table names?
Tony Bowden 15:36 on 15 Oct 2004

Re: prefixing table names?
Bowen Dwelle 22:05 on 15 Oct 2004

Re: prefixing table names?
Bradley K. Embree 22:16 on 15 Oct 2004

Re: prefixing table names?
Bowen Dwelle 22:48 on 15 Oct 2004

Re: prefixing table names?
Bowen Dwelle 23:20 on 15 Oct 2004

Re: prefixing table names?
Perrin Harkins 16:44 on 15 Oct 2004

FromCGI and Untaint question
Peter Speltz 17:23 on 19 Oct 2004

Re: prefixing table names?
Bowen Dwelle 01:31 on 02 Nov 2004

Re: prefixing table names?
Bowen Dwelle 16:36 on 02 Nov 2004

Generated at 11:35 on 01 Dec 2004 by mariachi v0.52