Skip to content

Instantly share code, notes, and snippets.

@sdogruyol
Created September 10, 2016 15:00
Show Gist options
  • Save sdogruyol/5553ecd9bd4ace669db2825542d7f481 to your computer and use it in GitHub Desktop.
Save sdogruyol/5553ecd9bd4ace669db2825542d7f481 to your computer and use it in GitHub Desktop.
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