Skip to content
This repository has been archived by the owner on Feb 22, 2019. It is now read-only.

Original code assumed that all string objects in the format of a UUID we... #122

Merged
merged 1 commit into from Oct 28, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 6 additions & 11 deletions lib/connection.js
Expand Up @@ -6,7 +6,8 @@ var util = require('util'),
Row = require('./row'),
zlib = require('zlib'),
Keyspace = require('./keyspace'),
errors = require('./errors');
errors = require('./errors'),
uuid = require('./uuid');

/**
* A No-Operation function for default callbacks
Expand Down Expand Up @@ -93,14 +94,13 @@ function escapeCQL(val) {
return 'NULL';
}

// https://github.com/simplereach/helenus/issues/98
if (typeof val === 'string' && val.match(/\w{8}\-\w{4}\-\w{4}\-\w{4}\-\w{12}/)) {
return val;
}

if(val instanceof Buffer){
return val.toString('hex');
}

if(val instanceof uuid.UUID){
return val.toString();
}

if(typeof val === 'number' || typeof val === 'boolean'){
return val.toString();
Expand All @@ -111,11 +111,6 @@ function escapeCQL(val) {
return sanitized.join(',');
}

// https://github.com/simplereach/helenus/issues/98
if (typeof val === 'string' && val.match(/\w{8}\-\w{4}\-\w{4}\-\w{4}\-\w{12}/)) {
return val;
}

if (typeof val === 'object' && typeof val.hex) {
return val.toString();
}
Expand Down