I am trying to fetch a user-defined opaque column (opaque_col) via the ODBC driver using SQL_C_BINARY to access the internal binary format:
const char* query = "SELECT opaque_col FROM opaque_test";
rc = SQLPrepareA(hstmt, (SQLCHAR*)query, SQL_NTS);;
...
rc = SQLBindCol(hstmt, 1, SQL_C_BINARY, columnValuesBuffer.data(), colSize, columnIndicators.data());
...
rc = SQLExecute(hstmt);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) return 1;
rc = SQLFetch(hstmt); // or SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 0)
if (rc == SQL_ERROR) {
// Expect HY000 / -9634: No cast from <opaque_type_name> to sendrecv (server lacks send/recv).
}
According to Informix documentation:
Use SQL_C_BINARY to access an OPAQUE value in the internal binary format.
However, I get the following error:
No cast from myuuid to sendrecv
Is there a way to fetch a user-defined OPAQUE column in internal binary format using ODBC without using casts or helper functions on the server?