Skip to content

Commit

Permalink
[bug] Fixing floating numbers for SQLBindColumns
Browse files Browse the repository at this point in the history
SQLBindColumn didn't take into consideration the decimal point for some data types

Fixes wankdanker#42
  • Loading branch information
markdirish committed Oct 27, 2019
1 parent d086299 commit 7835d28
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [2.2.2] - 2019-10-27
### Fixed
- Fixed SQL_DECIMAL, SQL_REAL, and SQL_NUMERIC losing precision

## [2.2.1] - 2019-09-13
### Fixed
- pool.query() now closes the connections after query
Expand Down
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.2.1",
"version": "2.2.2",
"homepage": "http://github.com/markdirish/node-odbc/",
"main": "./lib/odbc.js",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion src/odbc_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,7 @@ SQLRETURN ODBCConnection::BindColumns(QueryData *data) {
case SQL_REAL:
case SQL_DECIMAL:
case SQL_NUMERIC:
maxColumnLength = (column->ColumnSize + 1) * sizeof(SQLCHAR);
maxColumnLength = (column->ColumnSize + 2) * sizeof(SQLCHAR);
targetType = SQL_C_CHAR;
break;

Expand All @@ -1992,6 +1992,7 @@ SQLRETURN ODBCConnection::BindColumns(QueryData *data) {
maxColumnLength = column->ColumnSize;
targetType = SQL_C_DOUBLE;
break;

case SQL_TINYINT:
case SQL_SMALLINT:
case SQL_INTEGER:
Expand Down

0 comments on commit 7835d28

Please sign in to comment.