SAP/odbc-cpp-wrapper

No Suitable Conversion Between odbc::Int and Int32

ffreality opened this issue · 1 comments

I am working on Unreal Engine 5 plugin based on this library.
https://github.com/FF-Plugins-Active/FF_DB_SAPODBC/blob/main/Source/FF_DB_SAPODBC/Private/SAP_ODBC_Connection.cpp#L402

One of my function is trying to read integer value like this but Visual Studio 2022 gives no suitable conversion error between
int32 and odbc::Int

Unreal's int32 is same with std::int32_t

I tried static_cast and reinterpret_cast but it doesn't work.

Hi @ffreality,

The odbc::Int is a Nullable type. Therefore, you have to check first whether it is NULL or not. Then, you can get the value using operator*().

   while (this->QueryResultPtr->get()->next())
  {
	odbc::Int value = this->QueryResultPtr->get()->getInt(ColumnIndex);
        if (!value.isNull())
	    TempArray.Add(*value);
   }

Kind regards,
Max