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

Bug #9871 Field names like SPEED_LIMIT truncated
Submitted: 2007-01-18 19:00 UTC
From: michael dot mauch at gmx dot de Assigned: olivierg
Status: Closed Package: Structures_DataGrid_DataSource_MDB2 (version 0.1.4)
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2007-01-18 19:00 UTC] michael dot mauch at gmx dot de (Michael Mauch)
Description: ------------ A query like select SPEED_LIMIT from MY_TABLE is truncated at LIMIT. The culprit is in Structures/DataGrid/DataSource/MDB2.php: // drop LIMIT statement $query = preg_replace('#LIMIT\s.*$#isD', '', $query); Test script: --------------- SQL to create a test table: create table xxx_test (speed_limit integer); insert into xxx_test values(100); commit; <?php require 'Structures/DataGrid.php'; $datagrid =& new Structures_DataGrid(); require 'sql_user_and_password'; $options = array('dsn' => "mysql://$sql_user:$sql_password@localhost/test"); $test = $datagrid->bind('select SPEED_LIMIT from XXX_TEST', $options); if (PEAR::isError($test)) { echo $test->getMessage(),' | ',$test->getUserInfo(); } $test = $datagrid->render(); ?> Expected result: ---------------- The query should work and field names should not be truncated. It works with the above line changed to: $query = preg_replace('#\sLIMIT\s.*$#isD', ' ', $query); (The '\s' before LIMIT is new, and the replacement is now a space instead of an empty string.) Actual result: -------------- MDB2 Error: no such field | _doQuery: [Error message: Could not execute statement] [Last executed query: select SPEED_] [Native code: 1054] [Native message: Unknown column 'SPEED_' in 'field list']

Comments

 [2007-01-19 10:35 UTC] olivierg at php dot net (Olivier Guilyardi)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Structures_DataGrid_DataSource_MDB2