Re: [Dbix-class] DBIx, Postgres and Camel Case in field and table names

2015-02-23 Thread Andrew Beverley
On Mon, 2015-02-23 at 14:01 +0400, Jan Eskilsson wrote:
 Is there a way to make DBIx automatically quote table and field names
 in the generated SQL ?

Yes, with the quote_names option:

https://metacpan.org/pod/DBIx::Class::Storage::DBI#quote_names

Regards,

Andy



___
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


Re: [Dbix-class] DBIx, Postgres and Camel Case in field and table names

2015-02-23 Thread Jan Eskilsson
Hi Andrew


Super thanks, excatly what i needed, saved my day !


Best Regards
Jan Eskilsson

2015-02-23 14:11 GMT+04:00 Andrew Beverley a...@andybev.com:

 On Mon, 2015-02-23 at 14:01 +0400, Jan Eskilsson wrote:
  Is there a way to make DBIx automatically quote table and field names
  in the generated SQL ?

 Yes, with the quote_names option:

 https://metacpan.org/pod/DBIx::Class::Storage::DBI#quote_names

 Regards,

 Andy



 ___
 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




-- 
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.

Please consider the environment before you print this email.

(1) The contents of this transmission are privileged and confidential and
intended solely for the use of the addressee. Any disclosure, distribution
or copying of the contents, other than by the addressee, is strictly
prohibited. If you receive this transmission in error, please notify us
immediately and destroy the material received.
(2) All incoming and outgoing emails and any attachments are subjected to a
virus scanner and are believed to be free of any virus, or any other defect
which might affect any computer or IT system into which they are received
and opened. Therefore, it is the responsibility of the recipient to ensure
that they are virus free and no responsibility is accepted by Jan Eskilsson
 for any loss or damage arising in any way from receipt or use thereof.
___
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

[Dbix-class] DBIx, Postgres and Camel Case in field and table names

2015-02-23 Thread Jan Eskilsson
Hi All

I'm in a situation where i need to connect to a legacy PostgreSQL database
where field and table names are written in Camel Case hence in Postgres
they need to be quoted. Is there a way to make DBIx automatically quote
table and field names in the generated SQL ?

For example

SELECT City FROM CVU.HeadQuarter WHERE Type = 100 Need to be generated as
SELECT City FROM CVU.HeadQuarter WHERE Type = 100

Thank you in Advance !

Best Regards
Jan Eskilsson

-- 
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.

Please consider the environment before you print this email.

(1) The contents of this transmission are privileged and confidential and
intended solely for the use of the addressee. Any disclosure, distribution
or copying of the contents, other than by the addressee, is strictly
prohibited. If you receive this transmission in error, please notify us
immediately and destroy the material received.
(2) All incoming and outgoing emails and any attachments are subjected to a
virus scanner and are believed to be free of any virus, or any other defect
which might affect any computer or IT system into which they are received
and opened. Therefore, it is the responsibility of the recipient to ensure
that they are virus free and no responsibility is accepted by Jan Eskilsson
 for any loss or damage arising in any way from receipt or use thereof.
___
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

Re: [Dbix-class] Table name length constraint?

2015-02-23 Thread Ben Tilly
Random guess, DBIx::Class is working around a database limitation.
For example see
http://search.cpan.org/~ribasushi/DBIx-Class-0.082810/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm#relname_to_table_alias
for how your situation could have happened.

On Mon, Feb 23, 2015 at 4:36 PM, Greg Coates g...@coatesoft.com wrote:
 Is there code somewhere in DBIx::Class that limits the length of a table
 name?

 I have a schema package with the following table name:

 __PACKAGE__-table('RDSPRD.REC_CLASS_MTG_INSTRUCTOR_DTL@FRONT1');

 When I try to access data from this table, I get an error saying the table
 does not exist, but if I look at the generated SQL in the error message, the
 table name has changed to RDSPRD.RcClssMtgInstrctrDt_D412VD8KCP.

 If I change the table name to REC_CLASS_MTG_INSTRUCTOR_DTL, the table name
 doesn't get changed in the SQL.

 Does anyone have any idea what is going on here?

 Thanks,
 Greg Coates


 ___
 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

___
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


Re: [Dbix-class] Table name length constraint?

2015-02-23 Thread Greg Coates

One note: The ' at ' in the table name should have been an actual at sign.

Greg

On 2/23/2015 4:36 PM, Greg Coates wrote:
Is there code somewhere in DBIx::Class that limits the length of a 
table name?


I have a schema package with the following table name:

__PACKAGE__-table('RDSPRD.REC_CLASS_MTG_INSTRUCTOR_DTL@FRONT1');

When I try to access data from this table, I get an error saying the 
table does not exist, but if I look at the generated SQL in the error 
message, the table name has changed to 
RDSPRD.RcClssMtgInstrctrDt_D412VD8KCP.


If I change the table name to REC_CLASS_MTG_INSTRUCTOR_DTL, the table 
name doesn't get changed in the SQL.


Does anyone have any idea what is going on here?

Thanks,
Greg Coates




___
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


[Dbix-class] Table name length constraint?

2015-02-23 Thread Greg Coates
Is there code somewhere in DBIx::Class that limits the length of a table 
name?


I have a schema package with the following table name:

__PACKAGE__-table('RDSPRD.REC_CLASS_MTG_INSTRUCTOR_DTL@FRONT1');

When I try to access data from this table, I get an error saying the 
table does not exist, but if I look at the generated SQL in the error 
message, the table name has changed to 
RDSPRD.RcClssMtgInstrctrDt_D412VD8KCP.


If I change the table name to REC_CLASS_MTG_INSTRUCTOR_DTL, the table 
name doesn't get changed in the SQL.


Does anyone have any idea what is going on here?

Thanks,
Greg Coates


___
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


Re: [Dbix-class] Table name length constraint?

2015-02-23 Thread Greg Coates
That looks to be what is happening.  Is there any way to turn this 
behavior off?  This is a legitimate table name with a dblink and schema 
appended.  It works in a direct query.


Thanks,
Greg

On 2/23/2015 4:49 PM, Ben Tilly wrote:

Random guess, DBIx::Class is working around a database limitation.
For example see
http://search.cpan.org/~ribasushi/DBIx-Class-0.082810/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm#relname_to_table_alias
for how your situation could have happened.

On Mon, Feb 23, 2015 at 4:36 PM, Greg Coates g...@coatesoft.com wrote:

Is there code somewhere in DBIx::Class that limits the length of a table
name?

I have a schema package with the following table name:

__PACKAGE__-table('RDSPRD.REC_CLASS_MTG_INSTRUCTOR_DTL@FRONT1');

When I try to access data from this table, I get an error saying the table
does not exist, but if I look at the generated SQL in the error message, the
table name has changed to RDSPRD.RcClssMtgInstrctrDt_D412VD8KCP.

If I change the table name to REC_CLASS_MTG_INSTRUCTOR_DTL, the table name
doesn't get changed in the SQL.

Does anyone have any idea what is going on here?

Thanks,
Greg Coates


___
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

___
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



___
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


Re: [Dbix-class] Table name length constraint?

2015-02-23 Thread Peter Rabbitson

On 02/24/2015 01:36 AM, Greg Coates wrote:

Is there code somewhere in DBIx::Class that limits the length of a table
name?

I have a schema package with the following table name:

__PACKAGE__-table('RDSPRD.REC_CLASS_MTG_INSTRUCTOR_DTL@FRONT1');


Please try with:

__PACKAGE__-table(\'RDSPRD.REC_CLASS_MTG_INSTRUCTOR_DTL@FRONT1');

to indicate to DBIC I know what I am doing

___
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