@@ -48,8 +48,8 @@ def multi_statements_enabled?
4848 end
4949 end
5050
51- def perform_query ( raw_connection , sql , binds , type_casted_binds , prepare : , notification_payload : , batch : false )
52- reset_multi_statement = if batch && !multi_statements_enabled?
51+ def perform_query ( raw_connection , intent )
52+ reset_multi_statement = if intent . batch && !multi_statements_enabled?
5353 raw_connection . set_server_option ( ::Mysql2 ::Client ::OPTION_MULTI_STATEMENTS_ON )
5454 true
5555 end
@@ -59,22 +59,22 @@ def perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notif
5959 raw_connection . query_options [ :database_timezone ] = default_timezone
6060
6161 result = nil
62- if binds . nil? || binds . empty?
63- result = raw_connection . query ( sql )
62+ if intent . binds . nil? || intent . binds . empty?
63+ result = raw_connection . query ( intent . sql )
6464 # Ref: https://github.com/brianmario/mysql2/pull/1383
6565 # As of mysql2 0.5.6 `#affected_rows` might raise Mysql2::Error if a prepared statement
6666 # from that same connection was GCed while `#query` released the GVL.
6767 # By avoiding to call `#affected_rows` when we have a result, we reduce the likeliness
6868 # of hitting the bug.
6969 @affected_rows_before_warnings = result &.size || raw_connection . affected_rows
70- elsif prepare
70+ elsif intent . prepare
7171 retry_count = 1
7272 begin
73- stmt = @statements [ sql ] ||= raw_connection . prepare ( sql )
74- result = stmt . execute ( *type_casted_binds )
73+ stmt = @statements [ intent . sql ] ||= raw_connection . prepare ( intent . sql )
74+ result = stmt . execute ( *intent . type_casted_binds )
7575 @affected_rows_before_warnings = stmt . affected_rows
7676 rescue ::Mysql2 ::Error => error
77- @statements . delete ( sql )
77+ @statements . delete ( intent . sql )
7878 # Sometimes for an unknown reason, we get that error.
7979 # It suggest somehow that the prepared statement was deallocated
8080 # but the client doesn't know it.
@@ -89,10 +89,10 @@ def perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notif
8989 raise
9090 end
9191 else
92- stmt = raw_connection . prepare ( sql )
92+ stmt = raw_connection . prepare ( intent . sql )
9393
9494 begin
95- result = stmt . execute ( *type_casted_binds )
95+ result = stmt . execute ( *intent . type_casted_binds )
9696 @affected_rows_before_warnings = stmt . affected_rows
9797
9898 # Ref: https://github.com/brianmario/mysql2/pull/1383
@@ -110,8 +110,8 @@ def perform_query(raw_connection, sql, binds, type_casted_binds, prepare:, notif
110110 end
111111 end
112112
113- notification_payload [ :affected_rows ] = @affected_rows_before_warnings
114- notification_payload [ :row_count ] = result &.size || 0
113+ intent . notification_payload [ :affected_rows ] = @affected_rows_before_warnings
114+ intent . notification_payload [ :row_count ] = result &.size || 0
115115
116116 raw_connection . abandon_results!
117117
0 commit comments