Re: Get number of found records of previously performed find query
Just use the same conditions and query, but change the type from all to count. find("count", array("limit" => 10)); It'll do another query, but it would get the exact number. On Jan 13, 3:44 am, Deine Mutter wrote: > will that execute the same query again as in making a request to the > db or is that automagically retrieved from the cache? or do i need to > configure special cage settings for that? > > On 13 Jan., 07:02, "Dr. Loboto" wrote: > > > Only make same "count" query. > > > On Jan 13, 12:54 am, Deine Mutter > > > wrote: > > > hey as i said count($array) is useless because the array containing > > > the select query result has also a limit clause -> means: count > > > ($array) will always result in the value i gave to the limit clause in > > > my sql statement. > > > > any other ideas? > > > > On 12 Jan., 15:50, scs wrote: > > > > > you could just use the php array count : > > > > > > > > > On Jan 12, 7:21 am, Deine Mutter > > > > > wrote: > > > > > Hey, > > > > > > does Cake give me a way to find out the number of records retrieved by > > > > > a find("all", array("limit" => 10));? It's basically what > > > > > SQL_CALC_FOUND_ROWS in combination with SELECT FOUND_ROWS does. Of > > > > > course i could make the same query twice, first a find("all") and then > > > > > a find("count") without the LIMIT clause, but that doesn't seem very > > > > > clever to me considering performance. > > > > > Is that mabye solved via query caching or sth like that? I'm unable to > > > > > find clues how to solve it anywhere :( > > > > > > Thanks in advance! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Get number of found records of previously performed find query
will that execute the same query again as in making a request to the db or is that automagically retrieved from the cache? or do i need to configure special cage settings for that? On 13 Jan., 07:02, "Dr. Loboto" wrote: > Only make same "count" query. > > On Jan 13, 12:54 am, Deine Mutter > > wrote: > > hey as i said count($array) is useless because the array containing > > the select query result has also a limit clause -> means: count > > ($array) will always result in the value i gave to the limit clause in > > my sql statement. > > > any other ideas? > > > On 12 Jan., 15:50, scs wrote: > > > > you could just use the php array count : > > > > > > > On Jan 12, 7:21 am, Deine Mutter > > > > wrote: > > > > Hey, > > > > > does Cake give me a way to find out the number of records retrieved by > > > > a find("all", array("limit" => 10));? It's basically what > > > > SQL_CALC_FOUND_ROWS in combination with SELECT FOUND_ROWS does. Of > > > > course i could make the same query twice, first a find("all") and then > > > > a find("count") without the LIMIT clause, but that doesn't seem very > > > > clever to me considering performance. > > > > Is that mabye solved via query caching or sth like that? I'm unable to > > > > find clues how to solve it anywhere :( > > > > > Thanks in advance! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Get number of found records of previously performed find query
Only make same "count" query. On Jan 13, 12:54 am, Deine Mutter wrote: > hey as i said count($array) is useless because the array containing > the select query result has also a limit clause -> means: count > ($array) will always result in the value i gave to the limit clause in > my sql statement. > > any other ideas? > > On 12 Jan., 15:50, scs wrote: > > > > > you could just use the php array count : > > > > > On Jan 12, 7:21 am, Deine Mutter > > > wrote: > > > Hey, > > > > does Cake give me a way to find out the number of records retrieved by > > > a find("all", array("limit" => 10));? It's basically what > > > SQL_CALC_FOUND_ROWS in combination with SELECT FOUND_ROWS does. Of > > > course i could make the same query twice, first a find("all") and then > > > a find("count") without the LIMIT clause, but that doesn't seem very > > > clever to me considering performance. > > > Is that mabye solved via query caching or sth like that? I'm unable to > > > find clues how to solve it anywhere :( > > > > Thanks in advance! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Get number of found records of previously performed find query
hey as i said count($array) is useless because the array containing the select query result has also a limit clause -> means: count ($array) will always result in the value i gave to the limit clause in my sql statement. any other ideas? On 12 Jan., 15:50, scs wrote: > you could just use the php array count : > > > On Jan 12, 7:21 am, Deine Mutter > > wrote: > > Hey, > > > does Cake give me a way to find out the number of records retrieved by > > a find("all", array("limit" => 10));? It's basically what > > SQL_CALC_FOUND_ROWS in combination with SELECT FOUND_ROWS does. Of > > course i could make the same query twice, first a find("all") and then > > a find("count") without the LIMIT clause, but that doesn't seem very > > clever to me considering performance. > > Is that mabye solved via query caching or sth like that? I'm unable to > > find clues how to solve it anywhere :( > > > Thanks in advance! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Get number of found records of previously performed find query
you could just use the php array count : On Jan 12, 7:21 am, Deine Mutter wrote: > Hey, > > does Cake give me a way to find out the number of records retrieved by > a find("all", array("limit" => 10));? It's basically what > SQL_CALC_FOUND_ROWS in combination with SELECT FOUND_ROWS does. Of > course i could make the same query twice, first a find("all") and then > a find("count") without the LIMIT clause, but that doesn't seem very > clever to me considering performance. > Is that mabye solved via query caching or sth like that? I'm unable to > find clues how to solve it anywhere :( > > Thanks in advance! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Get number of found records of previously performed find query
Hey, does Cake give me a way to find out the number of records retrieved by a find("all", array("limit" => 10));? It's basically what SQL_CALC_FOUND_ROWS in combination with SELECT FOUND_ROWS does. Of course i could make the same query twice, first a find("all") and then a find("count") without the LIMIT clause, but that doesn't seem very clever to me considering performance. Is that mabye solved via query caching or sth like that? I'm unable to find clues how to solve it anywhere :( Thanks in advance! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en