Allow arrays as parameter for multiget operations. #68

Closed
simong opened this Issue Sep 11, 2012 · 1 comment

Projects

None yet

2 participants

@simong

Hi,

Would it be feasable to allow arrays as parameters?
This would allow for multi-get operations such as:

pool.cql('SELECT ?,? FROM Users WHERE user_id IN (?)', ['name', 'address', ['simong', 'johndoe'] ], function(err, results){
    results.forEach(function(row) {
         console.log(row.get('name').value + ' lives on ' + row.get('address').name);
    });
});

The change is trivial of course but the impact might not be as some people are perhaps relying on this behaviour?
One line 111 in connection.js replace the quote encapsulation by

return sanitized.join(',');
@devdazed
SimpleReach member

hmm, interesting. This is the intended functionality. It seems as though it is adding too may quotes, so you get CQL like:

SELECT 'name','address' FROM Users WHERE user_id IN (''simong'',''johndoe'')

While your suggestion will fix it, I will have to look to see if it will break the API before making this change.

@devdazed devdazed closed this in 682723a Sep 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment