[CDBI] Using Class::DBI across multiple databases on one server (Sybase)

[prev] [thread] [next] [Date index for 2005/08/23]

From: IvorW
Subject: [CDBI] Using Class::DBI across multiple databases on one server (Sybase)
Date: 10:54 on 23 Aug 2005
I have an issue where I am needing a transaction to update across multiple databases. I can do this in SQL using the database..table notation. 

I have an existing CDBI suite of classes that use a separate database connection for each database. But this doesn't work with transactions on both connections owing to the way Sybase handles chained transactions. If they were sharing one channel, this would give me what I want.

I have no choice over the fact that the tables are in two different databases. Here is an illustration of what I want to do.

package DB::Connect;
use base qw(Class::DBI);

__PACKAGE__->set_db("dbi:Sybase:server=SYB_PROD;database=SALESDB",$user,$passwd);

package DB::Order;
use base qw(DB::Connect);

__PACKAGE__->set_up_table("ORDER");
__PACKAGE__->has_a( account => 'DB::Account');

package DB::Account;
use base qw(DB::Connect);

__PACKAGE__->set_up_table("REFERENCEDB..ACCOUNT");
...

It seems that table and set_up_table don't support "database.schema.table" syntax unless I am missing something.

Any help would be appreciated.

Ivor.


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] Using Class::DBI across multiple databases on one server (Sybase)
IvorW 10:54 on 23 Aug 2005

Generated at 10:42 on 28 Aug 2005 by mariachi v0.52