fix PDO::quote #5

Merged
merged 2 commits into from Dec 30, 2011

Projects

None yet

2 participants

@Gasol
Contributor
Gasol commented Dec 29, 2011
<?php

$pdo = new PDO(/*cassandra dsn*/);
$stmt = $pdo->prepare('INSERT INTO FooCF (KEY, column) VALUES(:key, :column)');
$stmt->bindValue('key', 'quote_test');
$stmt->bindValue('column', "single quote-> ' <- single quote");
$stmt->execute(); // throw exception

It's broken that binding value in prepare statement so far.
because PDO::quote had wrong way to escape single quote.

A <stringLiteral> is encased in 'single quotes'. A single quote itself can be represented in a string literal by doubling it, as in SQL: 'Single quote -> '' <-'.

says in CQL.textile

There are some discussion in other client.

  1. kreynolds/cassandra-cql#20
  2. http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/CQL-How-to-escape-single-quotes-td6647132.html
@mkoppanen mkoppanen merged commit 7debd5b into mkoppanen:master Dec 30, 2011
@mkoppanen
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment