From: rpardee@... (Roy Pardee) Date: 2004-10-15T09:49:30+09:00 Subject: Re: nuby: advice sought on data-slinging script Thanks very much! I'll check ruby-dbi out. Cheers, -Roy Robo wrote in message news:... > Roy Pardee wrote: > > Are there better libs for these things? Are there alternatives to > > iterating over an ADO Recordset? Is there a native encryption lib > > that I can feed a gpg-generated public key to for the encryption? Any > > and all advice would be most welcome. > > > > Thanks! > > > > -Roy > > You may like to try the ruby-dbi (http://ruby-dbi.rubyforge.org/) for > accessing the database, it provides a database independent interface. > Even if you'll only be using mssql, I find the dbi more usable anyway. > > After connecting to the db, you can basically create the tab delimited > file by (untested): > > dbh = DBI.connect(url, user, pass) > > f = File.new("dump.txt", "w+") > sql = "SELECT..." > dbh.execute(sql) do |result| > result.column_names do |col| > f.puts col.join("\t") > end > > result.fetch_array do |row| > f.puts row.join("\t") > end > end > f.close