Looking at the docs here:
http://ruby.scripting.ca/postgres/reference.html
there doesn't appear to be an easy way to get an associative row of rows returns. Looking in Rails
PG code, I see this convolution:
def select(sql, name = nil) res = execute(sql, name) results = res.result rows = []
if results.length > 0 fields = res.fields results.each do |row| hashed_row = {}
row.each_index do |cel_index| column = row[cel_index] if res.type(cel_index) ==
BYTEA_COLUMN_TYPE_OID column = unescape_bytea(column) end
hashed_row[fields[cel_index]]= column end rows << hashed_row end end
returnrows end
Is there a much easier and simpler way?
csn
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com