Ok, this seems like a duplicate question to this: http://stackoverflow.com/questions/1545893/sql-super-search but it's a different approach. Before I was looking for a lean and efficient way to do this entirely on the database side, but now I was wondering if anyone knoew how to do something like this in Ruby.
I've tried this, and while I can run a basic
*SELECT table_name, column_name FROM INFORMATION_SCHEMA.COLUMNS*
I can't seem to run subsequent queries without getting
' WARNING: #<ODBC::Statement:0x2c73e84> was not dropped before garbage collection. '
Can someone show me a really easy way to just run sql text and parse the results (and ideally run more queries based on those results)?
EDIT: To clarify, my db code so far is along the lines of:
oConn = DBI.connect('DBI:ODBC:AX')
oConn2 = DBI.connect('DBI:ODBC:AX')
sth = oConn.execute("Select table\_name, column\_name from information\_schema.columns")
sth.fetch do |row|
table = row["table\_name"]
column = row["column\_name"]
puts table + "," + column
#Dynamic sql here
sth2.fetch do |row2|
puts row2[0]
end
end
sth.finish