foxhound 2.0.25 → 2.0.27

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.
Files changed (37) hide show
  1. package/README.md +22 -22
  2. package/docs/README.md +24 -24
  3. package/docs/_cover.md +1 -1
  4. package/docs/_version.json +7 -0
  5. package/docs/api/behaviorFlags.md +1 -1
  6. package/docs/api/buildQuery.md +2 -2
  7. package/docs/api/clone.md +1 -1
  8. package/docs/api/setScope.md +1 -1
  9. package/docs/architecture.md +4 -4
  10. package/docs/css/docuserve.css +277 -23
  11. package/docs/dialects/README.md +4 -4
  12. package/docs/dialects/postgresql.md +1 -1
  13. package/docs/dialects/sqlite.md +5 -5
  14. package/docs/index.html +2 -2
  15. package/docs/joins.md +3 -3
  16. package/docs/query/README.md +4 -4
  17. package/docs/query/create.md +4 -4
  18. package/docs/query/update.md +10 -10
  19. package/docs/query-overrides.md +1 -1
  20. package/docs/quickstart.md +5 -5
  21. package/docs/retold-catalog.json +1 -1
  22. package/docs/retold-keyword-index.json +1 -1
  23. package/docs/schema.md +32 -32
  24. package/docs/sorting.md +4 -4
  25. package/package.json +3 -2
  26. package/source/dialects/ALASQL/FoxHound-Dialect-ALASQL.js +10 -8
  27. package/source/dialects/DGraph/FoxHound-Dialect-DGraph.js +8 -6
  28. package/source/dialects/MicrosoftSQL/FoxHound-Dialect-MSSQL.js +120 -0
  29. package/source/dialects/MongoDB/FoxHound-Dialect-MongoDB.js +8 -6
  30. package/source/dialects/MySQL/FoxHound-Dialect-MySQL.js +11 -8
  31. package/source/dialects/PostgreSQL/FoxHound-Dialect-PostgreSQL.js +10 -6
  32. package/source/dialects/SQLite/FoxHound-Dialect-SQLite.js +11 -8
  33. package/source/dialects/Solr/FoxHound-Dialect-Solr.js +8 -6
  34. package/test/FoxHound-Dialect-ALASQL_tests.js +3 -1
  35. package/test/FoxHound-Dialect-MySQL_tests.js +3 -1
  36. package/test/FoxHound-Dialect-SQLite_tests.js +3 -1
  37. package/test/Foxhound-Dialect-MSSQL_tests.js +59 -4
