Hi, Actually,if there is any other statement just after SQL_CALC FOUND_ROWS then FOUND_ROWS() will not return correct result. so better you use 2 queries,one for data and another for count,which might be faster then these stuff if your database is table is using correct indexes.
Cheers Parvendra On Jan 10, 5:19 pm, Yasuo Shirai <[EMAIL PROTECTED]> wrote: > Hello, > > I attempt to get some list using SQLObject and MySQL and count > number of results using SQL_CALC FOUND_ROWS and FOUND_ROWS() > like this: > > select_statement = "SELECT SQL_CALC_FOUND_ROWS * FROM table1" > count_statement = "SELECT FOUND_ROWS()" > > conn = connectionForURI( config.get( 'sqlobject.dburi' ) ) > results = conn.queryAll( select_statement ) > results2 = conn.queryAll( count_statement ) > num_of_results = results2[0][0] > > However, when this method is called frequently, > the num_of_results value will be wrong. (often '1' ) > > I checked connections of the two queries by using CONNECTION_ID() > function > and found that connection IDs are different when the num_of_results > value is wrong. > > How can I get correct value? > > -- > Yasuo Shirai --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

