Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it possible to create a node.js module which uses c libraries for monetdb connection?
    primarykey
    data
    text
    <p>I am trying to connect <code>monetdb</code> with <code>node.js</code>. I have a simple (20 line) c program which can query <code>moentdb</code> using mapi libraries.</p> <p>Can I use those libraries to build something(module/addon) for <code>node.js</code> which uses these libraries and connect to <code>monetdb</code>?</p> <p>(using odbc is an option but it have its own disadvantages.)</p> <p><strong>Update1 :</strong><br> node-ffi is pretty awesome. I was able to create a fetch table program pretty easily. (I have added my working code for example.)</p> <p>So if I have 3 options<br> 1. ODBC<br> 2. node-ffi<br> 3. a c program to fetch database data and listens to connection from node.js through socket </p> <p>In terms of performance which is better option to implement, if I have little less time to develop a addon for node.js</p> <pre><code>var ffi = require("ffi"); var libmylibrary = ffi.Library('/usr/local/lib/libmapi.so', { "mapi_connect":["int",["string",'int',"string","string","string","string"]], "mapi_query":['int',["int","string"]], "mapi_fetch_row":["int",["int"]], "mapi_fetch_field":["string",["int","int"]] }); var res = libmylibrary.mapi_connect("localhost", 50000,"monetdb", "monetdb", "sql", "demo"); console.log(res); var ret=libmylibrary.mapi_query(res,"select * from table"); while(libmylibrary.mapi_fetch_row(ret)){ console.log(libmylibrary.mapi_fetch_field(ret,0)); console.log(libmylibrary.mapi_fetch_field(ret,1)); } </code></pre> <p><strong>Update 2:</strong><br> Above code is not recommended for production use...it does not use async functionality of node.js so please use it for baby steps</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload