[Dbix-class] DBIx::Class::Schema::Loader: table names in generated classes

Joerg Braun joerg at braun-senden.de
Mon Jan 24 07:57:48 GMT 2011


On Sun, 23 Jan 2011 20:49:58 +0100, Jorge Gonzalez
<jorge.gonzalez at daikon.es> wrote:
> But whenever I try to use the schema classes, they don't work and give 
> exceptions about 'table my_table_name does not exist in current schema'. 
> I believe this is due to the table name being specified as 
> 'my_table_name', and not 'OWNER.my_table_name' in the '...->table(' 
> function call, since I have manually modified the class to be like the 
> latter, and it works this way.
> 
> I'd like to know where can I put the equivalent "db_schema=OWNER" or 
> equivalent option, so that all the schema classes use the tables from 
> the OWNER schema, despite connecting to the database with the READER
user.

I had a similar problem with DB2. I use the following after connecting to
the database in on_connect(): 

my $rc = $db_schema->storage->dbh_do(
                sub {
                    my ($storage, $dbh, $dbowner) = @_;
                    $dbh->do("SET CURRENT SQLID='$dbowner'");
                },
                $dbowner
            );

Maybe this helps as Oracle might have a similar construct.

regards
    Joerg



More information about the DBIx-Class mailing list