Skip to content

Commit

Permalink
[issue112] Fix more UNICODE issues (w1nk#117)
Browse files Browse the repository at this point in the history
* [issue112] Fix more UNICODE issues (w1nk#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]>
  • Loading branch information
markdirish authored Aug 10, 2020
2 parents 44cfce4 + edfc30c commit e0f2e50
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.

## [2.3.4] - 2020-08-09
### Fixed
- Fixed bug when UNICODE is defined where statement in result object and column name properties wouldn't encode correctly
- Update package-lock.json with vulnerability fixes

## [2.3.3] - 2020-07-31
### Fixed
- Fixed bug when UNICODE is defined where error message, error state, and column names wouldn't encode correctly
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "odbc",
"description": "unixodbc bindings for node",
"version": "2.3.3",
"version": "2.3.4",
"homepage": "http://github.com/markdirish/node-odbc/",
"main": "lib/odbc.js",
"types": "lib/odbc.d.ts",
Expand Down
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 e0f2e50

Please sign in to comment.