USER = "user"
PASS = "pass"
QUERY = "SELECT c1, c2, c3, c4, c5, c6, c7 FROM table"
SQLITE_SCHEMA = 'c1, c2, c3, c4, c5, c6, c7'
sqlite_db = SQLite3::Database.new('sqlite.db')
odbc_db = DBI.connect('DBI:ODBC:database', USER, PASS)
odbc_db.select_all(QUERY) do |entry|
sqlite_db.execute "insert into smnt (" + SQLITE_SCHEMA + ") values ('" + entry[0].to_s + "','" +
entry[1].to_s + "','" +
entry[2].to_s + "','" +
entry[3].to_s + "','" +
entry[4].to_s + "','" +
entry[5].to_s + "','" +
entry[6].to_s + "')"
end
There must be a cleaner way to write the db.execute string, or am I being picky?