I need to access files on the Firebird DBMS using Javascript on Windows, 
and node.js seemed like a good way to go. I'm new to Javascript, though, so 
please bear with me.
After installing node.js, I downloaded a project called 
node-firebird-libfbclient-master/firebird. Then I created a one-table test 
database and attempted to access it with the following sample code 
(fbtest.js):

var fb  = require("./firebird");
sys = require("sys"); 
var con = fb.createConnection();
con.connectSync('test.fdb','sysdba','masterkey','');
con.querySync("insert into test (id,name) values (5, 'new one')");
var res = con.querySync("select * from test");
con.commitSync();
var rows = res.fetchSync("all",true);
console.log(sys.inspect(rows));

I had no project specifically named "firebird", so I changed the first line 
to the following:
var fb  = require("./node-firebird-libfbclient-master/firebird");

This was the result when I ran "node fbtest.js" in the console window.

module.js:340
    throw err;
          ^
Error: Cannot find module './build/Release/binding'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> 
(C:\JavaScript\node-firebird-libfbclient-master\firebird.js:1:77)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

This was my introduction to the concept of the "binding.gyp" file. I 
discovered that this firebird module was using the older, wscript-based 
build system.
So I installed python 2.75 (is this the correct version and then attempted 
to create an appropriate binding.gyp file. After looking at a few examples, 
I created this:

*{
  "targets": [
    {
      "target_name": "binding",
      'sources': [
        'src/fb-bindings.cc',
        'src/fb-bindings-blob.cc',
        'src/fb-bindings-connection.cc',
        'src/fb-bindings-eventblock.cc',
        'src/fb-bindings-fbeventemitter.cc',
        'src/fb-bindings-fbresult.cc',
        'src/fb-bindings-statement.cc',
      ]
    }
  ]
}

In the node-firebird-libfbclient-master directory, I ran "node-gyp 
configure" and it succeeded.
However, I still have the same error. And I can see that there's not even a 
"Release" directory under "build", so it can't possibly work.
I'm a long-time C++ programmer, and the Javascript way of doing things 
still seems counter-intuitive to me. Is there a guide somewhere to creating 
a proper "binding.gyp" file, so I can get this thing working?
Thanks!


*

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to