macchina-io / macchina.io

macchina.io EDGE is a powerful C++ and JavaScript SDK for edge devices, multi-service IoT gateways and connected embedded systems.
https://macchina.io
GNU General Public License v3.0
516 stars 154 forks source link

DB Session in JS #59

Closed JoaoLeiria closed 7 years ago

JoaoLeiria commented 7 years ago

Hello,

after upgrading to the tag 0.7.0 i can't access the DBSession object in JS (object is not defined). Not even on playground.

I saw you made some changes to this in the Data Session Wrapper in the 0.7.0 release. How do we use the DBSession is JS now?

Thanks in advance, João

obiltschnig commented 7 years ago

The Data (and Net/HTTP) objects have been moved into separate modules (and bundles). So you'll have to import that module:

var data = require('data');
var dbSession = new data.DBSession('SQLite', 'test.sqlite');
JoaoLeiria commented 7 years ago

Thanks for the answer @obiltschnig . The working version uses data.Session, and not data.DBSession.

var dbSession = new data.Session('SQLite', test.sqlite);

instead of

var dbSession = new data.DBSession('SQLite', 'test.sqlite');

Already made a pull request, updating the docs: #61