R
Raphael Bauduin
Hi,
I'm accessing a mssql server through sqlrelay and dbi.
My problem is that I can't get to the value of a colomn in a row:
the first column returns as value the concatenation of all columns in the row......
Here is the code:
query = "select TOP 10 * from table"
rows = @dbh.select_all(query)
#column 0 of row 0 gives 14559 but should return 1
rows.at(0).at(0)
rows[0][0]
#column 1 of row 0 gives nothing but should return 45
rows.at(0).at(1)
rows[0][0]
#column 2 of row 0 gives nothing but should return 59
rows.at(0).at(1)
rows[0][0]
#joining the elements of the array separates columns fine
#and I use that to make it work, but
rows2=Array.new
rows2=rows.each { |r| rows2.push r.join("--").split(/--/)}
Did anyone of you have the same problem and maybe find a better solution?
I'm using sqlrelay 0.34.3-1, ruby 1.8.1-3, libdbi-ruby1.8 0.0.21-3 on debian.
Thanks.
Raph
I'm accessing a mssql server through sqlrelay and dbi.
My problem is that I can't get to the value of a colomn in a row:
the first column returns as value the concatenation of all columns in the row......
Here is the code:
query = "select TOP 10 * from table"
rows = @dbh.select_all(query)
#column 0 of row 0 gives 14559 but should return 1
rows.at(0).at(0)
rows[0][0]
#column 1 of row 0 gives nothing but should return 45
rows.at(0).at(1)
rows[0][0]
#column 2 of row 0 gives nothing but should return 59
rows.at(0).at(1)
rows[0][0]
#joining the elements of the array separates columns fine
#and I use that to make it work, but
rows2=Array.new
rows2=rows.each { |r| rows2.push r.join("--").split(/--/)}
Did anyone of you have the same problem and maybe find a better solution?
I'm using sqlrelay 0.34.3-1, ruby 1.8.1-3, libdbi-ruby1.8 0.0.21-3 on debian.
Thanks.
Raph