simplereach/helenus — pull request #56 by dokipen (2012-06-17 01:22:57+00:00)
Title: Named params

Spent a few hours on this. My first problem was I'm using cql2, so when I tried some code on cql3 I realized that single-quoting identifiers (column names, column family names, etc.) is no longer valid(bummer). They should be double-quoted or not quoted at all. Since I require this behavior in my client code, I had to add a way to use double-quotes in parameters.

So I added the '#' positional parameter to the existing set, which will be double quoted.

For named parameters, you can use ':' for double-quoted values and '::' for single-quoted. Everything is backward compatible. The downside of this is that Connection.prototype.cql has to assume that if only one Object argument is passed, it is an options argument. This means that you can't use named parameters without also passing an options argument. Possible ways around this are (1) make a new function, (2) break backward compatibility, (3) accept named parameters in cql() using a single parameter object (optionally), or (4) analyze the cmd to see if it expects named parameters, doing something intelligent.

I didn't realize I'd need the double-quote functionality until after I had already written the named parameter code, so it's all in one commit. I can break it up upon request.