You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the IBM i DB2 environment, when using "order by", the limit method of Zend_Db_Adapter_Db2 does not work in the following code section.(I can't try it with DB2 LUW in my environment)
/** * DB2 does not implement the LIMIT clause as some RDBMS do. * We have to simulate it with subqueries and ROWNUM. * Unfortunately because we use the column wildcard "*", * this puts an extra column into the query result set. */return"SELECT z2.* FROM ( SELECT ROW_NUMBER() OVER() AS \"ZEND_DB_ROWNUM\", z1.* FROM (" . $sql . " ) z1 ) z2 WHERE z2.zend_db_rownum BETWEEN " . ($offset+1) . " AND " . ($offset+$count);
I think the problem is that ORDER BY is not included in OVER(). I also think this method is especially complicated because the LIMIT,OFFSET function was not implemented in previous versions of DB2, and the method was to emulate it.
Modern versions implement LIMIT,OFFSET, so it may be possible to write it simply. However, this method comes at the expense of some older version users...
Therefore, I will be posting two proposed code patterns in a pull request.
The text was updated successfully, but these errors were encountered:
In the IBM i DB2 environment, when using "order by", the limit method of Zend_Db_Adapter_Db2 does not work in the following code section.(I can't try it with DB2 LUW in my environment)
I think the problem is that
ORDER BY
is not included inOVER()
. I also think this method is especially complicated because theLIMIT,OFFSET
function was not implemented in previous versions of DB2, and the method was to emulate it.Modern versions implement
LIMIT,OFFSET
, so it may be possible to write it simply. However, this method comes at the expense of some older version users...Therefore, I will be posting two proposed code patterns in a pull request.
The text was updated successfully, but these errors were encountered: