| Message: 48787 |
 |
BY: Rakesh Ramakrishnan (rakesh) DATE: 2008-03-10 15:11 SUBJECT: FreeTDS + Ruby DBI + MS Sql hi all,
I am using Ruby DBI + FreeTDS + MS Sql Server 2005 for my development. I was successful in making a connection to the database and execute different database operations. But I have problems in retrieving the metadata about columns in a table. I am trying to retrieve the primary keys of a table but I am not able to do so. I have pasted the sample code below which fails
DBI.connect('dbi:ODBC:tosqlserver', 'xyz', 'abcde') do | dbh |
sth = dbh.execute('select * from DataPreprocess')
rows = sth.fetch_all
puts sth.methods
sth.column_info.each_with_index do |info,i|
printf "primary: %s\n",info["primary"]
end
sth.finish
end
Could u please suggest a solution or an alternate way to retrieve the primary keys of the table ? | |