Giter Club home page Giter Club logo

node-odbc's Introduction

@ratanakvlun/node-odbc

This module is based off of node-odbc. It is an enhanced version that mainly targets a Windows and SQL Server configuration.

Uses Semantic Versioning.

node-odbc

An asynchronous/synchronous interface for node.js to unixODBC and its supported drivers.

requirements

  • unixODBC binaries and development libraries for module compilation
    • on Ubuntu/Debian sudo apt-get install unixodbc unixodbc-dev
    • on RedHat/CentOS sudo yum install unixODBC unixODBC-devel
    • on OSX using macports.org sudo port unixODBC
  • odbc drivers for target database
  • properly configured odbc.ini and odbcinst.ini.

install

After insuring that all requirements are installed you may install by one of the two following options:

git

git clone git://github.com/wankdanker/node-odbc.git
cd node-odbc
node-gyp configure build

npm

npm install odbc

quick example

var db = require('odbc')()
  , cn = process.env.ODBC_CONNECTION_STRING
  ;

db.open(cn, function (err) {
  if (err) return console.log(err);
  
  db.query('select * from user where user_id = ?', [42], function (err, data) {
    if (err) console.log(err);
    
    console.log(data);

    db.close(function () {
      console.log('done');
    });
  });
});

api

Database

The simple api is based on instances of the Database class. You may get an instance in one of the following ways:

require("odbc").open(connectionString, function (err, db){
  //db is already open now if err is falsy
});

or by using the helper function:

var db = require("odbc")();

or by creating an instance with the constructor function:

var Database = require("odbc").Database
  , db = new Database();

.open(connectionString, callback)

Open a connection to a database.

  • connectionString - The ODBC connection string for your database
  • callback - callback (err)
var db = require("odbc")()
	, cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
	;

db.open(cn, function (err) {
	if (err) {
		return console.log(err);
	}

	//we now have an open connection to the database
});

.openSync(connectionString)

Synchronously open a connection to a database.

  • connectionString - The ODBC connection string for your database
var db = require("odbc")()
  , cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
  ;

try {
  var result = db.openSync(cn);
}
catch (e) {
  console.log(e.message);
}

//we now have an open connection to the database

.query(sqlQuery [, bindingParameters], callback)

Issue an asynchronous SQL query to the database which is currently open.

  • sqlQuery - The SQL query to be executed.
  • bindingParameters - OPTIONAL - An array of values that will be bound to any '?' characters in sqlQuery.
  • callback - callback (err, rows, moreResultSets)
var db = require("odbc")()
	, cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
	;

db.open(cn, function (err) {
	if (err) {
		return console.log(err);
	}

	//we now have an open connection to the database
	//so lets get some data
	db.query("select top 10 * from customers", function (err, rows, moreResultSets) {
		if (err) {
			return console.log(err);
		}
		
		console.log(rows);

		//if moreResultSets is truthy, then this callback function will be called
		//again with the next set of rows.
	});
});

.querySync(sqlQuery [, bindingParameters])

Synchronously issue a SQL query to the database that is currently open.

  • sqlQuery - The SQL query to be executed.
  • bindingParameters - OPTIONAL - An array of values that will be bound to any '?' characters in sqlQuery.
var db = require("odbc")()
  , cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
  ;

//blocks until the connection is opened.
db.openSync(cn);

//blocks until the query is completed and all data has been acquired
var rows = db.querySync("select top 10 * from customers");

console.log(rows);

.close(callback)

Close the currently opened database.

  • callback - callback (err)
var db = require("odbc")()
	, cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
	;

db.open(cn, function (err) {
	if (err) {
		return console.log(err);
	}
	
	//we now have an open connection to the database
	
	db.close(function (err) {
		console.log("the database connection is now closed");
	});
});

.closeSync()

Synchronously close the currently opened database.

var db = require("odbc")()
  , cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
  ;

//Blocks until the connection is open
db.openSync(cn);

//Blocks until the connection is closed
db.closeSync();

.prepare(sql, callback)

Prepare a statement for execution.

  • sql - SQL string to prepare
  • callback - callback (err, stmt)

Returns a Statement object via the callback

var db = require("odbc")()
  , cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
  ;

//Blocks until the connection is open
db.openSync(cn);

db.prepare("insert into hits (col1, col2) VALUES (?, ?)", function (err, stmt) {
  if (err) {
    //could not prepare for some reason
    console.log(err);
    return db.closeSync();
  }

  //Bind and Execute the statment asynchronously
  stmt.execute(['something', 42], function (err, result) {
    result.closeSync();

    //Close the connection
    db.closeSync();
  });
})

.prepareSync(sql)

Synchronously prepare a statement for execution.

  • sql - SQL string to prepare

Returns a Statement object

var db = require("odbc")()
  , cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
  ;

//Blocks until the connection is open
db.openSync(cn);

//Blocks while preparing the statement
var stmt = db.prepareSync("insert into hits (col1, col2) VALUES (?, ?)")

//Bind and Execute the statment asynchronously
stmt.execute(['something', 42], function (err, result) {
  result.closeSync();

  //Close the connection
  db.closeSync();
});

.beginTransaction(callback)

Begin a transaction

  • callback - callback (err)

.beginTransactionSync()

Synchronously begin a transaction

.commitTransaction(callback)

Commit a transaction

  • callback - callback (err)
var db = require("odbc")()
  , cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
  ;

//Blocks until the connection is open
db.openSync(cn);

db.beginTransaction(function (err) {
  if (err) {
    //could not begin a transaction for some reason.
    console.log(err);
    return db.closeSync();
  }

  var result = db.querySync("insert into customer (customerCode) values ('stevedave')");

  db.commitTransaction(function (err) {
    if (err) {
      //error during commit
      console.log(err);
      return db.closeSync();
    }

    console.log(db.querySync("select * from customer where customerCode = 'stevedave'"));

    //Close the connection
    db.closeSync();
  });
})

.commitTransactionSync()

Synchronously commit a transaction

var db = require("odbc")()
  , cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
  ;

//Blocks until the connection is open
db.openSync(cn);

db.beginTransactionSync();

var result = db.querySync("insert into customer (customerCode) values ('stevedave')");

db.commitTransactionSync();

console.log(db.querySync("select * from customer where customerCode = 'stevedave'"));

//Close the connection
db.closeSync();

.rollbackTransaction(callback)

Rollback a transaction

  • callback - callback (err)
var db = require("odbc")()
  , cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
  ;

//Blocks until the connection is open
db.openSync(cn);

db.beginTransaction(function (err) {
  if (err) {
    //could not begin a transaction for some reason.
    console.log(err);
    return db.closeSync();
  }

  var result = db.querySync("insert into customer (customerCode) values ('stevedave')");

  db.rollbackTransaction(function (err) {
    if (err) {
      //error during rollback
      console.log(err);
      return db.closeSync();
    }

    console.log(db.querySync("select * from customer where customerCode = 'stevedave'"));

    //Close the connection
    db.closeSync();
  });
})

.rollbackTransactionSync()

Synchronously rollback a transaction

var db = require("odbc")()
  , cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
  ;

//Blocks until the connection is open
db.openSync(cn);

db.beginTransactionSync();

var result = db.querySync("insert into customer (customerCode) values ('stevedave')");

db.rollbackTransactionSync();

console.log(db.querySync("select * from customer where customerCode = 'stevedave'"));

//Close the connection
db.closeSync();

Pool

The node-odbc Pool is a rudimentary connection pool which will attempt to have database connections ready and waiting for you when you call the open method.

If you use a Pool instance, any connection that you close will cause another connection to be opened for that same connection string. That connection will be used the next time you call Pool.open() for the same connection string.

This should probably be changed.

.open(connectionString, callback)

