You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keith T. Garner edited this page Apr 4, 2014
·
1 revision
#!/usr/bin/env ruby## This ruby example requires the ruby odbc library which can be found# at http://www.ch-werner.de/rubyodbc/ Unfortunately, this isn't available# as a gem as of yet.require'odbc'ODBC::connect("retstest","Joe","Schmoe")do |dbc|
statement="SELECT ListingID,ListDate" +
" FROM data:Property:ResidentialProperty" +
" WHERE ListPrice > 0"dbc.run(statement)do |stmt|
puts"Search result has #{stmt.ncols} columns"print"Search Result has #{stmt.nrows} rows\n\n"colno=1stmt.columnsdo |col|
puts"col[#{colno}]: #{col.name}#{col.type}#{col.length}"colno += 1endputsstmt.each{ |row| putsrow.join(" ")}endend