Skip Menu |
 

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

Report information
The Basics
Id: 17084
Status: open
Priority: 0/
Queue: Class-DBI-Loader

People
Owner: Nobody in particular
Requestors: david [...] bullmedia.com.au
Cc:
AdminCc:

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



Subject: MySQL 5.0.18, Views and Foreign Keys
Download (untitled) / with headers
text/plain 4.6k
lloy0076@david:~/work/programming/pos$ mysql yb_pos_trans; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 80 to server version: 5.0.18-Debian_4-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. Show quoted text
mysql> describe product_incomplete;
+-------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------+------+-----+---------+-------+ | receipt_id | int(11) | YES | | NULL | | | prod_id | int(11) | YES | | NULL | | | barcode | varchar(32) | YES | | NULL | | | stockcode | varchar(32) | YES | | NULL | | | description | varchar(64) | YES | | NULL | | | sell_exgst | decimal(10,2) | YES | | NULL | | | buy_price | decimal(10,2) | YES | | NULL | | | discount | decimal(10,2) | YES | | NULL | | | sell_gst | decimal(10,2) | YES | | NULL | | | quantity | double | YES | | NULL | | | line_total | decimal(10,2) | YES | | NULL | | | serial_number | varchar(64) | YES | | NULL | | | date_stamp | varbinary(10) | YES | | NULL | | | time_stamp | varbinary(8) | YES | | NULL | | | serial_override | tinyint(4) | YES | | NULL | | | price_override | tinyint(4) | YES | | NULL | | | discount_override | tinyint(4) | YES | | NULL | | | ybresponse | tinyint(4) | YES | | NULL | | | token_soap | varchar(128) | YES | | NULL | | | token_status | tinyint(4) | YES | | NULL | | | product_pri_key | int(11) | NO | | 0 | | +-------------------+---------------+------+-----+---------+-------+ 21 rows in set (0.02 sec) The view was created with: Show quoted text
mysql> describe product;
+-------------------+---------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------+------+-----+---------+----------------+ | receipt_id | int(11) | YES | | NULL | | | prod_id | int(11) | YES | | NULL | | | barcode | varchar(32) | YES | | NULL | | | stockcode | varchar(32) | YES | | NULL | | | description | varchar(64) | YES | | NULL | | | sell_exgst | decimal(10,2) | YES | | NULL | | | buy_price | decimal(10,2) | YES | | NULL | | | discount | decimal(10,2) | YES | | NULL | | | sell_gst | decimal(10,2) | YES | | NULL | | | quantity | double | YES | | NULL | | | line_total | decimal(10,2) | YES | | NULL | | | serial_number | varchar(64) | YES | | NULL | | | date_stamp | varchar(10) | YES | | NULL | | | date_time | varchar(8) | YES | | NULL | | | serial_override | tinyint(4) | YES | | NULL | | | price_override | tinyint(4) | YES | | NULL | | | discount_override | tinyint(4) | YES | | NULL | | | ybresponse | tinyint(4) | YES | | NULL | | | token_soap | varchar(128) | YES | | NULL | | | token_status | tinyint(4) | YES | | NULL | | | product_pri_key | int(11) | NO | PRI | NULL | auto_increment | +-------------------+---------------+------+-----+---------+----------------+ 21 rows in set (0.03 sec) Notice that the bottom part defines the product_pri_key as a primary key. So I guess the description of my bug is: "Class::DBI::Loader" (specifically when used with MySQL) does not setup views correctly and instead croaks with: Initializing "POS::CreditnotesIncomplete" at /usr/local/share/perl/5.8.7/Class/DBI/Loader/Generic.pm line 192. creditnotes_incomplete has no primary key at /usr/local/share/perl/5.8.7/Class/DBI/Loader/Generic.pm line 196" That appears to be where it checks for a primary key. I'm not sure how this might be fixed - skipping views -might- work... DSL
From: mromani [...] ottotecnica.com
Download (untitled) / with headers
text/plain 730b
On Dom. 15 Gen. 2006 23:11:25, lloy0076@adam.com.au wrote: [snip] Show quoted text
> So I guess the description of my bug is: > > "Class::DBI::Loader" (specifically when used with MySQL) does not > setup > views correctly and instead croaks with: > > Initializing "POS::CreditnotesIncomplete" at > /usr/local/share/perl/5.8.7/Class/DBI/Loader/Generic.pm line 192. > creditnotes_incomplete has no primary key at > /usr/local/share/perl/5.8.7/Class/DBI/Loader/Generic.pm line 196" > > That appears to be where it checks for a primary key. > > I'm not sure how this might be fixed - skipping views -might- work... > > DSL
I have this problem too. Until now my solution has been to avoid CDBI::Loader and setup classes for my views manually.
Download (untitled) / with headers
text/plain 1.1k
On Mer. 17 Mag. 2006 05:42:43, guest wrote: Show quoted text
> On Dom. 15 Gen. 2006 23:11:25, lloy0076@adam.com.au wrote: > [snip] >
> > So I guess the description of my bug is: > > > > "Class::DBI::Loader" (specifically when used with MySQL) does not > > setup > > views correctly and instead croaks with: > > > > Initializing "POS::CreditnotesIncomplete" at > > /usr/local/share/perl/5.8.7/Class/DBI/Loader/Generic.pm line 192. > > creditnotes_incomplete has no primary key at > > /usr/local/share/perl/5.8.7/Class/DBI/Loader/Generic.pm line 196" > > > > That appears to be where it checks for a primary key. > > > > I'm not sure how this might be fixed - skipping views -might- work... > > > > DSL
> > > I have this problem too. > > Until now my solution has been to avoid CDBI::Loader and setup classes > for my views manually.
Class::DBI::mysql identifies primary keys by issuing a DESCRIBE <table> query and looking at the KEY column. Any table column which has 'PRI' goes into the 'Primary' column group. The problem is that when you issue a DESCRIBE <table> on a view, none of the view columns has 'PRI' in the KEY column, therefore the 'table' appears to have no primary key.
Download (untitled) / with headers
text/plain 1.3k
On Mer. 17 Mag. 2006 06:00:07, guest wrote: Show quoted text
> On Mer. 17 Mag. 2006 05:42:43, guest wrote:
> > On Dom. 15 Gen. 2006 23:11:25, lloy0076@adam.com.au wrote: > > [snip] > >
> > > So I guess the description of my bug is: > > > > > > "Class::DBI::Loader" (specifically when used with MySQL) does not > > > setup > > > views correctly and instead croaks with: > > > > > > Initializing "POS::CreditnotesIncomplete" at > > > /usr/local/share/perl/5.8.7/Class/DBI/Loader/Generic.pm line 192. > > > creditnotes_incomplete has no primary key at > > > /usr/local/share/perl/5.8.7/Class/DBI/Loader/Generic.pm line 196" > > > > > > That appears to be where it checks for a primary key. > > > > > > I'm not sure how this might be fixed - skipping views -might- work... > > > > > > DSL
> > > > > > I have this problem too. > > > > Until now my solution has been to avoid CDBI::Loader and setup classes > > for my views manually.
> > > Class::DBI::mysql identifies primary keys by issuing a DESCRIBE <table> > query and looking at the KEY column. Any table column which has 'PRI' > goes into the 'Primary' column group. > > The problem is that when you issue a DESCRIBE <table> on a view, none of > the view columns has 'PRI' in the KEY column, therefore the 'table' > appears to have no primary key.
Moved to http://rt.cpan.org/Public/Bug/Display.html?id=19303


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.