Get a Databaseinstance which is already connected toconnectionString`

  • connectionString - The ODBC connection string for your database
  • callback - callback (err, db)
var Pool = require("odbc").Pool
	, pool = new Pool()
	, cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
	;

pool.open(cn, function (err, db) {
	if (err) {
		return console.log(err);
	}

	//db is now an open database connection and can be used like normal
	//if we run some queries with db.query(...) and then call db.close();
	//a connection to `cn` will be re-opened silently behind the scense
	//and will be ready the next time we do `pool.open(cn)`
});

.close(callback)

Close all connections in the Pool instance

  • callback - callback (err)
var Pool = require("odbc").Pool
	, pool = new Pool()
	, cn = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname"
	;

pool.open(cn, function (err, db) {
	if (err) {
		return console.log(err);
	}

	//db is now an open database connection and can be used like normal
	//but all we will do now is close the whole pool
	
	pool.close(function () {
		console.log("all connections in the pool are closed");
	});
});

example

var odbc = require("odbc")
	, util = require('util')
	, db = new odbc.Database()
	;

var connectionString = "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname";

db.open(connectionString, function(err) {
	db.query("select * from table", function(err, rows, moreResultSets) {
		console.log(util.inspect(rows, null, 10));
		
		db.close(function() {
			console.log("Database connection closed");
		});
	});
});

testing

Tests can be run by executing npm test from within the root of the node-odbc directory. You can also run the tests by executing node run-tests.js from within the /test directory.

By default, the tests are setup to run against a sqlite3 database which is created at test time. This will require proper installation of the sqlite odbc driver. On Ubuntu: sudo apt-get install libsqliteodbc

build options

Debug

If you would like to enable debugging messages to be displayed you can add the flag DEBUG to the defines section of the binding.gyp file and then execute node-gyp rebuild.

<snip>
'defines' : [
  "DEBUG"
],
<snip>

Dynodbc

You may also enable the ability to load a specific ODBC driver and bypass the ODBC driver management layer. A performance increase of ~5Kqps was seen using this method with the libsqlite3odbc driver. To do this, specify the dynodbc flag in the defines section of the binding.gyp file. You will also need to remove any library references in binding.gyp. Then execute node-gyp rebuild.

<snip>
'defines' : [
  "dynodbc"
],
'conditions' : [
  [ 'OS == "linux"', {
    'libraries' : [ 
      //remove this: '-lodbc' 
    ],
<snip>

Unicode

By default, UNICODE suppport is enabled. This should provide the most accurate way to get Unicode strings submitted to your database. For best results, you may want to put your Unicode string into bound parameters.

However, if you experience issues or you think that submitting UTF8 strings will work better or faster, you can remove the UNICODE define in binding.gyp

<snip>
'defines' : [
  "UNICODE"
],
<snip>

timegm vs timelocal

When converting a database time to a C time one may use timegm or timelocal. See man timegm for the details of these two functions. By default the node-odbc bindings use timelocal. If you would prefer for it to use timegm then specify the TIMEGM define in binding.gyp

<snip>
'defines' : [
  "TIMEGM"
],
<snip>

Strict Column Naming

When column names are retrieved from ODBC, you can request by SQL_DESC_NAME or SQL_DESC_LABEL. SQL_DESC_NAME is the exact column name or none if there is none defined. SQL_DESC_LABEL is the heading or column name or calculation. SQL_DESC_LABEL is used by default and seems to work well in most cases.

If you want to use the exact column name via SQL_DESC_NAME, enable the STRICT_COLUMN_NAMES define in binding.gyp

<snip>
'defines' : [
  "STRICT_COLUMN_NAMES"
],
<snip>

tips

Using node < v0.10 on Linux

Be aware that through node v0.9 the uv_queue_work function, which is used to execute the ODBC functions on a separate thread, uses libeio for its thread pool. This thread pool by default is limited to 4 threads.

This means that if you have long running queries spread across multiple instances of odbc.Database() or using odbc.Pool(), you will only be able to have 4 concurrent queries.

You can increase the thread pool size by using @developmentseed's [node-eio] (https://github.com/developmentseed/node-eio).

install:

npm install eio

usage:

var eio = require('eio'); 
eio.setMinParallel(threadCount);

Using the FreeTDS ODBC driver

  • If you have column names longer than 30 characters, you should add "TDS_Version=7.0" to your connection string to retrive the full column name.
    • Example : "DRIVER={FreeTDS};SERVER=host;UID=user;PWD=password;DATABASE=dbname;TDS_Version=7.0"
  • If you got error "[unixODBC][FreeTDS][SQL Server]Unable to connect to data source" Try use SERVERNAME instead of SERVER
    • Example : "DRIVER={FreeTDS};SERVERNAME=host;UID=user;PWD=password;DATABASE=dbname"
  • Be sure that your odbcinst.ini has the proper threading configuration for your FreeTDS driver. If you choose the incorrect threading model it may cause the thread pool to be blocked by long running queries. This is what @wankdanker currently uses on Ubuntu 12.04:
[FreeTDS]
Description     = TDS driver (Sybase/MS SQL)
Driver          = libtdsodbc.so
Setup           = libtdsS.so
CPTimeout       = 120
CPReuse         = 
Threading       = 0

contributors

license

Copyright (c) 2013 Dan VerWeire [email protected]

Copyright (c) 2010 Lee Smith [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

node-odbc's People

Contributors

bbigras avatar bnoordhuis avatar bzuillsmith avatar dfbaskin avatar gurzgri avatar lee-houghton avatar mortenhoustonludvigsen avatar platformamoja avatar rafeememon avatar ratanakvlun avatar rossipedia avatar sannis avatar santigimeno avatar theduderog avatar w1nk avatar wankdanker avatar xylem avatar yorickvp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

node-odbc's Issues

error: use of undeclared identifier 'boolean'

Hi,

Thanks again for improving this lib !

I can't compile from source on OSX. Search for error in the log below:

gyp info spawn args [ '/Users/kwent/Projects/node-odbc2/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kwent/Projects/node-odbc2/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kwent/Projects/node-odbc2/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kwent/.node-gyp/8.4.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/kwent/.node-gyp/8.4.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/kwent/Projects/node-odbc2/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/kwent/.node-gyp/8.4.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/kwent/Projects/node-odbc2',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/bindings/src/odbc.o
../src/odbc.cpp:215:79: warning: 'NewInstance' is deprecated
      [-Wdeprecated-declarations]
    Local<Value> js_result = Nan::New<Function>(ODBCConnection::constructor)->NewIn...
                                                                              ^
/Users/kwent/.node-gyp/8.4.0/include/node/v8.h:3787:3: note: 'NewInstance' has been
      explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/kwent/.node-gyp/8.4.0/include/node/v8config.h:332:29: note: expanded from macro
      'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/odbc.cpp:262:78: warning: 'NewInstance' is deprecated
      [-Wdeprecated-declarations]
  Local<Object> js_result = Nan::New<Function>(ODBCConnection::constructor)->NewI...
                                                                             ^
/Users/kwent/.node-gyp/8.4.0/include/node/v8.h:3787:3: note: 'NewInstance' has been
      explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/kwent/.node-gyp/8.4.0/include/node/v8config.h:332:29: note: expanded from macro
      'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/odbc.cpp:306:29: warning: implicit conversion of NULL constant to 'int'
      [-Wnull-conversion]
    memset(columns[i].name, NULL, sizeof(SQLWCHAR));
    ~~~~~~                  ^~~~
                            0
../src/odbc.cpp:332:33: warning: implicit conversion of NULL constant to 'int'
      [-Wnull-conversion]
    memset(columns[i].typeName, NULL, sizeof(SQLWCHAR));
    ~~~~~~                      ^~~~
                                0
../src/odbc.cpp:893:9: error: unknown type name 'boolean'; did you mean 'Boolean'?
        boolean* v = (boolean*)malloc(sizeof(boolean));
        ^~~~~~~
        Boolean
/Users/kwent/.node-gyp/8.4.0/include/node/v8.h:2345:17: note: 'Boolean' declared here
class V8_EXPORT Boolean : public Primitive {
                ^
../src/odbc.cpp:893:23: error: use of undeclared identifier 'boolean'
        boolean* v = (boolean*)malloc(sizeof(boolean));
                      ^
../src/odbc.cpp:893:31: error: expected expression
        boolean* v = (boolean*)malloc(sizeof(boolean));
                              ^
../src/odbc.cpp:894:12: error: no viable overloaded '='
        *v = value->BooleanValue();
        ~~ ^ ~~~~~~~~~~~~~~~~~~~~~
/Users/kwent/.node-gyp/8.4.0/include/node/v8.h:2345:17: note: candidate function (the
      implicit copy assignment operator) not viable: no known conversion from 'bool' to
      'const v8::Boolean' for 1st argument
class V8_EXPORT Boolean : public Primitive {
                ^
/Users/kwent/.node-gyp/8.4.0/include/node/v8.h:2345:17: note: candidate function (the
      implicit move assignment operator) not viable: no known conversion from 'bool' to
      'v8::Boolean' for 1st argument
../src/odbc.cpp:897:41: error: unknown type name 'boolean'; did you mean 'Boolean'?
        params[i].BufferLength = sizeof(boolean);
                                        ^~~~~~~
                                        Boolean
/Users/kwent/.node-gyp/8.4.0/include/node/v8.h:2345:17: note: 'Boolean' declared here
class V8_EXPORT Boolean : public Primitive {
                ^
../src/odbc.cpp:1218:19: warning: 'SetPrototype' is deprecated
      [-Wdeprecated-declarations]
        objError->SetPrototype(Exception::Error(Nan::New((uint16_t *)errorMessa...
                  ^
/Users/kwent/.node-gyp/8.4.0/include/node/v8.h:3212:3: note: 'SetPrototype' has been
      explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version", bool SetPrototype(Local<Value> prototype));
  ^
/Users/kwent/.node-gyp/8.4.0/include/node/v8config.h:332:29: note: expanded from macro
      'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/odbc.cpp:1249:15: warning: 'SetPrototype' is deprecated
      [-Wdeprecated-declarations]
    objError->SetPrototype(Exception::Error(Nan::New(message).ToLocalChecked()));
              ^
/Users/kwent/.node-gyp/8.4.0/include/node/v8.h:3212:3: note: 'SetPrototype' has been
      explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version", bool SetPrototype(Local<Value> prototype));
  ^
/Users/kwent/.node-gyp/8.4.0/include/node/v8config.h:332:29: note: expanded from macro
      'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/odbc.cpp:1265:13: warning: 'SetPrototype' is deprecated
      [-Wdeprecated-declarations]
  objError->SetPrototype(Exception::Error(Nan::New<String>(message).ToLocalChecked()));
            ^
/Users/kwent/.node-gyp/8.4.0/include/node/v8.h:3212:3: note: 'SetPrototype' has been
      explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version", bool SetPrototype(Local<Value> prototype));
  ^
/Users/kwent/.node-gyp/8.4.0/include/node/v8config.h:332:29: note: expanded from macro
      'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
7 warnings and 5 errors generated.
make: *** [Release/obj.target/bindings/src/odbc.o] Error 1

Thoughts ?

Regards

decoding problem of unicode

Some colunms of the the result set are array buffers when the type of it is varchar(n) . I try to convert it with iconv-lite and I found that the chinese charactars are converted correctly with utf16 decoding but the english charactars are mistaken under utf16. When decoding with utf8, the english charactars are correct but the chinese ones are mistaken. Is it possible to obtain string directly from your query api?

Problems compiling library

Hi,
im having problems compiling the library. I'm investigating it but I can not fix it.

This is the output:

2195 warn [email protected] requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself. 2196 verbose stack Error: @ratanakvlun/[email protected] install:node-pre-gyp install --fallback-to-build2196 verbose stack Exit status 1 2196 verbose stack at EventEmitter.<anonymous> (/Users/xxx/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16) 2196 verbose stack at emitTwo (events.js:126:13) 2196 verbose stack at EventEmitter.emit (events.js:214:7) 2196 verbose stack at ChildProcess.<anonymous> (/Users/xxx/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 2196 verbose stack at emitTwo (events.js:126:13) 2196 verbose stack at ChildProcess.emit (events.js:214:7) 2196 verbose stack at maybeClose (internal/child_process.js:925:16) 2196 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) 2197 verbose pkgid @ratanakvlun/[email protected] 2198 verbose cwd /private/tmp/sequelize-odbc-mssql 2199 verbose Darwin 18.2.0 2200 verbose argv "/Users/xxx/.nvm/versions/node/v8.11.3/bin/node" "/Users/xxx/.nvm/versions/node/v8.11.3/bin/npm" "install" "--verbose" 2201 verbose node v8.11.3 2202 verbose npm v6.4.1 2203 error code ELIFECYCLE 2204 error errno 1 2205 error @ratanakvlun/[email protected] install:node-pre-gyp install --fallback-to-build2205 error Exit status 1 2206 error Failed at the @ratanakvlun/[email protected] install script. 2206 error This is probably not a problem with npm. There is likely additional logging output above. 2207 verbose exit [ 1, true ]

Needs proper error handling

  • Format errors returned by ODBC API
  • Propogate errors back to callback context
  • Pass errors to Node.js using callback
  • All public calls should have error handling

decoding problems

Hi!

i have some issues when using this. The returned values will have crypted chars like this:

 "AF_TAF_Zieエє⺧䵳": null,
 "AF_Wec눨ѕ㝯䤩漧謀LONGVA뇠ѕ㜐䤩

Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.