[Dbix-class] DBIx::Class::Schema::Loader: table names in
generated classes
Alexander Hartmaier
alexander.hartmaier at t-systems.at
Mon Jan 24 09:25:33 GMT 2011
This solution has the downside that you can't use the dbic schema with
different databases that don't support that syntax or with say a test
schema in the same database.
What I do these days is immediately after connect:
$schema->storage->on_connect_do(["ALTER SESSION SET CURRENT_SCHEMA =
OWNER"] );
--
Best regards, Alex
On Mon, 2011-01-24 at 03:28 +0100, Jose Fonseca wrote:
> Hello Jorge,
> to test if this is really your issue, choose one of the generated
> classes and change the
>
> __PACKAGE__->table("table");
>
> to
>
> __PACKAGE__->table("SCHEMA.table");
>
> If it solves your problem for that particular class, then you'll be
> sure about the cause and you can fix the others accordingly.
>
> I'm not 100% sure about the Oracle syntax, but you can probably set
> the default schema on the DBI connection string passed to
> Your_Base_DBIx_Class->connect(); ( See
> http://search.cpan.org/~abraxxa/DBIx-Class-0.08127/lib/DBIx/Class/Storage/DBI.pm#connect_info )
>
> Regards,
> Jose
>
> On Sun, Jan 23, 2011 at 5:49 PM, Jorge Gonzalez
> <jorge.gonzalez at daikon.es> wrote:
> Hi,
>
> first, let me apologize in advance if this issue has been
> brought up on the list before. I haven't been able to find a
> solution to my problem (googled for it for a couple of hours),
> though I think it's a pretty easy one and probably someone has
> stepped into it.
>
> This is the story:
>
> I have a running Oracle schema, for which I have a readonly
> user. The tables are owned by user OWNER, but I have user
> READER to access them. READER has a readonly access to the
> tables.
>
> I have generated the schema classes though
> DBIx::Class::Schema::Loader (via the Catalyst helper script).
> I needed the special option "db_schema=OWNER" to correctly
> generate the classes, since READER owns no tables, but has
> access to them. The generated classes have correct
> "...->table('my_table_name')" sentences.
>
> 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.
>
> Thanks in advance
> Best regards
> Jorge
>
> --
>
>
> Jorge González Villalonga
> Director Técnico
>
> DAIKON Integración y Desarrollo
> S.L.
> Telf: (+34) 91 188 08 28
> Fax: (+34) 91 632 65 42
> www.daikon.es
>
> _______________________________________________
> List:
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
More information about the DBIx-Class
mailing list