Preserve MySQL connection failures across queries
This commit is contained in:
@@ -226,8 +226,10 @@ DValue MySQL::query(String q)
|
||||
}
|
||||
if(!connection)
|
||||
{
|
||||
_preload_next_error_code = CR_UNKNOWN_ERROR;
|
||||
statement_info = "mysql connection is not open";
|
||||
if(_preload_next_error_code == 0)
|
||||
_preload_next_error_code = CR_UNKNOWN_ERROR;
|
||||
if(statement_info == "")
|
||||
statement_info = "mysql connection is not open";
|
||||
return(DValue());
|
||||
}
|
||||
_preload_next_error_code = mysql_query((MYSQL*)connection, q.c_str());
|
||||
|
||||
@@ -287,6 +287,14 @@ DValue MySQL::query(String q)
|
||||
statement_info = "mysql positional ? placeholders are not supported; use named :name placeholders";
|
||||
return(DValue());
|
||||
}
|
||||
if(!connection)
|
||||
{
|
||||
if(_preload_next_error_code == 0)
|
||||
_preload_next_error_code = 2000;
|
||||
if(statement_info == "")
|
||||
statement_info = "mysql connection is not open";
|
||||
return(DValue());
|
||||
}
|
||||
DValue request;
|
||||
request["op"] = "query";
|
||||
request["handle"] = (f64)(uintptr_t)connection;
|
||||
|
||||
Reference in New Issue
Block a user