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

CQL3 UUID type does not work #98

Closed
micahnz opened this issue Mar 27, 2013 · 3 comments
Closed

CQL3 UUID type does not work #98

micahnz opened this issue Mar 27, 2013 · 3 comments

Comments

@micahnz
Copy link

micahnz commented Mar 27, 2013

When using the "uuid" column type with CQL3 there is no way to provide a uuid using the arguments because anything provided including the UUID object is escaped.

@devdazed
Copy link
Contributor

can you provide an example, I'm not quite sure what you mean. Also, we are in the midst of re-writing the entire CQL portion of the driver, so this may soon be addressed.

@micahnz
Copy link
Author

micahnz commented Mar 27, 2013

conn.cql('INSERT INTO table (uuid) VALUES (?), [e988aea0-9682-11e2-9e96-0800200c9a66], ...)
//becomes INSERT INTO table (uuid) VALUES ('e988aea0-9682-11e2-9e96-0800200c9a66')
//instead of INSERT INTO table (uuid) VALUES (e988aea0-9682-11e2-9e96-0800200c9a66)

UUID's are escaped in escapeCQL() and Cassandra reports an error because it expects UUIDs to not be in single quotes. This also includes when using the helenus UUID object because objects call toString and then are escaped.

I added these to the escape function to get it working for the time being.

  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();
  }

@industral
Copy link

Confirm issue.

vmaliwal pushed a commit to vmaliwal/helenus that referenced this issue Jul 14, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants