From: Charles Mills Date: 2005-01-08T07:21:26+09:00 Subject: Re: DBI Question Dominik Werder wrote: > Hello! > > while using dbi (with postgres) I wondered if there is sth similar to > dbhost#select_all(sql) for prepared statements. > > I got a hint to do: > > s = dbh.prepare(sql) > dbh.select_all s > > but this doesnt work (I get a driver error) and I also wondered why there > can't be a #select_all for a prepared statement itself like: > > s = dbh.prepare(sql) > array = s.select_all > > wouldn't this be much easier? I haven't used the postgres driver but if it is DBI complient you should be able to do the following: ####### stmt = db.prepare(sql) # stmt.bind(*vars) <--- optional array = stmt.execute.fetch_all stmt.finish # free resources / locks held by the statement ####### -Charlie