Last active
November 1, 2017 14:31
-
-
Save valenciaj/534b5c820462db808eac13ba6c392614 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
require "kemal" | |
require "mysql" | |
module KemalPoolDBTest | |
DB_URL = "mysql://javier@localhost/customers?initial_pool_size=10" | |
dbpool = DB:open DB_URL | |
get "/" do | |
dbpool.using_connection do |db| | |
temp = db.query_all "SELECT id, name, created_at FROM customers", as: { Int64, String, Time } | |
temp.inspect | |
end | |
end | |
Kemal.run | |
end |
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
+-----+--------+-----------------+-----------+---------+------+----------+------------------+ | |
| Id | User | Host | db | Command | Time | State | Info | | |
+-----+--------+-----------------+-----------+---------+------+----------+------------------+ | |
| 211 | javier | localhost | NULL | Query | 0 | starting | SHOW PROCESSLIST | | |
| 222 | javier | localhost:53684 | customers | Sleep | 14 | | NULL | | |
| 223 | javier | localhost:53684 | customers | Sleep | 14 | | NULL | | |
| 224 | javier | localhost:53686 | customers | Sleep | 14 | | NULL | | |
| 225 | javier | localhost:53688 | customers | Sleep | 14 | | NULL | | |
| 226 | javier | localhost:53690 | customers | Sleep | 14 | | NULL | | |
| 227 | javier | localhost:53692 | customers | Sleep | 14 | | NULL | | |
| 228 | javier | localhost:53694 | customers | Sleep | 14 | | NULL | | |
| 229 | javier | localhost:53696 | customers | Sleep | 14 | | NULL | | |
| 230 | javier | localhost:53698 | customers | Sleep | 14 | | NULL | | |
| 231 | javier | localhost:53700 | customers | Sleep | 14 | | NULL | | |
+-----+--------+-----------------+-----------+---------+------+----------+------------------+ | |
11 rows in set (0,00 sec) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment