Skip to content

Commit

Permalink
Fixes the issue introduced by [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarcelino committed Feb 23, 2015
1 parent 3beb54f commit 5fb15bb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ci/initialize-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ echo "--- Starting an instance of OrientDB ---"
sh -c $ODB_LAUNCHER </dev/null &>/dev/null &

# Wait a bit for OrientDB to finish the initialization phase.
sleep 7
sleep 15
printf "\n=== The CI environment has been initialized ===\n"
4 changes: 2 additions & 2 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ module.exports = (function () {
self = this;

collectionInstance = self.collections[collection];
attributes = collectionInstance.attributes;
attributes = collectionInstance.definition;

_document = new Document(options, attributes, self, 'insert');

Expand Down Expand Up @@ -557,7 +557,7 @@ module.exports = (function () {
// Catch errors from building query and return to the callback
try {
_query = new Query(options, schema, self.config);
_document = new Document(values, attributes, self);
_document = new Document(values, collectionInstance.definition, self);
where = _query.getWhereQuery(collection);
} catch(e) {
log.error('Failed to compose update SQL query.', e);
Expand Down
10 changes: 8 additions & 2 deletions lib/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Document.prototype.serializeValues = function serializeValues(values) {
return;
}
}

var type = self.schema[schemaKey].type;

var foreignKey = self.schema[schemaKey].foreignKey || false;
Expand Down Expand Up @@ -156,9 +156,15 @@ Document.prototype.serializeValues = function serializeValues(values) {
values[key] = null;
}

else if(type === 'json'){
if(!values[key]['@type']){
values[key]['@type'] = 'd';
}
}

// TODO: should just be "type === 'binary'" but for some reason type never seems to
// be equal to 'binary'. Waterline issue?
if ((type === 'binary' || !type) && Buffer.isBuffer(values[key])) {
else if ((type === 'binary' || !type) && Buffer.isBuffer(values[key])) {
values[key] = values[key].toString('base64');
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/integration-orientdb/bugs/47-schema_with_id.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var assert = require('assert'),

var self = this;

describe.only('Bug #47: Schema with id (blueprints like)', function() {
describe('Bug #47: Schema with id (blueprints like)', function() {
before(function (done) {

var fixtures = {
Expand Down

1 comment on commit 5fb15bb

@dmarcelino
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, meant [email protected]

Please sign in to comment.