foxhound 2.0.6 → 2.0.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxhound",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "A Database Query generation library.",
5
5
  "main": "source/FoxHound.js",
6
6
  "scripts": {
@@ -704,7 +704,7 @@ var FoxHoundDialectMSSQL = function(pFable)
704
704
  }
705
705
  }
706
706
 
707
- if (tmpCurrentColumn > 0)
707
+ if ((tmpCurrentColumn > 0) && (tmpCreateSet != ''))
708
708
  {
709
709
  tmpCreateSet += ',';
710
710
  }
@@ -730,7 +730,8 @@ var FoxHoundDialectMSSQL = function(pFable)
730
730
  else
731
731
  {
732
732
  // This is an autoidentity, so we don't parameterize it and just pass in NULL
733
- tmpCreateSet += ' NULL';
733
+ //tmpCreateSet += ' NULL';
734
+ // For MSSQL we have to skip this. NULL and DEFAULT both error for autoidentities.
734
735
  }
735
736
  break;
736
737
  case 'AutoGUID':
@@ -846,6 +847,17 @@ var FoxHoundDialectMSSQL = function(pFable)
846
847
  }
847
848
  switch (tmpSchemaEntry.Type)
848
849
  {
850
+ // We skip these for MSSQL on INSERT or they cause an error for some versions (different errors for different versions)
851
+ case 'AutoIdentity':
852
+ if (pParameters.query.disableAutoIdentity)
853
+ {
854
+ if (tmpCreateSet != '')
855
+ {
856
+ tmpCreateSet += ',';
857
+ }
858
+ tmpCreateSet += ' '+tmpColumn;
859
+ }
860
+ continue;
849
861
  default:
850
862
  if (tmpCreateSet != '')
851
863
  {
@@ -493,7 +493,7 @@ suite
493
493
  // This is the query generated by the MSSQL dialect
494
494
  _Fable.log.trace('Create Query', tmpQuery.query);
495
495
  Expect(tmpQuery.query.body)
496
- .to.equal("INSERT INTO Animal ( IDAnimal, GUIDAnimal, CreateDate, CreatingIDUser, UpdateDate, UpdatingIDUser, Deleted, Name, Age) VALUES ( NULL, @GUIDAnimal_1, GETUTCDATE(), @CreatingIDUser_3, GETUTCDATE(), @UpdatingIDUser_5, @Deleted_6, @Name_7, @Age_8);");
496
+ .to.equal("INSERT INTO Animal ( GUIDAnimal, CreateDate, CreatingIDUser, UpdateDate, UpdatingIDUser, Deleted, Name, Age) VALUES ( @GUIDAnimal_1, GETUTCDATE(), @CreatingIDUser_3, GETUTCDATE(), @UpdatingIDUser_5, @Deleted_6, @Name_7, @Age_8);");
497
497
  }
498
498
  );
499
499
  test
@@ -525,7 +525,7 @@ suite
525
525
  // This is the query generated by the MSSQL dialect
526
526
  _Fable.log.trace('Create Query', tmpQuery.query);
527
527
  Expect(tmpQuery.query.body)
528
- .to.equal("INSERT INTO Animal ( IDAnimal, GUIDAnimal, CreateDate, CreatingIDUser, UpdateDate, UpdatingIDUser, Deleted, Name, Age) VALUES ( NULL, @GUIDAnimal_1, GETUTCDATE(), @CreatingIDUser_3, GETUTCDATE(), @UpdatingIDUser_5, @Deleted_6, @Name_7, @Age_8);");
528
+ .to.equal("INSERT INTO Animal ( GUIDAnimal, CreateDate, CreatingIDUser, UpdateDate, UpdatingIDUser, Deleted, Name, Age) VALUES ( @GUIDAnimal_1, GETUTCDATE(), @CreatingIDUser_3, GETUTCDATE(), @UpdatingIDUser_5, @Deleted_6, @Name_7, @Age_8);");
529
529
  }
530
530
  );
531
531
  test