Skip to content

Commit

Permalink
fix count transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Tiertant committed Apr 7, 2020
1 parent 02d35c7 commit bd8fe35
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Offshore-sql is an adapter for sql databases, created for [Offshore](https://git
[![npm version](https://badge.fury.io/js/offshore-sql.svg)](https://www.npmjs.com/offshore-sql)
[![Build Status](https://travis-ci.org/Atlantis-Software/offshore-sql.svg?branch=master)](https://travis-ci.org/Atlantis-Software/offshore-sql)
[![Coverage Status](https://coveralls.io/repos/github/Atlantis-Software/offshore-sql/badge.svg?branch=master)](https://coveralls.io/github/Atlantis-Software/offshore-sql?branch=master)
[![NSP Status](https://nodesecurity.io/orgs/atlantis/projects/fa52b94f-44de-4f15-a196-4a44a79bce1d/badge)](https://nodesecurity.io/orgs/atlantis/projects/fa52b94f-44de-4f15-a196-4a44a79bce1d)
[![Dependencies Status](https://david-dm.org/Atlantis-Software/offshore-sql.svg)](https://david-dm.org/Atlantis-Software/offshore-sql)


Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ module.exports = (function() {
if (transaction) {
query.transacting(transaction);
}
query.asCallback(function(err, record) {
query.then(function(cnt){ return cnt[0]['cnt']; }).asCallback(function(err, record) {
if (err) {
return cb(err);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/dialect.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ GenericDialect.prototype.count = function(connection, collection, opts) {
var options = this.Utils.normalizeCriteria(opts);
var query = new this.CriteriaProcessor(connection, tableName, options, connection.client(tableName)).getQuery();
query.count('* as cnt');
return query.then(function(cnt){ return cnt[0]['cnt']; });
return query;
};

GenericDialect.prototype.select = function(connection, collection, opts) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "offshore-sql",
"version": "1.0.7",
"version": "1.0.8",
"description": "Sql Databases adapter for offshore",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit bd8fe35

Please sign in to comment.