-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Paginator\Adapter\DbSelect custom query for count #5518
Conversation
Out of curiosity, what's the motivation to make it a constant? |
Column name from count query need to be always the same. It helps to use this name in own select. |
Oh, I see. So the expectation for providing your own select that will calculate a count is that the custom select would have to return a resultant with that particular column name. Is that right? |
Exactly! Additionally I can change this to first element of array. |
I like this addition. I'm still thinking about the cross-platform ramifications of not using a column name. What would the code look like? Perhaps: $result = $statement->execute();
$row = $result->current();
return reset($row); ? |
Now this adapter building count select in the same way. |
Let me know when you want me to look at this PR. I think I have a couple of modifications to the API I might make. I wouldn't call the new method With the addition of this solution, I think it provides an outlet for these kinds of problems that crop up in edge cases: #4673 Thoughts? |
First attempt at using subselect to calculate full count
ping. |
@@ -19,6 +19,8 @@ | |||
class DbSelect implements AdapterInterface | |||
{ | |||
|
|||
const ROW_COUNT_COLUMN_NAME = 'c'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this upper case; I know for DB2, lowercase will not work here.
@snapshotpl I manually merged the PR in 5fceff3 Please note that I removed the setter and converted it into an additional constructor argument. |
…ow-count-column-name' into develop Close zendframework/zendframework#5518
No description provided.