Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Zend\Db\Sql\Select::getSqlString(Zend\Db\Adapter\Platform\Mysql) doesn't work properly with limit param #3224

neilime opened this Issue · 2 comments

3 participants

$oSelect = new \Zend\Db\Sql\Select('table_test');
$oSelect->columns(array('*'))->where(array('test' => 'ok')->limit(1);
echo $oSelect->getSqlString(new Zend\Db\Adapter\Platform\Mysql());
//SELECT `table_test`.* WHERE `table_test`.`test` = 'ok' limit '1'

Limit value should be 1 and not '1'...


This might be a bit late for this, but it looks like the code to write the SQL queries is baked into the query builders - Zend\Db\Sql\Select::process* methods. Shouldn't this be part of the platform implementation? So the above code should really look at Zend\Db\Adapter\Platform\Mysql to write out the actual queries.


Use the SQL Abstraction object (Zend\Db\Sql\Sql):

use Zend\Db\Sql\Sql;
$sql = new Sql($adapter);
$oSelect = $sql->select('table_test');
$oSelect->columns(array('*'))->where(array('test' => 'ok')->limit(1);
$sqlString = $sql->getSqlStringForSqlObject($oSelect);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.