Skip to content
This repository was archived by the owner on Dec 3, 2017. It is now read-only.

Sanitize CQL Statements #1

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

christophersansone
Copy link

Thanks for starting this project! I have tried them all, and cql-rb and cql_model is the winning combination when starting new projects on Cassandra 1.2.

This pull request fixes a handful of issues, most notably ensuring the attribute values are being properly sanitized and escaped on the way into Cassandra. This allows UUID types (and presumably all other standard types) to now save properly. It adds a new Cql::Statement class which is a port of CassandraCQL::Statement to parameterize the CQL statements.

@christophersansone
Copy link
Author

The specs now pass. One change was required to the specs, which means that there is potential for this change to break existing code.

This PR now forces more strict typing of the attributes when saving. For instance, if an :id property is defined as an int in Cassandra, then Model.find(1) will work and Model.find('1') will fail. This seems acceptable to ensure that all standard data types work properly.

If we want to allow more flexibility, then I think Ruby will need to know the type of each column and cast it accordingly. Cequel::Model forces you to specify the type when defining the column, e.g. column :first_name, :text.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant