fix(Data/MySQL): preserve backwards-compatibility with pre 8.3

This commit is contained in:
Günter Obiltschnig 2024-03-29 11:36:42 +01:00
parent 3d7fbbf314
commit a4c7fc6d03
2 changed files with 10 additions and 0 deletions

View File

@ -80,8 +80,13 @@ void StatementExecutor::bindParams(MYSQL_BIND* params, std::size_t count)
if (count == 0) return;
#if LIBMYSQL_VERSION_ID >= 80300
if (mysql_stmt_bind_named_param(_pHandle, params, count, nullptr) != 0)
throw StatementException("mysql_stmt_bind_named_param() error ", _pHandle, _query);
#else
if (mysql_stmt_bind_param(_pHandle, params) != 0)
throw StatementException("mysql_stmt_bind_param() error ", _pHandle, _query);
#endif
}

View File

@ -205,7 +205,12 @@ void SQLExecutor::bareboneMySQLTest(const char* host, const char* user, const ch
bind_param[4].buffer = &fifth;
bind_param[4].buffer_type = MYSQL_TYPE_FLOAT;
#if LIBMYSQL_VERSION_ID >= 80300
rc = mysql_stmt_bind_named_param(hstmt, bind_param, 5, nullptr);
#else
rc = mysql_stmt_bind_param(hstmt, bind_param);
#endif
assertTrue (rc == 0);
rc = mysql_stmt_execute(hstmt);