Skip to content

Commit e0f2e50

Browse files
authored
[issue112] Fix more UNICODE issues (#117)
* [issue112] Fix more UNICODE issues (#116) * Fix column names in results being single characters when UNICODE is defined * Fix statement on result object single character when UNICODE is defined * Bump version to 2.3.4 * Update CHANGELOG * Regenerate package-lock.json Signed-off-by: Mark Irish <[email protected]>
2 parents 44cfce4 + edfc30c commit e0f2e50

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [2.3.4] - 2020-08-09
5+
### Fixed
6+
- Fixed bug when UNICODE is defined where statement in result object and column name properties wouldn't encode correctly
7+
- Update package-lock.json with vulnerability fixes
8+
49
## [2.3.3] - 2020-07-31
510
### Fixed
611
- Fixed bug when UNICODE is defined where error message, error state, and column names wouldn't encode correctly

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "odbc",
33
"description": "unixodbc bindings for node",
4-
"version": "2.3.3",
4+
"version": "2.3.4",
55
"homepage": "http://github.com/markdirish/node-odbc/",
66
"main": "lib/odbc.js",
77
"types": "lib/odbc.d.ts",

src/odbc_connection.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,11 @@ Napi::Array ODBCConnection::ProcessDataForNapi(Napi::Env env, QueryData *data, N
294294
if (data->sql == NULL) {
295295
rows.Set(Napi::String::New(env, STATEMENT), env.Null());
296296
} else {
297+
#ifdef UNICODE
298+
rows.Set(Napi::String::New(env, STATEMENT), Napi::String::New(env, (const char16_t*)data->sql));
299+
#else
297300
rows.Set(Napi::String::New(env, STATEMENT), Napi::String::New(env, (const char*)data->sql));
301+
#endif
298302
}
299303

300304
// set the 'parameters' property
@@ -434,7 +438,11 @@ Napi::Array ODBCConnection::ProcessDataForNapi(Napi::Env env, QueryData *data, N
434438
if (this->connectionOptions.fetchArray == true) {
435439
row.Set(j, value);
436440
} else {
441+
#ifdef UNICODE
442+
row.Set(Napi::String::New(env, (const char16_t*)columns[j]->ColumnName), value);
443+
#else
437444
row.Set(Napi::String::New(env, (const char*)columns[j]->ColumnName), value);
445+
#endif
438446
}
439447
}
440448
rows.Set(i, row);

0 commit comments

Comments
 (0)