I am using sqlite3 as follows:
db = SQLite3::Database.open "data.db"
stm = db.prepare "SELECT * FROM COMPANIES"
rs = stm.execute
while (row = rs.next) do
name = row[1]
that is, the row is an array instead of a hash. Is there a way to read it as a hash, so that
row[:name]
row[:address]
is the data. That's because in the future, if the table has a different order of columns, row[3]
may become row[5]
, so row[:address]
is much more definite.