Comparing version 0.0.8 to 0.0.9
{ | ||
"name": "foxhound", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "A Database Query generation library.", | ||
@@ -5,0 +5,0 @@ "main": "source/FoxHound.js", |
@@ -242,3 +242,2 @@ /** | ||
continue; | ||
break; | ||
} | ||
@@ -329,3 +328,2 @@ if (tmpCurrentColumn > 0) | ||
continue; | ||
break; | ||
} | ||
@@ -332,0 +330,0 @@ if (tmpCurrentColumn > 0) |
@@ -16,2 +16,15 @@ /** | ||
var _AnimalSchema = ( | ||
[ | ||
{ Column: "IDAnimal", Type:"AutoIdentity" }, | ||
{ Column: "GUIDAnimal", Type:"AutoGUID" }, | ||
{ Column: "CreateDate", Type:"CreateDate" }, | ||
{ Column: "CreatingIDUser", Type:"CreateIDUser" }, | ||
{ Column: "UpdateDate", Type:"UpdateDate" }, | ||
{ Column: "UpdatingIDUser", Type:"UpdateIDUser" }, | ||
{ Column: "Deleted", Type:"Deleted" }, | ||
{ Column: "DeletingIDUser", Type:"DeleteIDUser" }, | ||
{ Column: "DeleteDate", Type:"DeleteDate" } | ||
]); | ||
suite | ||
@@ -220,3 +233,74 @@ ( | ||
); | ||
suite | ||
( | ||
'Complex Query Generation - Schemas', | ||
function() | ||
{ | ||
test | ||
( | ||
'Create Query', | ||
function() | ||
{ | ||
var tmpQuery = libFoxHound.new(libFable) | ||
.setLogLevel(5) | ||
.setDialect('MySQL') | ||
.setScope('Animal') | ||
.addRecord( | ||
{ | ||
IDAnimal:false, | ||
GUIDAnimal:false, | ||
CreateDate:false, | ||
CreatingIDUser:false, | ||
UpdateDate:false, | ||
UpdatingIDUser:false, | ||
Deleted:false, | ||
DeletingIDUser:false, | ||
DeleteDate:false, | ||
Name:'Froo Froo', | ||
Age:18 | ||
}); | ||
tmpQuery.query.schema = _AnimalSchema; | ||
// Build the query | ||
tmpQuery.buildCreateQuery(); | ||
// This is the query generated by the MySQL dialect | ||
libFable.log.trace('Create Query', tmpQuery.query); | ||
Expect(tmpQuery.query.body) | ||
.to.equal("INSERT INTO `Animal` ( IDAnimal, GUIDAnimal, CreateDate, CreatingIDUser, UpdateDate, UpdatingIDUser, Deleted, Name, Age) VALUES ( NULL, :GUIDAnimal_1, NOW(), :CreatingIDUser_3, NOW(), :UpdatingIDUser_5, :Deleted_6, :Name_7, :Age_8);"); | ||
} | ||
); | ||
test | ||
( | ||
'Update Query', | ||
function() | ||
{ | ||
var tmpQuery = libFoxHound.new(libFable).setDialect('MySQL') | ||
.setLogLevel(5) | ||
.setScope('Animal') | ||
.addFilter('IDAnimal', 9) | ||
.addRecord({ | ||
IDAnimal:82, | ||
GUIDAnimal:'1111-2222-3333-4444-5555-6666-7777', | ||
CreateDate:false, | ||
CreatingIDUser:false, | ||
UpdateDate:false, | ||
UpdatingIDUser:false, | ||
Deleted:false, | ||
DeletingIDUser:false, | ||
DeleteDate:false, | ||
Name:'Froo Froo', | ||
Age:18 | ||
}); | ||
tmpQuery.query.schema = _AnimalSchema; | ||
// Build the query | ||
tmpQuery.buildUpdateQuery(); | ||
// This is the query generated by the MySQL dialect | ||
libFable.log.trace('Update Query', tmpQuery.query); | ||
Expect(tmpQuery.query.body) | ||
.to.equal('UPDATE `Animal` SET GUIDAnimal = :GUIDAnimal_0, UpdateDate = NOW(), UpdatingIDUser = :UpdatingIDUser_2, Deleted = :Deleted_3, Name = :Name_4, Age = :Age_5 WHERE IDAnimal = :IDAnimal_w0;'); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
); |
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
68381
2035