Skip to content

Commit

Permalink
Merge pull request #4 from jasonhillier/master
Browse files Browse the repository at this point in the history
Carry disableDeleteTracking flag forward during Create query clone operation
  • Loading branch information
stevenvelozo committed Oct 28, 2015
2 parents da77a4a + f60627f commit 8a1bf3f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meadow",
"version": "0.1.16",
"version": "0.1.17",
"description": "A data access library.",
"main": "source/Meadow.js",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion source/behaviors/Meadow-Create.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ var meadowBehaviorCreate = function(pMeadow, pQuery, fCallBack)
// Step 3: Read the record
function (pQuery, pIDRecord, fStageComplete)
{
var tmpQueryRead = pQuery.clone().addFilter(pMeadow.defaultIdentifier, pIDRecord);
var tmpQueryRead = pQuery.clone().addFilter(pMeadow.defaultIdentifier, pIDRecord)
.setDisableDeleteTracking(pQuery.parameters.query.disableDeleteTracking); //if delete tracking is disabled, we need to disable it on this Read operation

if (pMeadow.rawQueries.checkQuery('Read'))
{
tmpQueryRead.parameters.queryOverride = pMeadow.rawQueries.getQuery('Read');
Expand Down
25 changes: 25 additions & 0 deletions test/Meadow-Provider-MySQL_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,31 @@ suite
}
);
test
(
'Create a record in the database with Deleted bit already set',
function(fDone)
{
var testMeadow = newMeadow().setIDUser(90210);

var tmpQuery = testMeadow.query.clone().setLogLevel(5)
.setDisableDeleteTracking(true)
.addRecord({Name:'Blastoise', Type:'Pokemon', Deleted: true});

testMeadow.doCreate(tmpQuery,
function(pError, pQuery, pQueryRead, pRecord)
{
console.log('BADTHING'+pError)
// We should have a record ....
Expect(pRecord.Name)
.to.equal('Blastoise');
Expect(pRecord.CreatingIDUser)
.to.equal(90210);
fDone();
}
)
}
);
test
(
'Read a record from the database',
function(fDone)
Expand Down

0 comments on commit 8a1bf3f

Please sign in to comment.