Comparing version 1.0.41 to 1.0.42
{ | ||
"name": "foxhound", | ||
"version": "1.0.41", | ||
"version": "1.0.42", | ||
"description": "A Database Query generation library.", | ||
@@ -5,0 +5,0 @@ "main": "source/FoxHound.js", |
@@ -116,8 +116,17 @@ /** | ||
{ | ||
return "`" + cleanseQuoting(pFieldNames[0]) + "`.`" + cleanseQuoting(pFieldNames[1]) + "`"; | ||
const cleansedFieldName = cleanseQuoting(pFieldNames[1]); | ||
if (cleansedFieldName === '*') | ||
{ | ||
// do not put * as `*` | ||
return "`" + cleanseQuoting(pFieldNames[0]) + "`.*"; | ||
} | ||
return "`" + cleanseQuoting(pFieldNames[0]) + "`.`" + cleansedFieldName + "`"; | ||
} | ||
else | ||
const cleansedFieldName = cleanseQuoting(pFieldNames[0]); | ||
if (cleansedFieldName === '*') | ||
{ | ||
return "`" + cleanseQuoting(pFieldNames[0]) + "`"; | ||
// do not put * as `*` | ||
return '*'; | ||
} | ||
return "`" + cleanseQuoting(pFieldNames[0]) + "`"; | ||
} | ||
@@ -124,0 +133,0 @@ |
@@ -165,2 +165,24 @@ /** | ||
( | ||
'Complex Read Query with qualified and unqualified "SELECT *" cases', | ||
function() | ||
{ | ||
var tmpQuery = libFoxHound.new(libFable) | ||
.setDialect('MySQL') | ||
.setScope('Animal') | ||
.setCap(10) | ||
.setBegin(0) | ||
.setDataElements(['*', 'Name', 'Age', 'Cost', 'Animal.*']) | ||
.setSort([{Column:'Age',Direction:'Ascending'}]) | ||
.setFilter({Column:'Age',Operator:'=',Value:'15',Connector:'AND',Parameter:'Age'}); | ||
tmpQuery.addSort('Cost'); | ||
// Build the query | ||
tmpQuery.buildReadQuery(); | ||
// This is the query generated by the MySQL dialect | ||
libFable.log.trace('Select Query', tmpQuery.query); | ||
Expect(tmpQuery.query.body) | ||
.to.equal('SELECT *, `Name`, `Age`, `Cost`, `Animal`.* FROM `Animal` WHERE Age = :Age_w0 ORDER BY Age, Cost LIMIT 0, 10;'); | ||
} | ||
); | ||
test | ||
( | ||
'Complex Read Query 2', | ||
@@ -167,0 +189,0 @@ function() |
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
203111
6185