Comparing version 0.0.12 to 0.0.13
@@ -293,3 +293,8 @@ /** | ||
async count() { | ||
const sql = "SELECT count(*) as t " + generateFromStatement(this.fromTables) + " " + this.whereSql; | ||
let sql; | ||
if ( this.selectSql.toLowerCase().indexOf(" distinct " ) != -1 ){ | ||
sql = "SELECT DISTINCT count(*) as t " + generateFromStatement(this.fromTables) + " " + this.whereSql; | ||
}else { | ||
sql = "SELECT count(*) as t " + generateFromStatement(this.fromTables) + " " + this.whereSql; | ||
} | ||
const row = await this.dbConn.query(sql, this.values); | ||
@@ -296,0 +301,0 @@ return (row == null || row.length == 0) ? 0 : row[0].t; |
{ | ||
"name": "mg-dbop", | ||
"private" : false, | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"homepage": "https://github.com/MacLaurinGroup/dbOp", | ||
@@ -6,0 +6,0 @@ "description": "Query builder, and validator, for MySQL and node that utilizes the underlying table to provide a level of checking", |
@@ -260,2 +260,4 @@ ## dbOp | ||
* 2019-04-08 | ||
* Fixed the count() ignoring a 'distinct' in the SELECT | ||
* 2019-03-30 | ||
@@ -262,0 +264,0 @@ * Added in setOptions() for cleaning up rows |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47741
770
283