@@ -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` = :Name_1, `Age` = :Age_2 WHERE `IDAnimal` = :IDAnimal_w0;');
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
@@ -618,7 +618,7 @@ suite
618
618
  // This is the query generated by the MSSQL dialect
619
619
  _Fable.log.trace('Select Query', tmpQuery.query);
620
620
  Expect(tmpQuery.query.body)
621
- .to.equal('SELECT [Name], [Age], [Cost] FROM [Animal] WHERE [Deleted] = @Deleted_w0 OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY;');
621
+ .to.equal('SELECT [Name], [Age], [Cost] FROM [Animal] WHERE [Deleted] = @Deleted_w0 ORDER BY [IDAnimal] OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY;');
622
622
  }
623
623
  );
624
624
  test
@@ -640,7 +640,7 @@ suite
640
640
  // This is the query generated by the MSSQL dialect
641
641
  _Fable.log.trace('Select Query', tmpQuery.query);
642
642
  Expect(tmpQuery.query.body)
643
- .to.equal('SELECT DISTINCT [Name], [Age], [Cost] FROM [Animal] WHERE [Deleted] = @Deleted_w0 OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY;');
643
+ .to.equal('SELECT DISTINCT [Name], [Age], [Cost] FROM [Animal] WHERE [Deleted] = @Deleted_w0 ORDER BY [IDAnimal] OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY;');
644
644
  }
645
645
  );
646
646
  test
@@ -669,7 +669,7 @@ suite
669
669
  // This is the query generated by the MSSQL dialect
670
670
  _Fable.log.trace('Select Query', tmpQuery.query);
671
671
  Expect(tmpQuery.query.body)
672
- .to.equal('SELECT [Name], [Age], [Cost] FROM [Animal] WHERE [Age] = @Age_w0 AND ( [Color] = @Color_w2 OR [Color] = @Color_w3 ) AND [Description] IS NOT NULL AND [IDOffice] IN ( @IDOffice_w6 ) AND [Deleted] = @Deleted_w7 OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY;');
672
+ .to.equal('SELECT [Name], [Age], [Cost] FROM [Animal] WHERE [Age] = @Age_w0 AND ( [Color] = @Color_w2 OR [Color] = @Color_w3 ) AND [Description] IS NOT NULL AND [IDOffice] IN ( @IDOffice_w6 ) AND [Deleted] = @Deleted_w7 ORDER BY [IDAnimal] OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY;');
673
673
  }
674
674
  );
675
675
  test
@@ -691,7 +691,62 @@ suite
691
691
  // This is the query generated by the MSSQL dialect
692
692
  _Fable.log.trace('Select Query', tmpQuery.query);
693
693
  Expect(tmpQuery.query.body)
694
- .to.equal('SELECT [Name], [Age], [Cost] FROM [Animal] OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY;');
694
+ .to.equal('SELECT [Name], [Age], [Cost] FROM [Animal] ORDER BY [IDAnimal] OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY;');
695
+ }
696
+ );
697
+ test
698
+ (
699
+ 'Read Query with legacyPagination uses ROW_NUMBER() wrapper (caller sort)',
700
+ function()
701
+ {
702
+ var tmpQuery = libFoxHound.new(_Fable)
703
+ .setDialect('MSSQL')
704
+ .setScope('Animal')
705
+ .setDataElements(['Name', 'Age', 'Cost'])
706
+ .setCap(10)
707
+ .setBegin(20)
708
+ .setSort([{Column:'Age',Direction:'Ascending'}]);
709
+ tmpQuery.query.schema = _AnimalSchema;
710
+ tmpQuery.parameters.legacyPagination = true;
711
+ tmpQuery.buildReadQuery();
712
+ _Fable.log.trace('Legacy Select Query', tmpQuery.query);
713
+ Expect(tmpQuery.query.body)
714
+ .to.equal('SELECT [Name], [Age], [Cost] FROM (SELECT [Name], [Age], [Cost], ROW_NUMBER() OVER (ORDER BY [Age]) AS [_RowNum] FROM [Animal] WHERE [Deleted] = @Deleted_w0) AS [_Paged] WHERE [_RowNum] > 20 AND [_RowNum] <= 30;');
715
+ }
716
+ );
717
+ test
718
+ (
719
+ 'Read Query with legacyPagination injects PK ORDER BY when caller omits sort',
720
+ function()
721
+ {
722
+ var tmpQuery = libFoxHound.new(_Fable)
723
+ .setDialect('MSSQL')
724
+ .setScope('Animal')
725
+ .setDataElements(['Name', 'Age', 'Cost'])
726
+ .setCap(10);
727
+ tmpQuery.query.schema = _AnimalSchema;
728
+ tmpQuery.parameters.legacyPagination = true;
729
+ tmpQuery.buildReadQuery();
730
+ _Fable.log.trace('Legacy Select Query', tmpQuery.query);
731
+ Expect(tmpQuery.query.body)
732
+ .to.equal('SELECT [Name], [Age], [Cost] FROM (SELECT [Name], [Age], [Cost], ROW_NUMBER() OVER (ORDER BY [IDAnimal]) AS [_RowNum] FROM [Animal] WHERE [Deleted] = @Deleted_w0) AS [_Paged] WHERE [_RowNum] > 0 AND [_RowNum] <= 10;');
733
+ }
734
+ );
735
+ test
736
+ (
737
+ 'Read Query with legacyPagination is inert without cap',
738
+ function()
739
+ {
740
+ // No cap → no pagination at all (legacy or otherwise);
741
+ // the flag should be a no-op and not produce a ROW_NUMBER wrapper.
742
+ var tmpQuery = libFoxHound.new(_Fable)
743
+ .setDialect('MSSQL')
744
+ .setScope('Animal');
745
+ tmpQuery.addSort({Column:'Cost',Direction:'Descending'});
746
+ tmpQuery.parameters.legacyPagination = true;
747
+ tmpQuery.buildReadQuery();
748
+ Expect(tmpQuery.query.body)
749
+ .to.equal('SELECT [Animal].* FROM [Animal] ORDER BY [Cost] DESC;');
695
750
  }
696
751
  );
697
752
  test