How do I convert a datatype of SQL_INTEGER to SQL_C_BIGINT?
I have an odbc driver that is used by power BI to interact with a datasource. During the call SQLColAttribute, the driver passes the column type as SIGNED SQL_INTEGER. However, when the SQLFetchData is called by the client, it is expecting the datatype to be SQL_C_BIGINT. So basically, I want to convert the data of type SQL_INTEGER to SQL_C_BIGINT before passing it back to the client(power bi).
The challenge I am having is that I am not able to get the format in which a SQL_C_BIGINT is expected in the driver. If I do a simple cast, the data is appearing incorrectly in the client.
SQLRETURN SQLGetData(SQLHSTMT StatementHandle,
SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
SQLPOINTER TargetValue, SQLLEN BufferLength,
SQLLEN *StrLen_or_Ind)
{
//TargetType is SQL_C_BIGINT
// Assuming that I have my data in p, how do I copy it to TargetValue so that it is read as SQL_C_BIGINT by the client???
}
SQL_C_BIGINT is basically an 8 byte integer. All I had to do is assign the value to _int64 variable and pass it back.