Skip Menu |

This queue is for tickets about the Class-DBI CPAN distribution.

Report information
The Basics
Id: 12760
Status: resolved
Priority: 0/
Queue: Class-DBI

People
Owner: Nobody in particular
Requestors: xantus+cpan [...] xantus.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: typo in docs
In section:table_alias package Shop::Order; __PACKAGE__->table('orders'); # XXX should be 'order' __PACKAGE__->table_alias('orders');
Date: Wed, 11 May 2005 19:17:55 +0100
From: Tony Bowden <tony [...] kasei.com>
To: Guest via RT <bug-Class-DBI [...] rt.cpan.org>
Subject: Re: [cpan #12760] typo in docs
RT-Send-Cc:
On Wed, May 11, 2005 at 01:02:18PM -0400, Guest via RT wrote: Show quoted text
> In section:table_alias > package Shop::Order; > __PACKAGE__->table('orders'); # XXX should be 'order' > __PACKAGE__->table_alias('orders');
Erm, no, it shouldn't. The entire point is that 'order' is a reserved word in SQL. Tony
From: xantus [...] cpan.org
[tony@kasei.com - Wed May 11 14:18:11 2005]: Show quoted text
> On Wed, May 11, 2005 at 01:02:18PM -0400, Guest via RT wrote:
> > In section:table_alias > > package Shop::Order; > > __PACKAGE__->table('orders'); # XXX should be 'order' > > __PACKAGE__->table_alias('orders');
> > Erm, no, it shouldn't. The entire point is that 'order' is a reserved > word in SQL. > > Tony >
If the table is called 'order' then you need to set an alias for it called 'orders' because it is a reserved word. That IS my point. Why is it 'orders' and aliased as 'orders'. Look closer.
Date: Wed, 11 May 2005 22:42:48 +0100
From: Tony Bowden <tony [...] kasei.com>
To: Guest via RT <bug-Class-DBI [...] rt.cpan.org>
Subject: Re: [cpan #12760] typo in docs
RT-Send-Cc:
On Wed, May 11, 2005 at 03:07:29PM -0400, Guest via RT wrote: Show quoted text
> > > In section:table_alias > > > package Shop::Order; > > > __PACKAGE__->table('orders'); # XXX should be 'order' > > > __PACKAGE__->table_alias('orders');
> > Erm, no, it shouldn't. The entire point is that 'order' is a reserved > > word in SQL.
> If the table is called 'order' then you need to set an alias for it > called 'orders' because it is a reserved word. That IS my point. Why is > it 'orders' and aliased as 'orders'. Look closer.
You're not understanding the point of this method. 'order' is a reserved word in SQL, so you can't have a table called that. The table *is* called 'orders'. However, because the *class* is called Shop::Order, and thus has a moniker of 'order', the SQL that Class::DBI would generate, in the case of a multi-table join, would be invalid, as it aliases the table name to the moniker of the class. So, in this case, you need to tell it that the *alias* for the table needs to be something other than the moniker, in this case 'orders'. Tony