foxhound 2.0.25 → 2.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/source/dialects/ALASQL/FoxHound-Dialect-ALASQL.js +10 -8
- package/source/dialects/DGraph/FoxHound-Dialect-DGraph.js +8 -6
- package/source/dialects/MongoDB/FoxHound-Dialect-MongoDB.js +8 -6
- package/source/dialects/MySQL/FoxHound-Dialect-MySQL.js +11 -8
- package/source/dialects/PostgreSQL/FoxHound-Dialect-PostgreSQL.js +10 -6
- package/source/dialects/SQLite/FoxHound-Dialect-SQLite.js +11 -8
- package/source/dialects/Solr/FoxHound-Dialect-Solr.js +8 -6
- package/test/FoxHound-Dialect-ALASQL_tests.js +3 -1
- package/test/FoxHound-Dialect-MySQL_tests.js +3 -1
- package/test/FoxHound-Dialect-SQLite_tests.js +3 -1
package/package.json
CHANGED
|
@@ -352,12 +352,6 @@ var FoxHoundDialectALASQL = function(pFable)
|
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
if (pParameters.query.disableAutoDateStamp &&
|
|
356
|
-
tmpSchemaEntry.Type === 'UpdateDate')
|
|
357
|
-
{
|
|
358
|
-
// This is ignored if flag is set
|
|
359
|
-
continue;
|
|
360
|
-
}
|
|
361
355
|
if (pParameters.query.disableAutoUserStamp &&
|
|
362
356
|
tmpSchemaEntry.Type === 'UpdateIDUser')
|
|
363
357
|
{
|
|
@@ -382,8 +376,16 @@ var FoxHoundDialectALASQL = function(pFable)
|
|
|
382
376
|
switch (tmpSchemaEntry.Type)
|
|
383
377
|
{
|
|
384
378
|
case 'UpdateDate':
|
|
385
|
-
|
|
386
|
-
|
|
379
|
+
if (pParameters.query.disableAutoDateStamp)
|
|
380
|
+
{
|
|
381
|
+
var tmpColumnParameter = tmpColumn+'_'+tmpCurrentColumn;
|
|
382
|
+
tmpUpdate += ' '+escapeColumn(tmpColumn, pParameters)+' = :'+tmpColumnParameter;
|
|
383
|
+
pParameters.query.parameters[tmpColumnParameter] = tmpRecords[0][tmpColumn];
|
|
384
|
+
}
|
|
385
|
+
else
|
|
386
|
+
{
|
|
387
|
+
tmpUpdate += ' '+escapeColumn(tmpColumn, pParameters)+' = NOW()';
|
|
388
|
+
}
|
|
387
389
|
break;
|
|
388
390
|
case 'UpdateIDUser':
|
|
389
391
|
// This is the user ID, which we hope is in the query.
|
|
@@ -489,11 +489,6 @@ var FoxHoundDialectDGraph = function(pFable)
|
|
|
489
489
|
{
|
|
490
490
|
var tmpSchemaEntry = findSchemaEntry(tmpColumn, tmpSchema);
|
|
491
491
|
|
|
492
|
-
if (pParameters.query.disableAutoDateStamp &&
|
|
493
|
-
tmpSchemaEntry.Type === 'UpdateDate')
|
|
494
|
-
{
|
|
495
|
-
continue;
|
|
496
|
-
}
|
|
497
492
|
if (pParameters.query.disableAutoUserStamp &&
|
|
498
493
|
tmpSchemaEntry.Type === 'UpdateIDUser')
|
|
499
494
|
{
|
|
@@ -513,7 +508,14 @@ var FoxHoundDialectDGraph = function(pFable)
|
|
|
513
508
|
switch (tmpSchemaEntry.Type)
|
|
514
509
|
{
|
|
515
510
|
case 'UpdateDate':
|
|
516
|
-
|
|
511
|
+
if (pParameters.query.disableAutoDateStamp)
|
|
512
|
+
{
|
|
513
|
+
tmpUpdateDoc[tmpColumn] = tmpRecords[0][tmpColumn];
|
|
514
|
+
}
|
|
515
|
+
else
|
|
516
|
+
{
|
|
517
|
+
tmpUpdateDoc[tmpColumn] = '$$NOW';
|
|
518
|
+
}
|
|
517
519
|
break;
|
|
518
520
|
case 'UpdateIDUser':
|
|
519
521
|
tmpUpdateDoc[tmpColumn] = pParameters.query.IDUser;
|
|
@@ -492,11 +492,6 @@ var FoxHoundDialectMongoDB = function(pFable)
|
|
|
492
492
|
{
|
|
493
493
|
var tmpSchemaEntry = findSchemaEntry(tmpColumn, tmpSchema);
|
|
494
494
|
|
|
495
|
-
if (pParameters.query.disableAutoDateStamp &&
|
|
496
|
-
tmpSchemaEntry.Type === 'UpdateDate')
|
|
497
|
-
{
|
|
498
|
-
continue;
|
|
499
|
-
}
|
|
500
495
|
if (pParameters.query.disableAutoUserStamp &&
|
|
501
496
|
tmpSchemaEntry.Type === 'UpdateIDUser')
|
|
502
497
|
{
|
|
@@ -516,7 +511,14 @@ var FoxHoundDialectMongoDB = function(pFable)
|
|
|
516
511
|
switch (tmpSchemaEntry.Type)
|
|
517
512
|
{
|
|
518
513
|
case 'UpdateDate':
|
|
519
|
-
|
|
514
|
+
if (pParameters.query.disableAutoDateStamp)
|
|
515
|
+
{
|
|
516
|
+
tmpUpdateDoc[tmpColumn] = tmpRecords[0][tmpColumn];
|
|
517
|
+
}
|
|
518
|
+
else
|
|
519
|
+
{
|
|
520
|
+
tmpUpdateDoc[tmpColumn] = '$$NOW';
|
|
521
|
+
}
|
|
520
522
|
break;
|
|
521
523
|
case 'UpdateIDUser':
|
|
522
524
|
tmpUpdateDoc[tmpColumn] = pParameters.query.IDUser;
|
|
@@ -434,12 +434,6 @@ var FoxHoundDialectMySQL = function(pFable)
|
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
-
if (pParameters.query.disableAutoDateStamp &&
|
|
438
|
-
tmpSchemaEntry.Type === 'UpdateDate')
|
|
439
|
-
{
|
|
440
|
-
// This is ignored if flag is set
|
|
441
|
-
continue;
|
|
442
|
-
}
|
|
443
437
|
if (pParameters.query.disableAutoUserStamp &&
|
|
444
438
|
tmpSchemaEntry.Type === 'UpdateIDUser')
|
|
445
439
|
{
|
|
@@ -464,8 +458,17 @@ var FoxHoundDialectMySQL = function(pFable)
|
|
|
464
458
|
switch (tmpSchemaEntry.Type)
|
|
465
459
|
{
|
|
466
460
|
case 'UpdateDate':
|
|
467
|
-
|
|
468
|
-
|
|
461
|
+
if (pParameters.query.disableAutoDateStamp)
|
|
462
|
+
{
|
|
463
|
+
// Manual mode: use the record's value as-is
|
|
464
|
+
var tmpColumnParameter = tmpColumn+'_'+tmpCurrentColumn;
|
|
465
|
+
tmpUpdate += ' '+tmpColumn+' = :'+tmpColumnParameter;
|
|
466
|
+
pParameters.query.parameters[tmpColumnParameter] = tmpRecords[0][tmpColumn];
|
|
467
|
+
}
|
|
468
|
+
else
|
|
469
|
+
{
|
|
470
|
+
tmpUpdate += ' '+tmpColumn+' = ' + SQL_NOW;
|
|
471
|
+
}
|
|
469
472
|
break;
|
|
470
473
|
case 'UpdateIDUser':
|
|
471
474
|
// This is the user ID, which we hope is in the query.
|
|
@@ -398,11 +398,6 @@ var FoxHoundDialectPostgreSQL = function(pFable)
|
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
if (pParameters.query.disableAutoDateStamp &&
|
|
402
|
-
tmpSchemaEntry.Type === 'UpdateDate')
|
|
403
|
-
{
|
|
404
|
-
continue;
|
|
405
|
-
}
|
|
406
401
|
if (pParameters.query.disableAutoUserStamp &&
|
|
407
402
|
tmpSchemaEntry.Type === 'UpdateIDUser')
|
|
408
403
|
{
|
|
@@ -425,7 +420,16 @@ var FoxHoundDialectPostgreSQL = function(pFable)
|
|
|
425
420
|
switch (tmpSchemaEntry.Type)
|
|
426
421
|
{
|
|
427
422
|
case 'UpdateDate':
|
|
428
|
-
|
|
423
|
+
if (pParameters.query.disableAutoDateStamp)
|
|
424
|
+
{
|
|
425
|
+
var tmpColumnParameter = tmpColumn+'_'+tmpCurrentColumn;
|
|
426
|
+
tmpUpdate += ' '+generateSafeFieldName(tmpColumn)+' = :'+tmpColumnParameter;
|
|
427
|
+
pParameters.query.parameters[tmpColumnParameter] = tmpRecords[0][tmpColumn];
|
|
428
|
+
}
|
|
429
|
+
else
|
|
430
|
+
{
|
|
431
|
+
tmpUpdate += ' '+generateSafeFieldName(tmpColumn)+' = ' + SQL_NOW;
|
|
432
|
+
}
|
|
429
433
|
break;
|
|
430
434
|
case 'UpdateIDUser':
|
|
431
435
|
var tmpColumnParameter = tmpColumn+'_'+tmpCurrentColumn;
|
|
@@ -380,12 +380,6 @@ var FoxHoundDialectSQLite = function(pFable)
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
-
if (pParameters.query.disableAutoDateStamp &&
|
|
384
|
-
tmpSchemaEntry.Type === 'UpdateDate')
|
|
385
|
-
{
|
|
386
|
-
// This is ignored if flag is set
|
|
387
|
-
continue;
|
|
388
|
-
}
|
|
389
383
|
if (pParameters.query.disableAutoUserStamp &&
|
|
390
384
|
tmpSchemaEntry.Type === 'UpdateIDUser')
|
|
391
385
|
{
|
|
@@ -410,8 +404,17 @@ var FoxHoundDialectSQLite = function(pFable)
|
|
|
410
404
|
switch (tmpSchemaEntry.Type)
|
|
411
405
|
{
|
|
412
406
|
case 'UpdateDate':
|
|
413
|
-
|
|
414
|
-
|
|
407
|
+
if (pParameters.query.disableAutoDateStamp)
|
|
408
|
+
{
|
|
409
|
+
// Manual mode: use the record's value as-is
|
|
410
|
+
var tmpColumnParameter = tmpColumn+'_'+tmpCurrentColumn;
|
|
411
|
+
tmpUpdate += ' '+escapeColumn(tmpColumn, pParameters)+' = :'+tmpColumnParameter;
|
|
412
|
+
pParameters.query.parameters[tmpColumnParameter] = tmpRecords[0][tmpColumn];
|
|
413
|
+
}
|
|
414
|
+
else
|
|
415
|
+
{
|
|
416
|
+
tmpUpdate += ' '+escapeColumn(tmpColumn, pParameters)+' = NOW()';
|
|
417
|
+
}
|
|
415
418
|
break;
|
|
416
419
|
case 'UpdateIDUser':
|
|
417
420
|
// This is the user ID, which we hope is in the query.
|
|
@@ -461,11 +461,6 @@ var FoxHoundDialectSolr = function(pFable)
|
|
|
461
461
|
{
|
|
462
462
|
var tmpSchemaEntry = findSchemaEntry(tmpColumn, tmpSchema);
|
|
463
463
|
|
|
464
|
-
if (pParameters.query.disableAutoDateStamp &&
|
|
465
|
-
tmpSchemaEntry.Type === 'UpdateDate')
|
|
466
|
-
{
|
|
467
|
-
continue;
|
|
468
|
-
}
|
|
469
464
|
if (pParameters.query.disableAutoUserStamp &&
|
|
470
465
|
tmpSchemaEntry.Type === 'UpdateIDUser')
|
|
471
466
|
{
|
|
@@ -485,7 +480,14 @@ var FoxHoundDialectSolr = function(pFable)
|
|
|
485
480
|
switch (tmpSchemaEntry.Type)
|
|
486
481
|
{
|
|
487
482
|
case 'UpdateDate':
|
|
488
|
-
|
|
483
|
+
if (pParameters.query.disableAutoDateStamp)
|
|
484
|
+
{
|
|
485
|
+
tmpUpdateDoc[tmpColumn] = { 'set': tmpRecords[0][tmpColumn] };
|
|
486
|
+
}
|
|
487
|
+
else
|
|
488
|
+
{
|
|
489
|
+
tmpUpdateDoc[tmpColumn] = { 'set': '$$NOW' };
|
|
490
|
+
}
|
|
489
491
|
break;
|
|
490
492
|
case 'UpdateIDUser':
|
|
491
493
|
tmpUpdateDoc[tmpColumn] = { 'set': pParameters.query.IDUser };
|
|
@@ -792,8 +792,10 @@ suite
|
|
|
792
792
|
tmpQuery.buildUpdateQuery();
|
|
793
793
|
// This is the query generated by the ALASQL dialect
|
|
794
794
|
_Fable.log.trace('Update Query', tmpQuery.query);
|
|
795
|
+
// When disableAutoDateStamp is true, UpdateDate is included with the
|
|
796
|
+
// record's value instead of being auto-stamped with NOW()
|
|
795
797
|
Expect(tmpQuery.query.body)
|
|
796
|
-
.to.equal('UPDATE Animal SET `GUIDAnimal` = :GUIDAnimal_0, `Name` = :
|
|
798
|
+
.to.equal('UPDATE Animal SET `GUIDAnimal` = :GUIDAnimal_0, `UpdateDate` = :UpdateDate_1, `Name` = :Name_2, `Age` = :Age_3 WHERE `IDAnimal` = :IDAnimal_w0;');
|
|
797
799
|
}
|
|
798
800
|
);
|
|
799
801
|
test
|
|
@@ -752,8 +752,10 @@ suite
|
|
|
752
752
|
tmpQuery.buildUpdateQuery();
|
|
753
753
|
// This is the query generated by the MySQL dialect
|
|
754
754
|
_Fable.log.trace('Update Query', tmpQuery.query);
|
|
755
|
+
// When disableAutoDateStamp is true, UpdateDate is included with the
|
|
756
|
+
// record's value instead of being auto-stamped with NOW()
|
|
755
757
|
Expect(tmpQuery.query.body)
|
|
756
|
-
.to.equal('UPDATE `Animal` SET GUIDAnimal = :GUIDAnimal_0, Name = :
|
|
758
|
+
.to.equal('UPDATE `Animal` SET GUIDAnimal = :GUIDAnimal_0, UpdateDate = :UpdateDate_1, Name = :Name_2, Age = :Age_3 WHERE IDAnimal = :IDAnimal_w0;');
|
|
757
759
|
}
|
|
758
760
|
);
|
|
759
761
|
test
|
|
@@ -792,8 +792,10 @@ suite
|
|
|
792
792
|
tmpQuery.buildUpdateQuery();
|
|
793
793
|
// This is the query generated by the SQLite dialect
|
|
794
794
|
_Fable.log.trace('Update Query', tmpQuery.query);
|
|
795
|
+
// When disableAutoDateStamp is true, UpdateDate is included with the
|
|
796
|
+
// record's value instead of being auto-stamped with NOW()
|
|
795
797
|
Expect(tmpQuery.query.body)
|
|
796
|
-
.to.equal('UPDATE Animal SET `GUIDAnimal` = :GUIDAnimal_0, `Name` = :
|
|
798
|
+
.to.equal('UPDATE Animal SET `GUIDAnimal` = :GUIDAnimal_0, `UpdateDate` = :UpdateDate_1, `Name` = :Name_2, `Age` = :Age_3 WHERE `IDAnimal` = :IDAnimal_w0;');
|
|
797
799
|
}
|
|
798
800
|
);
|
|
799
801
|
test
|