Issues

ZF-7221: Zend_Db_Select::_renderOrder() incorrectly converts integers to quoted identifiers

Issue Type: Bug Created: 2009-07-07T22:00:36.000+0000 Last Updated: 2009-09-18T15:44:18.000+0000 Status: Resolved Fix version(s): - 1.9.3 (22/Sep/09)

Reporter: Phil Brown (philbrown) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Db_Select

Related issues: Attachments: - ZF7221.diff

Description

This is a perfectly valid SQL query (in Oracle anyway)

<pre class="highlight">
SELECT * FROM TABLE ORDER BY 1 ASC

however, setting the order clause using $select->order(1) causes the query to be assembled as

<pre class="highlight">
SELECT "TABLE".* FROM "TABLE" ORDER BY "1" ASC

which fails with Zend_Db_Statement_Oracle_Exception: 904 ORA-00904: "1": invalid identifier

Comments

Posted by Benjamin Eberlei (beberlei) on 2009-09-18T13:27:11.000+0000

ORDER BY [ASC|DESC] is a valid syntax in ANSI Sql:

http://savage.net.au/SQL/sql-92.bnf.html/…

For all the Databases see: Mysql http://dev.mysql.com/doc/refman/5.1/de/select.html Oracle http://download.oracle.com/docs/cd/… Postgres http://postgresql.org/docs/8.4/… Sqlite http://www.sqlite.org/lang_select.html Mssql http://doc.ddart.net/mssql/sql70/…

Order by should allow specifying positive integers.

Posted by Benjamin Eberlei (beberlei) on 2009-09-18T14:33:17.000+0000

Patch plus 3 tests

Posted by Benjamin Eberlei (beberlei) on 2009-09-18T15:44:05.000+0000

Fixed in trunk and merged into 1.9 release branch

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts