Created
September 10, 2016 15:00
-
-
Save sdogruyol/5553ecd9bd4ace669db2825542d7f481 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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