Permalink
Browse files

Original code assumed that all string objects in the format of a UUID…

… were associated with a UUID data type. Replaced with UUID object check.
  • Loading branch information...
1 parent b05fe24 commit 26994aa0017c26f877c64a0c70f895a1e13e6649 @azweb76 azweb76 committed Oct 14, 2013
Showing with 6 additions and 11 deletions.
  1. +6 −11 lib/connection.js
View
17 lib/connection.js
@@ -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 26994aa

Please sign in to comment.