It receives a pgresult table as a result from a SQL query and returns a "table" which really is a Hash-Array.
The new table has the same format than the PGResult table. Something like: "table [0]["fieldname"]"
def fxPGResultToHash (pgresult)
tabla = Array.new(pgresult.num_tuples()) {Hash.new}
tuplas = 0
column = 0
while tuplas < style="font-weight: bold;">
column = 0
while column < style="font-weight: bold;">
tabla[tuplas]["#{pgresult.fieldname(column)}"] = pgresult.result[tuplas][column]
column += 1
end
tuplas += 1
end
Friday, September 5, 2008
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment