I suppose that issuing a 'SELECT count(*) ...' before the actual statement would give the data required, however it would affect performance and have a possibility of being inaccurate if it's used on a table that has the potential of being updated by other users. Another option is to fetch all the rows in advance and put them in one array before plotting them, but that could have memory problems depending on how much data is retrieved.
Personally, if the dataset returned were small and there was no danger of running out of system memory I would go with the second option over the first due to the improved performance you get from not having to run the same query twice. Gordon -----Original Message----- From: Stephen Keller [mailto:[EMAIL PROTECTED]] Sent: Friday, April 26, 2002 4:25 PM To: 'Jayce^'; Shao, Chunning Cc: [EMAIL PROTECTED] Subject: RE: Help: how many rows were returned? Jayce writes: > > how many rows are returned, so I can set up my x, y axis right. > > my $number_rows = $csr->rows; > > easy ;D Not so easy: I cite from the DBI perldoc: Generally, you can only rely on a row count after a non-SELECT execute (for some specific operations like UPDATE and DELETE), or after fetching all the rows of a SELECT statement. It won't help Shao unless the query has already executed the statement has fetched all the results. Shao's desire is to know before fetching the data. Stph
