static VALUE set_enable_cleartext_plugin(VALUE self, VALUE value) { #ifdef HAVE_CONST_MYSQL_ENABLE_CLEARTEXT_PLUGIN return _mysql_client_options(self, MYSQL_ENABLE_CLEARTEXT_PLUGIN, value); #else rb_raise(cMysql2Error, "enable-cleartext-plugin is not available, you may need a newer MySQL client library"); #endif }
static VALUE set_secure_auth(VALUE self, VALUE value) { /* This option was deprecated in MySQL 5.x and removed in MySQL 8.0 */ #ifdef MYSQL_SECURE_AUTH return _mysql_client_options(self, MYSQL_SECURE_AUTH, value); #else return Qfalse; #endif }
static VALUE set_write_timeout(VALUE self, VALUE value) { long int sec; Check_Type(value, T_FIXNUM); sec = FIX2INT(value); if (sec < 0) { rb_raise(cMysql2Error, "write_timeout must be a positive integer, you passed %ld", sec); } return _mysql_client_options(self, MYSQL_OPT_WRITE_TIMEOUT, value); }
static VALUE set_read_timeout(VALUE self, VALUE value) { long int sec; Check_Type(value, T_FIXNUM); sec = FIX2INT(value); if (sec < 0) { rb_raise(cMysql2Error, "read_timeout must be a positive integer, you passed %ld", sec); } /* Set the instance variable here even though _mysql_client_options might not succeed, because the timeout is used in other ways elsewhere */ rb_iv_set(self, "@read_timeout", value); return _mysql_client_options(self, MYSQL_OPT_READ_TIMEOUT, value); }
static VALUE set_init_command(VALUE self, VALUE value) { return _mysql_client_options(self, MYSQL_INIT_COMMAND, value); }
static VALUE set_read_default_group(VALUE self, VALUE value) { return _mysql_client_options(self, MYSQL_READ_DEFAULT_GROUP, value); }
static VALUE set_read_default_file(VALUE self, VALUE value) { return _mysql_client_options(self, MYSQL_READ_DEFAULT_FILE, value); }
static VALUE set_secure_auth(VALUE self, VALUE value) { return _mysql_client_options(self, MYSQL_SECURE_AUTH, value); }
static VALUE set_local_infile(VALUE self, VALUE value) { return _mysql_client_options(self, MYSQL_OPT_LOCAL_INFILE, value); }
/* call-seq: * client.reconnect = true * * Enable or disable the automatic reconnect behavior of libmysql. * Read http://dev.mysql.com/doc/refman/5.5/en/auto-reconnect.html * for more information. */ static VALUE set_reconnect(VALUE self, VALUE value) { return _mysql_client_options(self, MYSQL_OPT_RECONNECT, value); }
static VALUE set_connect_timeout(VALUE self, VALUE value) { return _mysql_client_options(self, MYSQL_OPT_CONNECT_TIMEOUT, value); }
static VALUE rb_mysql_client_options(VALUE self, VALUE option, VALUE value) { Check_Type(option, T_FIXNUM); int opt = NUM2INT(option); return _mysql_client_options(self, opt, value); }