Address the remaining medium/low SQLSlave issues:
- #749: add a dedicated QS_CONNECT_FAILED result code so softcode can tell
"unreachable" from "connection refused/bad credentials". ConnectionHelper()
now returns whether a live session was established; Query() maps a failed
reconnect to QS_CONNECT_FAILED and a still-dead ping to QS_SQL_UNAVAILABLE.
fun_rserror() renders it as "#-5 CONNECT_FAILED".
- #750: capture mysql_next_result() > 0 (error) while draining stored-procedure
result sets and report QS_QUERY_ERROR rather than silently succeeding.
- #751: check the return value of every mysql_options() call.
- #752: remove the empty thread-id "detected reconnection" block (dead code);
the charset option is reapplied by the client across auto-reconnect.
- #753: narrow the two component-allocation catch(...) blocks to
catch(std::bad_alloc) so non-allocation exceptions are no longer masked.
Errors are logged via a best-effort ILog acquired in FinalConstruct(); when
the component runs in the slave process (no CID_Log there) logging is skipped
and the result codes still propagate to softcode.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address the high-priority SQLSlave issues plus a latent compile error that
only surfaces once HAVE_MYSQL is enabled:
- #745: CQueryServer/CQueryServerFactory m_cRef -> std::atomic<uint32_t>
with fetch_add(relaxed)/fetch_sub(acq_rel), matching comsys/mail. Closes
the decrement/zero-check double-delete race.
- #746: g_cComponents/g_cServerLocks -> std::atomic<int32_t>.
- #747: Connect() rejects null server/database/user/password rather than
letting mysql_real_connect() and ConnectionHelper() dereference them.
- #748: copy the connection parameters into module-owned std::strings
instead of aliasing and delete[]-ing the caller's buffers. The old code
delete[]'d mudconf-owned storage in-process and stack buffers across the
proxy/stub boundary (lib/libmux.cpp CQueryControlStub::Invoke).
- #764: mysql_real_query() was called with a const-stripping
reinterpret_cast<char *> on a const UTF8 *, a hard -std=c++17 error that
broke the build whenever a MySQL client library is present. Cast to
const char * (the parameter type) instead.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>