Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #5260 (closed defect: duplicate)

Opened 4 years ago

Last modified 5 months ago

[PATCH] MySQL adapter should use CLIENT_MULTI_RESULTS to allow stored procedures

Reported by: llasram@gmail.com Assigned to: David
Priority: normal Milestone:
Component: ActiveRecord Version:
Severity: normal Keywords: mysql
Cc:

Description

Attempting to call a MySQL stored procedure via the ActiveRecord MySQL connection adapter results in the following MySQL error:

PROCEDURE <procedure> can't return a result set in the given context

This can be corrected by passing the CLIENT_MULTI_RESULTS flag to the Mysql::real_connect method.

A patch implementing this change is attached to this ticket.

Attachments

mysql_client_multi_results.diff (1.0 kB) - added by llasram@gmail.com on 06/01/06 19:21:45.
MySQL Connection Adapter CLIENT_MULTI_RESULTS Patch
mysql_client_flags.diff (1.1 kB) - added by llasram@gmail.com on 06/04/06 00:17:21.
Patch to allow Rails users to specify MySQL connection flags in their config/database.yml file

Change History

06/01/06 19:21:45 changed by llasram@gmail.com

  • attachment mysql_client_multi_results.diff added.

MySQL Connection Adapter CLIENT_MULTI_RESULTS Patch

06/03/06 21:13:42 changed by david

What are the side-effects to doing this? (aka why isn't this the default setting of the MySQL connector)

06/04/06 00:14:43 changed by llasram@gmail.com

The CLIENT_MULTI_RESULTS flag is part of version-/feature-negotiation between the MySQL client and server. This particular feature requires both the client and server to be greater than version 4.1.1.

As -- on reflection -- this may be an unacceptable constraint, I've attached a different patch which instead allows the Rails user to specify her desired MySQL connection flags in her config/database.yml file. The code-as-patched expects the flags to be a sequence of named constants in the Mysql module. For example:

example:
  adapter: mysql
  database: exampledb
  host: localhost
  flags: [ CLIENT_MULTI_RESULTS ]

06/04/06 00:17:21 changed by llasram@gmail.com

  • attachment mysql_client_flags.diff added.

Patch to allow Rails users to specify MySQL connection flags in their config/database.yml file

09/09/06 14:55:49 changed by llasram

I realize that the RoR team has a lot on their plate, but could someone take another look at the second version of this patch? It doesn't modify the behavior of ActiveRecord w/ MySQL unless the user specifies a 'flags' key in their config, but with the 'flags' key allows users to specify any MySQL connection flags they desire. Would it help to get this applied if I contributed a documentation patch as well?

Thanks.

09/11/09 23:14:26 changed by bitsweat

  • status changed from new to closed.
  • resolution set to duplicate.