Closed sqllyw closed 3 years ago
Try to use options on createConnection(options) https://github.com/xdenser/node-firebird-libfbclient/blob/master/README.md#reference
tried with following code, still have the error, am I missing something?
var fb = require("firebird");
sys = require("sys");
let con = fb.createConnection({ lc_type: 'WIN1252', lc_decode: (data) => iconv.decode(data, 'windows-1252') });
con.connectSync('10.114.173.154://opt/interbase/examples/employee.gdb', 'sysdba', 'masterkey', '');
var res = con.querySync("select * from country;");
var rows = res.fetchSync("all", true);
console.log(sys.inspect(rows));
following code works:
var con = fb.createConnection();
con.connectSync('10.114.173.154://opt/interbase/examples/employee.gdb','sysdba','masterkey','');
if I update the fb-bindings-connection.h :
char *lc_type = const_cast<char *>("UNICODE_FSS");
is this safe ?
option name is 'lc_ctype'.
thanks, updated the code, but still has the same error:
var fb = require("firebird");
sys = require("sys");
let con = fb.createConnection({ lc_ctype: 'WIN1252', lc_decode: (data) => iconv.decode(data, 'windows-1252') });
con.connectSync('10.114.173.154://opt/interbase/examples/employee.gdb', 'sysdba', 'masterkey', '');
var res = con.querySync("select * from country;");
var rows = res.fetchSync("all", true);
console.log(sys.inspect(rows));
Sorry, checked code again it is 'lc_type'. I wonder why ? in FB/IB API it is 'lc_ctype'. Probably it was someone's PR which I did not check properly. We have no test for this feature. But the code looks ok. Yes you may use C++ patch as workaround. Why do you set "UNICODE_FSS" in C++ and "WIN1252" in JS?
Try to use options on createConnection(options) https://github.com/xdenser/node-firebird-libfbclient/blob/master/README.md#reference
I look at firebird.js and found this line:
exports.createConnection = function () {
var c = new Connection();
return c;
};
it is not expecting an options object?
Aha this was not released yet. Last release is 28 Oct 2019, And the PR merged later. Ok I'll make new release.
Sorry, checked code again it is 'lc_type'. I wonder why ? in FB/IB API it is 'lc_ctype'. Probably it was someone's PR which I did not check properly. We have no test for this feature. But the code looks ok. Yes you may use C++ patch as workaround. Why do you set "UNICODE_FSS" in C++ and "WIN1252" in JS?
I never know there is an options object, so patched C++ first, which UNICODE_FSS is the one closed to UTF8.
Aha this was not released yet. Last release is 28 Oct 2019, And the PR merged later. Ok I'll make new release.
that will be nice, thanks.
Aha this was not released yet. Last release is 28 Oct 2019, And the PR merged later. Ok I'll make new release.
Just tried the new release (0.1.5), it works as expected, this really helps to access legacy databases without doing a database migration (ib to fb), Thanks!!!
Following is the final code accessing an Interbase 6 gdb:
var fb = require("firebird");
sys = require("sys");
let con = fb.createConnection({ lc_ctype: 'WIN1252', lc_ctype_decode: (data) => data.toString()});
con.connectSync('10.114.173.154://opt/interbase/examples/employee.gdb', 'sysdba', 'masterkey', '');
var res = con.querySync("select * from country;");
var rows = res.fetchSync("all", true);
console.log(sys.inspect(rows));
Hi, I can use the Firebird 1.5 to view contents in a IB6 database, but with following code, I got an error:
Error: While connecting - bad parameters on attach or create database CHARACTER SET UTF8 is not defined
is there a way that I can connect to a IB6 db? need is simple, just a read only 'select * from ...' thanks