Revert "libmysql only allows one query be sent at a time per connection, bail early if that's attempted"

This reverts commit 3ff7baa5f8.
This commit is contained in:
Brian Lopez 2010-08-03 20:22:44 -07:00
parent 3ff7baa5f8
commit 1a70e83a74
1 changed files with 1 additions and 13 deletions

View File

@ -225,9 +225,6 @@ static VALUE rb_mysql_client_async_result(VALUE self) {
return Qnil; return Qnil;
} }
// we have a result, mark this connection inactive
rb_iv_set(self, "@active", Qfalse);
VALUE resultObj = rb_mysql_result_to_obj(result); VALUE resultObj = rb_mysql_result_to_obj(result);
// pass-through query options for result construction later // pass-through query options for result construction later
rb_iv_set(resultObj, "@query_options", rb_obj_dup(rb_iv_get(self, "@query_options"))); rb_iv_set(resultObj, "@query_options", rb_obj_dup(rb_iv_get(self, "@query_options")));
@ -243,22 +240,13 @@ static VALUE rb_mysql_client_query(int argc, VALUE * argv, VALUE self) {
fd_set fdset; fd_set fdset;
int fd, retval; int fd, retval;
int async = 0; int async = 0;
VALUE opts, defaults, active; VALUE opts, defaults;
MYSQL *client; MYSQL *client;
Data_Get_Struct(self, MYSQL, client); Data_Get_Struct(self, MYSQL, client);
REQUIRE_OPEN_DB(client); REQUIRE_OPEN_DB(client);
args.mysql = client; args.mysql = client;
active = rb_iv_get(self, "@active");
// see if this connection is still waiting on a result from a previous query
if (NIL_P(active) || active == Qfalse) {
// mark this connection active
rb_iv_set(self, "@active", Qtrue);
} else {
rb_raise(cMysql2Error, "This connection is still waiting for a result, try again once you have the result");
}
defaults = rb_iv_get(self, "@query_options"); defaults = rb_iv_get(self, "@query_options");
if (rb_scan_args(argc, argv, "11", &args.sql, &opts) == 2) { if (rb_scan_args(argc, argv, "11", &args.sql, &opts) == 2) {
opts = rb_funcall(defaults, intern_merge, 1, opts); opts = rb_funcall(defaults, intern_merge, 1, opts);