Open rbartholomay opened 6 years ago
ahh... I build the non-unicode version and it runs! Fine!
I figure out where the problem is. In my case the non-unicode works expect with german special chars. Whe I use the unicode version the columns names are crypted like this:
RequeවᲠbズ炄᳠谀蠸ы蠸ы蕠]乨ъシ炄ᶰ谀蟘ы蟘ы": "a3456",
"Aktuell": "B3A2",
"ON胴b쥈琯\u0002蠀宅g": 7071,
So, I am not a c++ guy but I try to change method Column ODBC::GetColumns(SQLHSTMT hStmt, short colCount) to the version from https://github.com/wankdanker/node-odbc:
Column* ODBC::GetColumns(SQLHSTMT hStmt, short* colCount) {
SQLRETURN ret;
SQLSMALLINT buflen;
//always reset colCount for the current result set to 0;
*colCount = 0;
//get the number of columns in the result set
ret = SQLNumResultCols(hStmt, colCount);
if (!SQL_SUCCEEDED(ret)) {
return new Column[0];
}
Column *columns = new Column[*colCount];
for (int i = 0; i < *colCount; i++) {
//save the index number of this column
columns[i].index = i + 1;
//get the estimated size of column name
ret = SQLColAttribute( hStmt,
columns[i].index,
#ifdef STRICT_COLUMN_NAMES
SQL_DESC_NAME,
#else
SQL_DESC_LABEL,
#endif
NULL,
NULL,
&buflen,
NULL);
//SQLSMALLINT estimatedSize = buflen + sizeof(SQLWCHAR); // <--- old
//columns[i].name = new uint8_t[estimatedSize]; // <--- old
//memset(columns[i].name, NULL, sizeof(SQLWCHAR)); // <--- old
SQLSMALLINT estimatedSize = 1024;
columns[i].name = new unsigned char[estimatedSize];
columns[i].name[0] = '\0';
and the result is great. In my case all runs fine.
Request-ID": "a3456",
"Aktuelle Gruppe": "B3A2",
"ONKZ": 7071,
As I say, I am not a C++ guy! But perhaps it helps somebody else here...
Hi!
i have some issues when using this. The returned values will have crypted chars like this:
Any idea?