When requiring multiple database drivers (e.g. mysql or sqlite3 in addition to pg), compilation will fail:
In lib/pg/src/pg/result_set.cr:18:51
18 | @sized_io = Buffer.new(conn.soc, 1, statement.connection)
^---------
Error: expected argument #3 to 'PG::ResultSet::Buffer.new' to be PG::Connection, not DB::Connection
As long as we don't require any other DB driver, statement.connection will always be PG::Connection as expected, but when requiring multiple drivers, it will be DB::Connection+. The solution is to make an explicit cast.
When requiring multiple database drivers (e.g.
mysql
orsqlite3
in addition topg
), compilation will fail:As long as we don't require any other DB driver,
statement.connection
will always bePG::Connection
as expected, but when requiring multiple drivers, it will beDB::Connection+
. The solution is to make an explicit cast.