Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.2.2dev1

Bug #12942 generating non-valid sql
Submitted: 2008-01-21 08:48 UTC
From: mikewebio Assigned: olivierg
Status: Closed Package: Structures_DataGrid_DataSource_DataObject (version 0.2.1)
PHP Version: 5.2.1 OS: win
Roadmaps: (Not assigned)    
Subscription  


 [2008-01-21 08:48 UTC] mikewebio (Mike Rehacek)
Description: ------------ Hi All, thanks first for your stuff :) , maybe i found small bug in formbulder integration with datagrid source DB_DataObject . When in dataObject class is specified for ex.: $this->fb_linkOrderFields = array('name'); (or var $fb_linkOrderFields = array('name') (the default sort for datagrid ? ) . when you display the datagrid its ok. but when you want to short by the column with name = "name" ;). in the generated query - ORDER BY section its duplications : ORDER BY [name] ASC , [name] : this sql syntax caused errors for ex. in MSSQL 2005. (dont know if in mysql) . Still exist when i set $datagridOptions["formbuilder_integration"] = false; Test script: --------------- 1) specifiy db_dataobject 2) var $fb_linkOrderFields = array('name') 3) render datagrid 4) click to column called "name" // ?orderBy=name&direction=ASC 5) look at generated query (duplicated ORDER BY [name] ASC , [name] ) 6) this cause sql error in MSSQL 2005 Expected result: ---------------- remove duplicated order by or correct formbulder integration Actual result: -------------- [nativecode=169 - A column has been specified more than once in the order by list. Columns in the order by list must be unique.]

Comments

 [2008-04-07 13:55 UTC] olivierg (Olivier Guilyardi)
Thank you Mike for your report. This has been fixed in CVS. The fb_linkOrderFields property is now ignored when the datagrid sorts the data by itself (eg: when you click on a column). This way it really acts as default ordering.
 [2008-06-04 18:31 UTC] mikewebio (Mike Rehacek)
Cool, sorry once more for my english. Thanks for a good work :)