Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: statement.connection is a DB::Connection (expected PG::Connection) #276

Merged
merged 1 commit into from
Nov 6, 2023
Merged

Fix: statement.connection is a DB::Connection (expected PG::Connection) #276

merged 1 commit into from
Nov 6, 2023

Conversation

ysbaddaden
Copy link
Contributor

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.

@will will merged commit 2040417 into will:master Nov 6, 2023
1 check passed
@will
Copy link
Owner

will commented Nov 6, 2023

Thanks!

@ysbaddaden ysbaddaden deleted the patch-1 branch November 7, 2023 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants