racker/node-cassandra-client — pull request #22 by dfoody (2012-02-22 21:56:31+00:00)
Title: Improved support (in both directions) for numbers, dates, and booleans

This commit makes two primary changes:
* Properly handle CQL binding for data types other than string and Buffer
* Support better precision decoding for numbers when not using BigInteger

For the first of these, with a CQL statement like `update a set b=? where key='c'`, parameters were always quoted. So, for numeric columns, passing 12 for the parameter would result in the invalid CQL `update a set b='12' where key='c'`. These changes detect the data type and, if it is boolean, number, or date, properly bind it without quotes.

In the decoder, when not using BigInteger, the decoding was limited to 32 bit numbers. However, javascript can represent integral numbers with 52 bits of precision (big enough to handle timestamps through the year 10k with no loss of precision). This commit updates the bytesToNum logic so that it can properly support numbers with no loss up to 52 bits of precision. Above 52 bits the number still works but gets approximated. As a result of making 52-bit numbers work without loss, this also allowed the decoding of Date data types to be streamlined. Boolean data types are now also properly decoded.