From: paul vudmaska Date: 2003-10-12T04:45:18+09:00 Subject: Re: mysql_num_rows equivalent for DBI? --- Ben Giddings wrote: > Is there a database-independent way of finding out > how many rows were > returned by a given query using Ruby DBI? Every > method I've looked at that > seems like a candidate has not yielded a reasonable > result. I suppose I > could do fetch_all.size, but that seems wasteful. > > In case it matters I'm using PostgreSQL as the > database. > > Ben What i think you are looking for is recordset#rows - Returns the RPC (Row Processed Count) of the last executed statement, or nil if no such exists. From this page:http://ruby-dbi.sourceforge.net/DBD_SPEC.html You might check out this page too http://www.kitebird.com/articles/ruby-dbi.html#TOC_1 Which seems to be down now but provides some good examples, if i recall, of rows. Ive had success with this with mysql - but using dbi, it should not matter if you're using postegres. :paul __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com