Permalink
Browse files

Merge pull request #122 from azweb76/master

Original code assumed that all string objects in the format of a UUID we...
  • Loading branch information...
2 parents a7f1cdd + 26994aa commit cbc07d9525300cdbf5a59370d7634c1fdbc4965f @devdazed devdazed committed Oct 28, 2013
Showing with 6 additions and 11 deletions.
  1. +6 −11 lib/connection.js
View
@@ -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
@@ -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();
@@ -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();
}

0 comments on commit cbc07d9

Please sign in to comment.