[Dbix-class] Runtime database name and table name changes + Catalyst

James R. Leu jleu at mindspring.com
Tue Jan 23 21:34:45 GMT 2007


Disclaimer:
I'm a noob to DBIx::Class. I checked the archives, but was unable to
find an answer to the following question.  If I've overlooked an obvious
source to my answers, please scold me and point me the the relevant URL.

Hello,

I'm trying to use DBIx::Class to access a database for which the name
changes based on who is authenticated.  In addition the authorization
of the use affects what dynamically name table they 'link' to in another
database.

I read about DBIx::Class::Schema::Loader, but was unable to grok
how I would define relationships to a dynamically named table.

To better illustrate here is a simplified example:

    The following database reside within a common mysql instance.

    Database: config_alpha
	    Table: common

    Database: config_beta
	    Table: common

    Database: data
	    Table: foo_01
	    Table: foo_88
	    Table: foo_34
	    Table: foo_39

Depending which user logged in 'alpha' or 'beta' they would
connect to the appropriate 'config' database.  In addition they are
connected the the 'data' database.  Depending on additional
authorization data they would have permission to see data in one of the
'foo' tables.  I would like to define a has_many relationship between
entries in the 'common' and the 'foo' table.

I think I can image ways to make some of this work in a stand-alone
script, but I haven't the foggiest idea how to make this work within
a Catalyst environment.

Any pointers would be much appreciated.

-- 
James R. Leu
jleu at mindspring.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070123/f5ede7fa/attachment.pgp


More information about the Dbix-class mailing list