Skip to content

Commit

Permalink
[issue112] Fix more UNICODE issues (w1nk#116)
Browse files Browse the repository at this point in the history
* Fix column names in results being single characters when UNICODE is defined
* Fix statement on result object single character when UNICODE is defined

Fixes w1nk#112

Signed-off-by: Mark Irish <[email protected]>
  • Loading branch information
markdirish authored Aug 10, 2020
1 parent 44cfce4 commit 0ff0606
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/odbc_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,11 @@ Napi::Array ODBCConnection::ProcessDataForNapi(Napi::Env env, QueryData *data, N
if (data->sql == NULL) {
rows.Set(Napi::String::New(env, STATEMENT), env.Null());
} else {
#ifdef UNICODE
rows.Set(Napi::String::New(env, STATEMENT), Napi::String::New(env, (const char16_t*)data->sql));
#else
rows.Set(Napi::String::New(env, STATEMENT), Napi::String::New(env, (const char*)data->sql));
#endif
}

// set the 'parameters' property
Expand Down Expand Up @@ -434,7 +438,11 @@ Napi::Array ODBCConnection::ProcessDataForNapi(Napi::Env env, QueryData *data, N
if (this->connectionOptions.fetchArray == true) {
row.Set(j, value);
} else {
#ifdef UNICODE
row.Set(Napi::String::New(env, (const char16_t*)columns[j]->ColumnName), value);
#else
row.Set(Napi::String::New(env, (const char*)columns[j]->ColumnName), value);
#endif
}
}
rows.Set(i, row);
Expand Down

0 comments on commit 0ff0606

Please sign in to comment.