Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix for serialization of undefined values, fixing sql db create using…

… username/password
  • Loading branch information...
commit 58ffca3ebb13423b4ed3c5e345a64382b3445e63 1 parent 61cac7a
@christav christav authored
View
2  lib/services/sqlAzure/models/databaseresult.js
@@ -22,7 +22,7 @@ exports.serialize = function (databaseName, collation, edition, maxSizeInGB) {
var databaseDescription = { };
databaseDescription['CollationName'] = { '$': { 'type': 'Edm.String' }, '_': collation };
- databaseDescription['CreationDate'] = { '$': { 'm:type': 'Edm.DateTime' }, '_': '0001-01-01T00:00:00' };
+ databaseDescription['CreationDate'] = { '$': { 'type': 'Edm.DateTime' }, '_': '0001-01-01T00:00:00' };
databaseDescription['Edition'] = { '$': { 'type': 'Edm.String' }, '_': edition };
databaseDescription['Id'] = { '$': { 'type': 'Edm.Int32' }, '_': 0 };
databaseDescription['IsFederationRoot'] = { '$': { 'type': 'Edm.Boolean' }, '_': null };
View
9 lib/util/odatahandler.js
@@ -153,7 +153,7 @@ OdataHandler.prototype._setProperty = function (entity, propertyName, value, typ
OdataHandler.prototype.serialize = function (entity, skipType) {
var properties = {};
- for (var name in entity) {
+ Object.keys(entity).forEach(function (name) {
if (name !== '_') {
properties[OdataHandler.NSDATA + ':' + name] = { };
properties[OdataHandler.NSDATA + ':' + name][Constants.XML_METADATA_MARKER] = {};
@@ -162,12 +162,13 @@ OdataHandler.prototype.serialize = function (entity, skipType) {
var propertyValue = null;
if (entity[name] &&
- entity[name][Constants.XML_VALUE_MARKER] !== undefined &&
entity[name][Constants.XML_METADATA_MARKER] !== undefined &&
entity[name][Constants.XML_METADATA_MARKER].type !== undefined) {
- propertyValue = edmType.serializeValue(entity[name][Constants.XML_METADATA_MARKER].type, entity[name][Constants.XML_VALUE_MARKER]);
propertyType = entity[name][Constants.XML_METADATA_MARKER].type;
+ if (entity[name][Constants.XML_VALUE_MARKER] !== undefined) {
+ propertyValue = edmType.serializeValue(propertyType, entity[name][Constants.XML_VALUE_MARKER]);
+ }
}
else {
if (entity[name] !== undefined && entity[name] !== null) {
@@ -187,7 +188,7 @@ OdataHandler.prototype.serialize = function (entity, skipType) {
properties[OdataHandler.NSDATA + ':' + name][Constants.XML_METADATA_MARKER][OdataHandler.NSMETA + ':null'] = true;
}
}
- }
+ });
return atomHandler.serializeEntry({ 'm:properties': properties }, [
{
Please sign in to comment.
Something went wrong with that request. Please try again.