Skip to content

Instantly share code, notes, and snippets.

@sdogruyol
Created September 10, 2016 15:00
get "/" do |env|
rs = conn.query("SELECT id, email FROM user")
result_set({Int32, String}, rs)
end
def result_set(types, rs)
rs.each do
rs.column_names.each_with_index do |cn, i|
rs.read(types[i])
end
end
end
def conn
DB.open "mysql://root@localhost/kose_yazarlari"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment