Always nice to see when suggestions are ignored... Happy testing! -- Best regards, Alex
On Mon, 2011-01-24 at 11:20 +0100, Jorge Gonzalez wrote: > Thank you very much for your solution and Joerg Braun's (whic is > basically the same). > > I've found exactly what I needed (and what I feel is the real solution > to my problem): there's a switch to indicate > DBIx::Class::Schema::Loader that you want to fully qualify the table > names with the schema name: its name is "qualify_objects": > > http://search.cpan.org/~rkitover/DBIx-Class-Schema-Loader-0.07000/lib/DBIx/Class/Schema/Loader/Base.pm#qualify_objects > > I have regenerated the schema classes with options db_schema=OWNER and > qualify_objects=1 in the Catalyst helper invocation, and now all > generated class files have the schema prepended in their table names. > This is my Catalyst helper invocation: > > script/myapp_create.pl model MyAppDB DBIC::Schema MyApp::Schema \ > create=static db_schema=OWNER qualify_objects=1 > 'dbi:Oracle:host=X.X.X.X;port=1521;sid=MYDB' \ > READER <password> > > And now all the classes have lines of the form: > > (...) > __PACKAGE__->table("OWNER.my_table"); > (...) > > Which is exactly what I needed. > > Thanks to all that responded. > 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 > > El 24/01/11 10:25, Alexander Hartmaier escribió: > > 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 > > > <[email protected]> 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/[email protected] > > > > > > > > > > *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* > > 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. > > *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* > > > > _______________________________________________ > > 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/[email protected] > > _______________________________________________ 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/[email protected]
