Created
January 13, 2009 19:34
-
-
Save dbussink/46583 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/do_mysql/ext/do_mysql_ext/do_mysql_ext.c b/do_mysql/ext/do_mysql_ext/do_mysql_ext.c | |
| index 8f12e6e..9828265 100755 | |
| --- a/do_mysql/ext/do_mysql_ext/do_mysql_ext.c | |
| +++ b/do_mysql/ext/do_mysql_ext/do_mysql_ext.c | |
| @@ -391,8 +391,7 @@ static MYSQL_RES* cCommand_execute_async(VALUE self, MYSQL* db, VALUE query) { | |
| VALUE connection = rb_iv_get(self, "@connection"); | |
| - retval = mysql_ping(db); | |
| - if(retval == CR_SERVER_GONE_ERROR) { | |
| + if(mysql_ping(db) && mysql_errno(db) == CR_SERVER_GONE_ERROR) { | |
| CHECK_AND_RAISE(retval, "Mysql server has gone away. \ | |
| Please report this issue to the Datamapper project. \ | |
| Specify your at least your MySQL version when filing a ticket"); | |
| @@ -496,9 +495,6 @@ static VALUE cConnection_initialize(VALUE self, VALUE uri) { | |
| // mysql_ssl_set(db, key, cert, ca, capath, cipher) | |
| // } | |
| - my_bool reconnect = 1; | |
| - mysql_options(db, MYSQL_OPT_RECONNECT, &reconnect); | |
| - | |
| result = (MYSQL *)mysql_real_connect( | |
| db, | |
| host, | |
| @@ -514,6 +510,9 @@ static VALUE cConnection_initialize(VALUE self, VALUE uri) { | |
| raise_mysql_error(Qnil, db, -1, NULL); | |
| } | |
| + my_bool reconnect = 1; | |
| + mysql_options(db, MYSQL_OPT_RECONNECT, &reconnect); | |
| + | |
| // Set the connections character set | |
| encoding_error = mysql_set_character_set(db, encoding); | |
| if (0 != encoding_error) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment