SQL Agent 11

Tue Jan 16 2018 22:38:41 GMT+0100 (CET), Peter Širka

Node ORM: SQL Agent 11

New version of SQL Agent brings some improvements and bug fixes.

Improved listing method

I have improved sql.listing() method for all databases. Now it returns an extended object with new properties: page, pages and limit.

sql.listing('users', 'tbl_user');
sql.exec(console.log);

Output:

{
    count: 300,
    items: [....].
    page: 1,
    pages: 10,
    limit: 10
}

Inline callback

Inline callback can be defined in SqlBuilder and it supports only the one callback function. The example below describes the functionality:

sql.listing('tbl_user').make(function(builder) {
    builder.where('age', '>', 18);
    builder.callback(function(err, response) {
        console.log(err, response);
    });
});

sql.update('tbl_user').make(function(builder) {
    builder.where('age', '>', 18);
    builder.inc('countview', 1);
    builder.callback(function(err, response) {
        console.log(err, response);
    });
});


sql.exec();

MongoDB problems

Each version of MongoDB is a bit different and this is a big problem for long term projects. Therefore I don't recommend to use MongoDB. This version of SQL Agent solves a problem with a new version of MongoDB driver and with storing static files in GridFS. Support Node PostgreSQL it's really good and helpful module.

PostgreSQL improvements

PostgreSQL Native C/C++ bindings

I have improved connection string for PostgreSQL by adding a native parameter for enabling PostgreSQL native C/C++ bindings which is much faster than classic pure JavaScript implementation.

First install pg-native:

$ npm install pg pg-native

Connection string:

postgresql://user:password@127.0.0.1/database_name?native=true

Usage is absolutely same than you're use with pure JavaScript implementation, so just change your connection string and everything will work like a charm.

Fixed storing files in older PG version

I have fixed storing files in older < 9.3 versions of PostgreSQL. This module stores files in pg_largeobject collection. Files are stored in chunks and reading/writing is built on Node.js streams.


Good to know

Node.js ORM SQL Agent is a part of Total.js platform. Buy a premium account and support this great JavaScript's platform.


Tags

Follow us

Latest blogs
How do I transform ErrorBuilder output?
Mon Jan 29 2018 09:22:49 GMT+0100 (CET)
Flow: REST API components
Mon Jan 22 2018 10:11:14 GMT+0100 (CET)
New Total.js Eshop v11
Fri Jan 19 2018 09:55:09 GMT+0100 (CET)
New Total.js CMS v11
Fri Jan 19 2018 00:24:05 GMT+0100 (CET)
Flow 4.1.0
Thu Jan 18 2018 23:58:37 GMT+0100 (CET)

Latest comments
Total.js is amazing! ;)
Leonardo Hessel
Tue Dec 19 2017 19:51:15 GMT+0100 (CET)
It's easy, just set e.g. `res.status = 404`.
Peter
Thu Nov 16 2017 07:54:11 GMT+0100 (CET)
Yes, it's valid.
Peter
Thu Nov 16 2017 07:53:06 GMT+0100 (CET)
How do we set the status code in custome middleware?
Nabeel
Mon Oct 02 2017 10:31:40 GMT+0200 (CEST)
Node... Awesome applications.
oscar
Thu Aug 31 2017 02:21:59 GMT+0200 (CEST)
Awesome!
Tema
Wed May 10 2017 06:33:13 GMT+0200 (CEST)
Awesome, thanks!
Tema
Tue May 02 2017 14:13:03 GMT+0200 (CEST)