Skip to content

Instantly share code, notes, and snippets.

@asm
Created June 26, 2010 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asm/453744 to your computer and use it in GitHub Desktop.
Save asm/453744 to your computer and use it in GitHub Desktop.
diff --git a/do_mysql/ext/do_mysql/do_mysql.c b/do_mysql/ext/do_mysql/do_mysql.c
index acc3f2c..926f1a6 100755
--- a/do_mysql/ext/do_mysql/do_mysql.c
+++ b/do_mysql/ext/do_mysql/do_mysql.c
@@ -450,6 +450,7 @@ static MYSQL_RES* cCommand_execute_async(VALUE self, VALUE connection, MYSQL* db
struct timeval start;
const char* str = rb_str_ptr_readonly(query);
size_t len = rb_str_len(query);
+ MYSQL_RES* result;
if((retval = mysql_ping(db)) && mysql_errno(db) == CR_SERVER_GONE_ERROR) {
full_connect(connection, db);
@@ -485,7 +486,12 @@ static MYSQL_RES* cCommand_execute_async(VALUE self, VALUE connection, MYSQL* db
CHECK_AND_RAISE(retval, query);
data_objects_debug(connection, query, &start);
- return mysql_store_result(db);
+ result = mysql_store_result(db);
+
+ if (!result)
+ CHECK_AND_RAISE(mysql_errno(db), query);
+
+ return result;
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment