[prev] [thread] [next] [Date index for 2004/11/24]
Hi. I have 3 databases. Each has it's own base cdbi class for connection. Database 1 contains an origin table that defines the database and table one of the other two databases. E.g. 2 systems (with user info) being access by a third system that has visibility across all 3 (itself + 2 others). With the following three tables (in database 1), how do I write some sensible methods into my table-wrapping classes to build up this relationship? History_Table id person_id note Person_Table id origin_id foreignkey Origin_Table id db_name table_name I understand the basic: Table::DB1::History->has_a(person_id->'Table::DB1::Person'); Then I can get the origin: Table::DB1::Person->has_a(origin_id->'Table::DB1::Origin'); But I want to pass $foreignKey to Table::DB1::Origin as a parameter for a dynamic method? Table::DBI::Origin->has_a(foreignkey->'Table::$db_name::$table_name'->remote_pk_column_name) I've been playing with constructs and set_sql, but I can't seem to get it right. Any pointers as to which of classes should have what kind of method? Do I need construct a method on Table::$db_name::$table_name, or should be instantiating an object and calling Table::$db_name::$table_name->retrieve? Or am I just doing this completely wrong?
Foreign keys to different databases.
|
Generated at 11:34 on 01 Dec 2004 by mariachi v0.52