From: Alfredo Y. <alf...@gm...> - 2006-03-02 12:28:34
|
Hi Darious, I use a code like this: $SQL =3D "select * from table1"; $SQLCount =3D "select count(*) from ($SQL)"; Then I use $SQLCount to know the row count, and $SQL with a SelectLimit But Im afraid the cost of this two queries is more than double the original ($SQL) query Any better idea? greetings, On 3/2/06, Darius <da...@m2...> wrote: > > Hi all, > > we have also the same problem. > With selectLimit(..) I retrieve only needed rows. But there need to know > count of all rows. > In MySQL I can do this with SQL_CALC_FOUND_ROWS. What is solution in AdoD= B > ? > > Best regards, > Darius > > > Marcin Szkudlarek wrote: > > > Thanks for reply. You are right - I want to implement paging but it"s > > not that simple. I want to select 100 rows from 50k table but I don"t > > know how much rows I have to fetch to get the 100 .. it could be in > > the WORST case the last 100 from the whole 50k table. I"t because I"m > > checking access rights to every row in php and then diplaying it or > > not. So your example with selecting only first 100 rows from the table > > woudn"t work here. If there isn"t a way to fetch the result row by row > > I"ll have to reimplement some ugly code. > > > You have just described the classic poorly designed application. ;-) > > >If there"s something in the data that you can look at and determind > >access rights in PHP, then you should move that logic to your SQL query > >and select only the rows you"re interested in. > > > > > Best regards, > > > > Marcin Szkudlarek > > > > On Fri, 24 Jun 2005, Emil Zegers wrote: > > > >> What do you exactly mean by "fetching the rows"? > >> > >> If you want to do a row count then your query could be something like > >> "SELECT COUNT(*) FROM TABLENAME" > >> > >> If you want to get only a certain amount of rows you can do something > >> like "SELECT TOP 100 * FROM TABLENAME". > >> > >> Also take a look at paging options. > >> > >> If you do want to get the data in a recordset for manipulation you > >> really have to fetch it. > >> > >> You can limit the data (and thus the query time) by selecting only the > >> columns needed. > >> > >> Regards, > >> > >> Emil > >> > >> -----Original Message----- > >> From: adodb-general-admin@li... > >> [mailto:adodb-general-admin@li...] On Behalf Of Marcin > >> Szkudlarek > >> Sent: vrijdag 24 juni 2005 11:49 > >> To: adodb-general@li... > >> Subject: [ADodb-general] adodb execute method > >> > >> Hi! > >> > >> I"m using ado 4.62 with oracle 8.17. My question: > >> is there a way to execute select query without getting all the results= ? > >> I have a table with about 50k records and calling only the execute > >> method takes about 1,8s. What I want to achieve is fetching the rows > >> without having to get all the data at once. > >> > >> Thanks. > >> > >> Marcin Szkudlarek -- Alfredo Yong Sistemas web |