nukedzn / node-informix Goto Github PK
View Code? Open in Web Editor NEWA node.js native client for IBM Informix
A node.js native client for IBM Informix
We'll need special handling for transactions since we can't guarantee the order of statements getting executed.
A solution would be to allocate a connection (from #20) for a transaction and queue statements with that connection. This connection must not allow any statements outside the transaction to be executed until it is released (commit/rollback).
Hi,
I have trouble with our locales. We are using czech locale for Central Europe, CP1250 on Windows, with PC-LATIN-2 on DOS command window.
So my settings is:
SET DB_LOCALE=cs_CZ.cp1250
SET CLIENT_LOCALE=cs_CZ.pc-latin-2
This leads to correct result:
echo SELECT nazevmater FROM cenmat | dbaccess mydb
All characters are correctly displayed, including diactritic, see screenshot.
Same setting, same window:
node ixtest.js
var opts = {
database : 'mydb@ixlur',
username : 'informix',
password : '***'
};
var informix = require( 'informix' )( opts );
informix
.query( "select nazevmater from cenmat" )
.then( function ( cursor )
{
return cursor.fetchAll();
} )
.then( function ( results )
{
console.log( 'results:', results );
})
.catch( function ( err )
{
console.log( err );
} );
It is working but diacritic characters are missing (? is displayed, see screenshot).
My database is encoded as CP1250, so DB_LOCALE is correct.
In our Windows application with CP1250 is all ok, in DBACCESS, with pc-latin-2, too.
With node-informix I tried CLIENT_LOCALE set to cs_CZ.cp1250, cs_CZ.pc-latin-2, cs_CZ.UTF8, result same - ? characters.
But your application (ESQL) read locales, because when I set wrong locale:
SET CLIENT_LOCALE=cs_CZ.bad
then error is displayed:
node ixtest.js
Error: [-23101] Unable to load locale categories.
at Error (native)
python -V
Python 2.7.13
node -v
v6.7.0
npm list informix
node-api@ C:\buffer\jsrest
`-- [email protected]
From PR #30:
Having tested it on a Windows 7 (32-bit) VM, the native addon compiles successfully and the ifx tests passes. However, there seems to be some strange behaviour when Promises and callbacks are mixed.
e.g. examples/informix.example.js wouldn't give consistent results
> node examples/informix.example.js
[stmt] results: [ [ 0 ] ]
[query] results: [ [ 'systabauth' ],
[ 'syscolauth' ],
[ 'sysprocauth' ],
[ 'sysfragauth' ],
[ 'sysroleauth' ],
[ 'sysxtdtypeauth' ],
[ 'syslangauth' ],
[ 'sysseclabelauth' ],
[ 'syssurrogateauth' ] ]
> node examples/informix.example.js
[stmt] results: [ [ 0 ] ]
> node examples/informix.example.js
[stmt] results: [ [ 0 ] ]
It seems like Node.js ends the process prematurely presumably because it thinks the promise chain for informix.query()
wouldn't resolve.
Moving src/ifx/workers/stmtfree.cpp:51 to be after callback->Call( 2, argv );
(line 59) would make the above example to give consistent results but I'm not sure why!!!
Also, replacing lib/statement.js:119 with;
setTimeout( function () {
resolve( self.$.id );
}, 10 );
would also produce consistent results.
I have used this in API.
The external program calls this API and gathers data. However, it seems these connections are not get closed automatically.
How can I close and free the connection?
e.g.
// prepared statement: 'select * from tcustomers where id < ?;'
stmt.exec( [ 1, 2, 3 ] )
.then( function ( cursor ) {
// should fail
} )
.catch( function ( err ) {
// error [-254] Too many or too few host variables given.
} );
When this happens the statement can't be freed (stmt.free()
) and will throw a "Cursors need to be closed." error. But there's no way to access the cursor in order to close it.
If you re-use a prepared statement on a table with a character column the column length increases by 1 with each execution with ' ' making up the rest of the string.
The problem does not occur if you create a new prepared statement for each query.
Here's some sample code:
create table IF NOT EXISTS t (
a char(1) default 'A' not null
);
INSERT INTO t (a) VALUES ('A');
import * as Pool from "informix/lib/pool";
import {Informix} from "informix";
const query = `SELECT a FROM t LIMIT 1`;
let pool = new Pool({
database: config.informix.database,
username: config.informix.username,
password: config.informix.password,
max: 1
});
// Character length increases on each query
async function go() {
let conn = await pool.acquire();
pool.release(conn);
let stmt = await conn.prepare(query, {reusable: true});
while (true) {
let cursor = await stmt.exec();
let result = await cursor.fetchAll({close: true});
console.log(result[0][0].length);
}
}
// Character length remains 1 (new prepared statement per query)
async function go2() {
let conn = await pool.acquire();
pool.release(conn);
while (true) {
let stmt = await conn.prepare(query, {reusable: false});
let cursor = await stmt.exec();
let result = await cursor.fetchAll({close: true});
console.log(result[0][0].length);
}
}
// Same as 1 but using informix class
async function go3() {
let ifx = new Informix({
database: config.informix.database,
username: config.informix.username,
password: config.informix.password,
});
const stmt = await ifx.prepare(query);
while (true) {
let cursor = await stmt.exec();
let result = await cursor.fetchAll({close: true});
console.log(result[0][0].length);
}
}
go3();
The result is something like:
1
2
3
and if you logged the actual string it'd be:
'A'
'A '
'A '
I suspect it's something to do with https://github.com/nukedzn/node-informix/blob/master/src/ifx/ifx.cpp#L389 but I don't know how to compile the C to check
Hello,
I created a wrap function returning a promise that executes, captures a serial key after insertion.
and ends the context after each successful entry, however on a subsequent calls the following error message is captured;
Error: A Statement is already prepared with the same ID.
at /home/aochoa/services/ibc_informix/node_modules/informix/lib/statement.js:176:16
at new Promise ()
at /home/aochoa/services/ibc_informix/node_modules/informix/lib/statement.js:171:11
at
I understood that upon closing the context the prepared statement gets dismissed, is this correct?
here is the code of the wapper function
this.contextStatement = function( qry, vals ){
var serial = -1;
return new Promise( ( resolve, reject ) => {
var ctx = this.informix.createContext();
ctx.begin()
.then( function(){
return ctx.prepare( qry );
// return ctx.prepare( "insert into users(username, full_name, station, clearance) values (?, ?, ?, ?)" );
})
.then( function( statement ){
return statement.exec( vals );
})
.then( function( cursor ){
serial = cursor.serial();
cursor.close();
return ctx.commit();
})
.then( function(){
ctx.end();
resolve( serial );
})
.catch( function( err ){
reject( err );
})
});
};
Hi,
i need help with opts settings for a remote database! I tried many combinations of database-options but nothing works!
I need the option settings (opts) for the following odbc connection string:
jdbc:informix-sqli://192.168.32.15:1630/myDatabase:INFORMIXSERVER=myServer
What should i insert into the opts instead of the following informations:
var opts = {
database : '192.168.32.15:1630/myDatabase@myServer',
username : 'myDatabaseUser',
password : 'myDatabasePassword'
};
Any help?
Make it possible to close cursors
I'm experiencing an issue that appears to be related to the Informix SDK version.
My workstation is currently running CentOS 7.6.1810.
When Informix SDK 4.10.FC8DE is installed, the npm package appears to work fine because I am able to interact with the database without issue.
When Informix SDK 4.10.FC12W1 is installed, my node server crashes as soon as an Informix.query() call is made. I, unfortunately, haven't figured out how to capture any info regarding where the problem occurs, and I'm unable to catch any errors in order to provide more details.
I suspect the issue is an incompatibility between the npm informix package and this particular version of the SDK. I'm hoping that you can help confirm this and potentially let me know if there's anything I can do to get it working with this version.
If there's something I can do to provide additional details, let me know. Thanks in advance for the help.
let opts = {
database : "sampling@myserver",
username : "informix",
password : "xxxxxxx"
}
let informix = require("informix")(opts)
let create_table = CREATE RAW TABLE IF NOT EXISTS dumb (test_id SERIAL,age INT,value BSON);
let inservalues = INSERT INTO dumb(test_id,age,value) VALUES (0, 50, '{math:"80"}'::JSON);
let select_table = SELECT value::JSON FROM dumb;
informix
.query(select_table)
.then(cursor => cursor.fetchAll( { close : true } ))
.then(result => {
console.log(result);
})
cant get value from bson datatype
error : Segmentation fault (core dumped),
when i run the query SELECT value::JSON FROM dumb; in dbaccess, i got
(expression) {"math":"80"}
any idea whats happening here ?
thank you
Decimal numbers are returned as integer.
Correct result with DBACCESS:
echo select cismater, cenamj from cenmat where nazevmater like 'AR%' | dbaccess pemaxdb
Database selected.
cismater cenamj
MAT026501147 7.964439875659
6550-0050-00 138.560000000000
0120205446 5.520000000000
0120202220 5.200000000000
0120196149 5.256000000000
0120208002 33.600000000000
0120208126 93.600000000000
7 row(s) retrieved.
Database closed.
And node-informix:
[ [ 'MAT026501147', 7 ],
[ '6550-0050-00', 138 ],
[ '0120205446 ', 5 ],
[ '0120202220 ', 5 ],
[ '0120196149 ', 5 ],
[ '0120208002 ', 33 ],
[ '0120208126 ', 93 ] ]
var opts = {
database : 'pemaxdb@ixlur',
username : 'informix',
password : '***'
};
var informix = require( 'informix' )( opts );
informix
.query( "select cismater, cenamj from cenmat where nazevmater like 'AR%';" )
.then( function ( cursor )
{
return cursor.fetchAll();
} )
.then( function ( results )
{
console.log( results );
})
.catch( function ( err )
{
console.log( err );
} );
Informix jdbc url is like this;
jdbc:informix-sqli://hostname
:portnum/database_name
:INFORMIXSERVER=servername
Let's say; IP address (hostname
) of the informix server is 172.10.20.30
database_name
is myDb and informix servername
is part_1;
jdbc url looks like this:
jdbc:informix-sqli://172.10.20.30:1504/myDb:INFORMIXSERVER=part_1
How to put these three params into the options?
I think we should focus on an asynchronous interface (and not support a synchronous interface) but I'm not decided on whether to use ES6 Promises (supported by node.js >=0.12.0) or to use callbacks or both.
In either case we should also "emit events" as well.
e.g. Using promises
var db = require( 'informix' );
db
.open( '...' )
.then( function ( conn ) {
// use connection
} )
.catch( function ( err ) {
// handle error
} );
e.g. Using callbacks
var db = require( 'informix' )
db.open( '...', function ( err, conn ) {
if ( err ) {
// handle err
}
// use connection
} );
e.g. Event emitters
var db = require( 'informix' );
db.on( 'error', function ( err ) {
// global error handler
} );
db.on( 'connect', function ( conn ) {
// use conn
} );
db.open( '...' );
Thoughts?
In connection.js the timezone is swapped to UTC when a connection is made.
I'm sure this was probably to mask the fact that the timestamps coming out of Informix are always set as being UTC even though they might not be. https://github.com/nukedzn/node-informix/blob/master/src/ifx/workers/fetch.cpp#L115
Given that informix doesn't have timezones as part of its timestamps, you can't make an assumption about the timezone that the timestamp coming out of informix is, therefore putting a Z on the end of the timestamp isn't correct.
Oddly though http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15 says that if there is no time offset on a timestamp it defaults to Z, but node's parser uses local time:
> new Date('2017-06-21T13:53:58')
2017-06-21T12:53:58.000Z
> new Date('2017-06-21T13:53:58Z')
2017-06-21T13:53:58.000Z
In my opinion the Z should be removed from timestamps and the system timezone should not be modified by the library. nodejs/node#3449 mentions (and I sadly have seen) that swapping the system timezone while node is executing causes the timezone to be basically unknowable.
Update ifx.connect() to include the following:
ifx.connect( {
host : 'hostname',
database : 'dbname',
user : 'username',
pass : 'password',
id : 'connection_id'
}, function ( err, conn ) {
//
} );
Hi team, I created a table with json column, I have inserted data into that table successfully using dbaacess tool of informix, but when I am trying to insert data into table using ifxnjs package prepared query, It give me error like this
User Defined Routine error. sqlerrm(json_in)[U0000]JSON
can any one please help me resolve this issue?
Datatype BYTE returns exception too.
node ixtest.js
Error: [-450] Illegal ESQL locator, or uninitialized blob variable in 4GL.
at Error (native)
var opts = {
database : 'filmy@ixlur',
username : 'informix',
password : '***'
};
var informix = require( 'informix' )( opts );
informix
.query( "select ffoto from filmy where fid=1" )
.then( function ( cursor )
{
return cursor.fetchAll();
} )
.then( function ( results )
{
console.log('Yes');
})
.catch( function ( err )
{
console.log( err );
} );
always get
Error: [-200] Identifier is too long.
I'm new to this, and first time using node, so I may have missed something in the setup....
server rhel 7.2
informixserver
INFORMIX-SQL Version 7.25.UC6R1 Thu Mar 4 19:58:41 CST 2004
[root@mon37 tx]# esql -V
IBM Informix CSDK Version 4.10, IBM Informix-ESQL Version 4.10.FC2W1
Software Serial Number RDS#N000000
[root@mon37 tx]# node --version
v4.6.1
set infromix env
[root@mon37 ~]# . /u/catcom/catcom_vars
export DBDATE='DMY4'
export IFX_LIBS='/usr/informix_sqldev_4gldev_75_x64/lib'
export INFORMIXDIR='/usr/informix_sqldev_4gldev_75_x64'
export IFMX_ESQLC='/usr/informix_sqldev_4gldev_75_x64/bin/esql'
node-informix install log.....
[root@mon37 ~]# npm install --save informix
/
[email protected] install /root/node_modules/informix
node-gyp rebuild
make: Entering directory /root/node_modules/informix/build' ACTION binding_gyp_esqlc_target_esql_preprocess Release/obj/gen/src/esqlc.cpp esqlc: "esqlc.ecpp", line 19: Warning -33011: Current declaration of 'esql_user' hides previous declaration. esqlc: "esqlc.ecpp", line 20: Warning -33011: Current declaration of 'esql_pass' hides previous declaration. 2 warning(s) TOUCH Release/obj.target/esqlc.stamp CXX(target) Release/obj.target/ifx/src/module.o CXX(target) Release/obj.target/ifx/src/ifx/ifx.o CXX(target) Release/obj.target/ifx/src/ifx/workers/connect.o CXX(target) Release/obj.target/ifx/src/ifx/workers/disconnect.o CXX(target) Release/obj.target/ifx/src/ifx/workers/stmtprepare.o CXX(target) Release/obj.target/ifx/src/ifx/workers/stmtexec.o CXX(target) Release/obj.target/ifx/src/ifx/workers/stmtfree.o CXX(target) Release/obj.target/ifx/src/ifx/workers/fetch.o CXX(target) Release/obj.target/ifx/src/ifx/workers/cursorclose.o CXX(target) Release/obj.target/ifx/gen/src/esqlc.o SOLINK_MODULE(target) Release/obj.target/ifx.node COPY Release/ifx.node make: Leaving directory
/root/node_modules/informix/build'
[email protected] node_modules/informix
âââ [email protected]
âââ [email protected]
âââ [email protected] ([email protected])
âââ [email protected]
--- test script ---------------------
[root@mon37 tx]# cat nodetest1.js
var Informix = require( 'informix' ).Informix;
var informix = new Informix( { database : 'catcom' } );
informix
.query( "select siteid from site" )
.then( function ( cursor ) {
return cursor.fetchAll( { close : true } );
} )
.then( function ( cursor ) {
return cursor.fetchAll( { close : true } );
} )
.then( function ( results ) {
console.log( 'results:', results );
} )
.catch( function ( err ) {
console.log( err );
} );
setp debug thru test script...
-bash-4.2$ node debug nodetest1.js
< Debugger listening on port 5858
connecting to 127.0.0.1:5858 ... ok
break in nodetest1.js:2
1
2 var Informix = require( 'informix' ).Informix;
3 var informix = new Informix( { database : 'catcom' } );
4
3
debug> 3
debug> setp
repl:1
setp
^
ReferenceError: setp is not defined
at repl:1:1
at Object.exports.runInContext (vm.js:44:17)
at Interface.protocol.onResponse.Interface.controlEval (_debugger.js:953:21)
at REPLServer.Interface.opts.eval (_debugger.js:737:41)
at bound (domain.js:287:14)
at REPLServer.runBound as eval
at REPLServer. (repl.js:431:12)
at emitOne (events.js:77:13)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:212:10)
debug> help
Commands: run (r), cont (c), next (n), step (s), out (o), backtrace (bt), setBreakpoint (sb), clearBreakpoint (cb),
watch, unwatch, watchers, repl, exec, restart, kill, list, scripts, breakOnException, breakpoints, version
step
break in internal/module.js:12
10
11 function require(path) {
12 return self.require(path);
13 }
14
step
break in module.js:351
349 //exports
property.
350 Module.prototype.require = function(path) {
351 assert(path, 'missing path');
352 assert(typeof path === 'string', 'path must be a string');
353 return Module._load(path, this);
debug> step
break in assert.js:109
107
108 function ok(value, message) {
109 if (!value) fail(value, true, message, '==', assert.ok);
110 }
111 assert.ok = ok;
run
App is already running... Tryrestart
instead
debug> step
break in assert.js:110
108 function ok(value, message) {
109 if (!value) fail(value, true, message, '==', assert.ok);
110 }
111 assert.ok = ok;
112
debug> step
break in module.js:352
350 Module.prototype.require = function(path) {
351 assert(path, 'missing path');
352 assert(typeof path === 'string', 'path must be a string');
353 return Module._load(path, this);
354 };
debug> help
Commands: run (r), cont (c), next (n), step (s), out (o), backtrace (bt), setBreakpoint (sb), clearBreakpoint (cb),
watch, unwatch, watchers, repl, exec, restart, kill, list, scripts, breakOnException, breakpoints, version
debug> next
break in module.js:353
351 assert(path, 'missing path');
352 assert(typeof path === 'string', 'path must be a string');
353 return Module._load(path, this);
354 };
355
debug> next
break in module.js:354
352 assert(typeof path === 'string', 'path must be a string');
353 return Module._load(path, this);
354 };
355
356
debug> next
break in internal/module.js:13
11 function require(path) {
12 return self.require(path);
13 }
14
15 require.resolve = function(request) {
debug> next
break in nodetest1.js:3
1
2 var Informix = require( 'informix' ).Informix;
3 var informix = new Informix( { database : 'catcom' } );
4
5 informix
debug> next
break in nodetest1.js:5
3 var informix = new Informix( { database : 'catcom' } );
4
5 informix
6 .query( "select siteid from site" )
7 .then( function ( cursor ) {
debug> next
break in nodetest1.js:7
5 informix
6 .query( "select siteid from site" )
7 .then( function ( cursor ) {
8 return cursor.fetchAll( { close : true } );
9 } )
debug> next
break in nodetest1.js:40
38
39
40 });
debug> next
break in module.js:410
408 const args = [this.exports, require, this, filename, dirname];
409 return compiledWrapper.apply(this.exports, args);
410 };
411
412
debug> next
break in module.js:417
415 var content = fs.readFileSync(filename, 'utf8');
416 module._compile(internalModule.stripBOM(content), filename);
417 };
418
419
debug> next
break in module.js:344
342 if (!Module._extensions[extension]) extension = '.js';
343 Module._extensions[extension](this, filename);
344 this.loaded = true;
345 };
346
debug> next
break in module.js:345
343 Module._extensions[extension](this, filename);
344 this.loaded = true;
345 };
346
347
debug> next
break in module.js:301
299 try {
300 module.load(filename);
301 hadException = false;
302 } finally {
303 if (hadException) {
debug> next
break in module.js:303
301 hadException = false;
302 } finally {
303 if (hadException) {
304 delete Module._cache[filename];
305 }
debug> next
break in module.js:308
306 }
307
308 return module.exports;
309 };
310
debug> next
break in module.js:309
307
308 return module.exports;
309 };
310
311 Module._resolveFilename = function(request, parent) {
debug> next
break in module.js:443
441 Module._load(process.argv[1], null, true);
442 // Handle any nextTicks added in the first tick of the program
443 process._tickCallback();
444 };
445
debug> next
break in module.js:444
442 // Handle any nextTicks added in the first tick of the program
443 process._tickCallback();
444 };
445
446 Module._initPaths = function() {
debug> next
break in timers.js:93
91 first._called = true;
92 first._onTimeout();
93 if (domain)
94 domain.exit();
95 threw = false;
debug> next
break in timers.js:95
93 if (domain)
94 domain.exit();
95 threw = false;
96 } finally {
97 if (threw) {
debug> next
break in timers.js:97
95 threw = false;
96 } finally {
97 if (threw) {
98 // We need to continue processing after domain error handling
99 // is complete, but not by using whatever domain was left over
debug> next
break in timers.js:66
64
65 var diff, first, threw;
66 while (first = L.peek(list)) {
67 diff = now - first._idleStart;
68 if (diff < msecs) {
debug> next
break in timers.js:110
108 }
109
110 debug('%d list empty', msecs);
111 assert(L.isEmpty(list));
112 list.close();
debug>
debug> next
break in timers.js:111
109
110 debug('%d list empty', msecs);
111 assert(L.isEmpty(list));
112 list.close();
113 delete lists[msecs];
debug> next
break in timers.js:112
110 debug('%d list empty', msecs);
111 assert(L.isEmpty(list));
112 list.close();
113 delete lists[msecs];
114 }
debug> next
break in timers.js:113
111 assert(L.isEmpty(list));
112 list.close();
113 delete lists[msecs];
114 }
115
debug> next
break in timers.js:114
112 list.close();
113 delete lists[msecs];
114 }
115
116
debug> next
< [Error: [-200] Identifier is too long.]
debug> next
Add functionality to prepare and execute SQL statements using ESQL/C (e.g. ifx.prepare()
, ifx.exec()
).
$ npm install --save informix
[email protected] install C:\wamp64\www\ecus\node_modules\informix
node-gyp rebuild
C:\wamp64\www\ecus\node_modules\informix>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Warning: Missing input files:
C:\wamp64\www\ecus\node_modules\informix\build..\build\esqlc.c
Los proyectos de esta soluci▒n se van a compilar de uno en uno. Para habilitar la compilaci▒n en paralelo, agregue el modificador "/m".
prepare
1 archivo(s) copiado(s).
esql-preprocess
esqlc: "release\obj\esqlc\src\esqlc.ec", line 19: Warning -33011: Current declaration of 'esql_user' hides previous declaration.
esqlc: "release\obj\esqlc\src\esqlc.ec", line 20: Warning -33011: Current declaration of 'esql_pass' hides previous declaration.
2 warning(s)
IBM Informix CSDK Version 3.50, IBM Informix-ESQL Version 3.50.TC6
move
Se han movido 1 archivos.
module.cpp
ifx.cpp
connect.cpp
disconnect.cpp
c:\program files (x86)\ibm\informix\client-sdk\incl\esql\datetime.h(37): warning C4103: alignment changed after including header, may be due to missing #pragma pack(pop) (compiling source file ..\src\ifx\ifx.cpp) [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
stmtprepare.cpp
stmtexec.cpp
stmtfree.cpp
fetch.cpp
cursorclose.cpp
esqlc.cpp
win_delay_load_hook.cc
c:\program files (x86)\ibm\informix\client-sdk\incl\esql\datetime.h(37): warning C4103: alignment changed after including header, may be due to missing #pragma pack(pop) (compiling source file >C:\wamp64\www\ecus\node_modules\informix\build\Release\obj\global_intermediate\src\esqlc.cpp) [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
Creating library C:\wamp64\www\ecus\node_modules\informix\build\Release\ifx.lib and object C:\wamp64\www\ecus\node_modules\informix\build\Release\ifx.exp
ifx.obj : error LNK2001: unresolved external symbol rtypalign [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
ifx.obj : error LNK2001: unresolved external symbol rtypmsize [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
disconnect.obj : error LNK2001: unresolved external symbol SqlFreeMem [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
fetch.obj : error LNK2001: unresolved external symbol rfmtdate [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
fetch.obj : error LNK2001: unresolved external symbol ifx_int8toasc [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
fetch.obj : error LNK2001: unresolved external symbol intofmtasc [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
fetch.obj : error LNK2001: unresolved external symbol dectoasc [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
fetch.obj : error LNK2001: unresolved external symbol dttofmtasc [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
fetch.obj : error LNK2001: unresolved external symbol dectodbl [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
fetch.obj : error LNK2001: unresolved external symbol ifx_int8tolong [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol fnsqlcode [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_curs_decl_dynm [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_curs_open [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_connect_close [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol fnsqlstate [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_curs_close [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_connect_set [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_curs_fetch [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol ifx_free_conn_user [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_mt_free [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_exec [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_connect_open [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_describe_input_stmt [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_prep [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_curs_locate [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol sqli_describe_output_stmt [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol rgetlmsg [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol ifx_alloc_conn_user [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
esqlc.obj : error LNK2001: unresolved external symbol fnsqlca [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
C:\wamp64\www\ecus\node_modules\informix\build\Release\ifx.node : fatal error LNK1120: 29 unresolved externals [C:\wamp64\www\ecus\node_modules\informix\build\ifx.vcxproj]
gyp ERR! build error
gyp ERR! stack Error:C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\wamp64\www\ecus\node_modules\informix
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\wamp64\www\ecus\package.json'
npm WARN ecus No description
npm WARN ecus No repository field.
npm WARN ecus No README data
npm WARN ecus No license field.npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install:node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Programador1\AppData\Roaming\npm-cache_logs\2018-03-17T13_51_51_933Z-debug.log
My enviroment variables:
PATH=C:\Program Files (x86)\IBM\Informix\Client-SDK\bin
INFORMIXDIR=C:\Program Files (x86)\IBM\Informix\Client-SDK
LD_LIBRARY_PATH=C:\Program Files (x86)\IBM\Informix\Client-SDK\lib;C:\Program Files (x86)\IBM\Informix\Client-SDK\lib\esql;C:\Program Files (x86)\IBM\Informix\Client-SDK\incl\esql
I'm tyring to install in a client
Trying to use this module on a Raspbian Jessie ARM linux install on a Raspberry Pi 2B
Building is resulting in compilation errors.
npm install --save informix
> [email protected] install /home/pi/sandbox/mine/informix-module/node_modules/informix
> node-gyp rebuild
make: Entering directory '/home/pi/sandbox/mine/informix-module/node_modules/informix/build'
ACTION binding_gyp_esqlc_target_esql_preprocess Release/obj/gen/src/esqlc.cpp
esqlc: "esqlc.ecpp", line 19: Warning -33011: Current declaration of 'esql_user' hides previous declaration.
esqlc: "esqlc.ecpp", line 20: Warning -33011: Current declaration of 'esql_pass' hides previous declaration.
2 warning(s)
TOUCH Release/obj.target/esqlc.stamp
CXX(target) Release/obj.target/ifx/src/module.o
CXX(target) Release/obj.target/ifx/src/ifx/ifx.o
CXX(target) Release/obj.target/ifx/src/ifx/workers/connect.o
CXX(target) Release/obj.target/ifx/src/ifx/workers/disconnect.o
CXX(target) Release/obj.target/ifx/src/ifx/workers/stmtprepare.o
CXX(target) Release/obj.target/ifx/src/ifx/workers/stmtexec.o
CXX(target) Release/obj.target/ifx/src/ifx/workers/stmtfree.o
CXX(target) Release/obj.target/ifx/src/ifx/workers/fetch.o
In file included from ../../nan/nan.h:198:0,
from ../src/ifx/workers/fetch.h:5,
from ../src/ifx/workers/fetch.cpp:6:
../../nan/nan_new.h: In instantiation of ‘typename Nan::imp::Factory<T>::return_t Nan::New(A0) [with T = v8::Int32; A0 = long int; typename Nan::imp::Factory<T>::return_t = v8::Local<v8::Int32>]’:
../src/ifx/workers/fetch.cpp:141:76: required from here
../../nan/nan_new.h:208:35: error: call of overloaded ‘New(long int&)’ is ambiguous
return imp::Factory<T>::New(arg0);
^
../../nan/nan_new.h:208:35: note: candidates are:
In file included from ../../nan/nan_new.h:189:0,
from ../../nan/nan.h:198,
from ../src/ifx/workers/fetch.h:5,
from ../src/ifx/workers/fetch.cpp:6:
../../nan/nan_implementation_12_inl.h:158:1: note: static Nan::imp::IntegerFactory<T>::return_t Nan::imp::IntegerFactory<T>::New(int32_t) [with T = v8::Int32; Nan::imp::IntegerFactory<T>::return_t = v8::Local<v8::Int32>; int32_t = int]
IntegerFactory<T>::New(int32_t value) {
^
In file included from ../../nan/nan.h:198:0,
from ../src/ifx/workers/fetch.h:5,
from ../src/ifx/workers/fetch.cpp:6:
../../nan/nan_new.h:114:26: note: static Nan::imp::IntegerFactory<T>::return_t Nan::imp::IntegerFactory<T>::New(uint32_t) [with T = v8::Int32; Nan::imp::IntegerFactory<T>::return_t = v8::Local<v8::Int32>; uint32_t = unsigned int]
static inline return_t New(uint32_t value);
^
In file included from ../../nan/nan.h:198:0,
from ../src/ifx/workers/fetch.h:5,
from ../src/ifx/workers/fetch.cpp:6:
../../nan/nan_new.h: In function ‘typename Nan::imp::Factory<T>::return_t Nan::New(A0) [with T = v8::Int32; A0 = long int; typename Nan::imp::Factory<T>::return_t = v8::Local<v8::Int32>]’:
../../nan/nan_new.h:209:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
ifx.target.mk:112: recipe for target 'Release/obj.target/ifx/src/ifx/workers/fetch.o' failed
make: *** [Release/obj.target/ifx/src/ifx/workers/fetch.o] Error 1
make: Leaving directory '/home/pi/sandbox/mine/informix-module/node_modules/informix/build'
Can i know how to call stored procedure of informix from this library.
Thank you.
Make it possible to free statements (and close any associated cursors).
Hello,
After attempting to build ( npm install --save informix )
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
@node-base:$ node -v$ npm -v
v9.3.0
@node-base:
5.6.0
@node-base:~$
I got the error result:
gyp: Call to 'THREADLIB=POSIX esql -thread -libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp
failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack at ChildProcess.emit (events.js:159:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Linux 4.4.0-92-generic
Here is the log excert:
215 verbose lifecycle [email protected]install: unsafe-perm in lifecycle trueinstall: PATH: /usr/local/lib/node_modules/
216 verbose lifecycle [email protected]
npm/node_modules/npm-lifecycle/node-gyp-bin:/home/aochoa/services/dbtest/node_mo
dules/informix/node_modules/.bin:/home/aochoa/services/dbtest/node_modules/.bin:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/aochoa/apps/I
BM/informix/bin
217 verbose lifecycle [email protected]install: CWD: /home/aochoa/services/dbtest/node_modules/informixinstall: Args: [ '-c', 'node-gyp rebuild' ]
218 silly lifecycle [email protected]
219 silly lifecycle [email protected]install: Returned: code: 1 signal: nullinstall: Failed to exec install script
220 info lifecycle [email protected]
221 verbose unlock done using /home/aochoa/.npm/_locks/staging-b3a1fe030de2c206.lock for /home/aochoa/services/dbtest/node_modules/.staging
222 silly saveTree [email protected]
222 silly saveTree └─┬ [email protected]
222 silly saveTree ├── [email protected]
222 silly saveTree ├─┬ [email protected]
222 silly saveTree │ └── [email protected]
222 silly saveTree ├── [email protected]
222 silly saveTree ├── [email protected]
223 warn [email protected] No description
224 warn [email protected] No repository field.
225 verbose stack Error: [email protected] install: node-gyp rebuild
225 verbose stack Exit status 1
225 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
225 verbose stack at EventEmitter.emit (events.js:159:13)
225 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
225 verbose stack at ChildProcess.emit (events.js:159:13)
225 verbose stack at maybeClose (internal/child_process.js:943:16)
225 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
226 verbose pkgid [email protected]
227 verbose cwd /home/aochoa/services/dbtest
228 verbose Linux 4.4.0-92-generic
229 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "informix"
230 verbose node v9.3.0
231 verbose npm v5.6.0
232 error code ELIFECYCLE
233 error errno 1
Second example (context and transaction based) on home page ( https://www.npmjs.com/package/informix ) is not working.
It will display "serial" value but no record is inserted.
create database demac with buffered log;
create table tcustomers
(
id serial not null,
fname nvarchar(50),
lname nvarchar(50),
primary key (id)
);
var opts = {
database : 'demac@ixlur',
username : 'informix',
password : '***'
};
var informix = require( 'informix' )( opts );
var ctx = informix.createContext();
ctx.begin()
.then( function () {
return ctx.query( "insert into tcustomers( fname, lname ) values( 'John', 'Smith' );" );
} )
.then( function ( cursor ) {
console.log( 'id:', cursor.serial() );
cursor.close();
return ctx.commit();
} )
.then( function () {
return ctx.end();
} )
.catch( function ( err ) {
console.log( err );
} );
It will work, if commit() is called BEFORE closing cursor.
This is working fine:
var opts = {
database : 'demac@ixlur',
username : 'informix',
password : '***'
};
var informix = require( 'informix' )( opts );
var ctx = informix.createContext();
ctx.begin()
.then( function () {
return ctx.query( "insert into tcustomers( fname, lname ) values( 'John', 'Smith' );" );
} )
.then( function ( cursor ) {
console.log( 'id:', cursor.serial() );
ctx.commit(); // BEFORE CLOSE
cursor.close(); // AFTER COMMIT
} )
.then( function () {
return ctx.end();
} )
.catch( function ( err ) {
console.log( err );
} );
When is selected TEXT field, application returns exception.
node ixtest.js
Error: [-450] Illegal ESQL locator, or uninitialized blob variable in 4GL.
at Error (native)
var opts = {
database : 'filmy@ixlur',
username : 'informix',
password : '***'
};
var informix = require( 'informix' )( opts );
informix
.query( "select fpopis from filmy;" )
.then( function ( cursor )
{
return cursor.fetchAll();
} )
.then( function ( results )
{
console.log( results );
})
.catch( function ( err )
{
console.log( err );
} );
Since DB communications are done in a thread outside the main event loop, it is possible for two or more threads to try to use the same connection at a given point in time. This will give a [-1802] Connection name in use.
error to the threads who couldn't acquire the connection resource.
The native binding already supports multiple connection handling so the public client API should be updated to support connection pools.
Date is returned as number, probably as number of days starting at 1900.
Will be better to get JS DATE and null.
dbaccess:
echo select dtmprec from cenmat where nazevmater like 'AR%' | dbaccess pemaxdb
Database selected.
dtmprec
02.12.2016
16.05.2016
18.08.2016
17.05.2016
// nothing i.m. NULL
// nothing i.m. NULL
06.12.2016
7 row(s) retrieved.
node-informix:
[ [ 42705 ],
[ 42505 ],
[ 42599 ],
[ 42506 ],
[ -2147483648 ],
[ -2147483648 ],
[ 42709 ] ]
var opts = {
database : 'pemaxdb@ixlur',
username : 'informix',
password : '***'
};
var informix = require( 'informix' )( opts );
informix
.query( "select dtmprec from cenmat where nazevmater like 'AR%';" )
.then( function ( cursor )
{
return cursor.fetchAll();
} )
.then( function ( results )
{
console.log( results );
})
.catch( function ( err )
{
console.log( err );
} );
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.