Cannot Count rows in a SQL 2005 Result Set #2703

Closed
lepiou opened this Issue Oct 8, 2012 · 3 comments

Comments

Projects
None yet
5 participants

lepiou commented Oct 8, 2012

Hi

I've got the same problem as http://framework.zend.com/issues/browse/ZF2-281 with sqlsrv driver and SQL Server 2005 database.

Any solution ?

Thanks

Contributor

bartko-s commented Nov 30, 2012

Same problem with sqlite driver

The problem seems to exist with any SQL Server version. This comes from the following remark :

"sqlsrv_num_rows requires a client-side, static, or keyset cursor, and will return false if you use a forward cursor or a dynamic cursor. (A forward cursor is the default.)"

seen on http://msdn.microsoft.com/en-us/library/ee376931(v=sql.105).aspx

The problem is that Zend Framework doesn't seem to allow using any type of forward cursor.

So it means that the function sqlsrv_num_rows() and so the function AbstractResultSet::count() will always return false.

My recommandation would be :

  • either ZF2 provides a way to use forward cursors
  • either ResultSet should throw an exception with a proper message in method count() to explain the problem

Thanks
Laurent

Contributor

ThaDafinser commented Nov 5, 2013

@bartko-s @lmirguet @lepiou is this still a problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment