Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

The WITH CONSISTENCY removed. How to set it now? #13

Closed
ghost opened this issue Apr 27, 2013 · 8 comments
Closed

The WITH CONSISTENCY removed. How to set it now? #13

ghost opened this issue Apr 27, 2013 · 8 comments

Comments

@ghost
Copy link

ghost commented Apr 27, 2013

"The WITH CONSISTENCY clause has been removed from CQL 3 commands in the release version of CQL 3. Programmatically, set the consistency level at the driver level. For example, call execute_cql3_query with the required binary query, the compression settings, and consistency level." source

How do I set now consistency?

@sandrolex
Copy link
Contributor

Hi,
you have to use the
$db->setAttribute(PDO::CASSANDRA_ATTR_CONSISTENCYLEVEL, $consistencyLevel);

Possible values are:

PDO::CASSANDRA_CONSISTENCYLEVEL_ONE
PDO::CASSANDRA_CONSISTENCYLEVEL_QUORUM
PDO::CASSANDRA_CONSISTENCYLEVEL_LOCAL_QUORUM
PDO::CASSANDRA_CONSISTENCYLEVEL_ALL
PDO::CASSANDRA_CONSISTENCYLEVEL_ANY
PDO::CASSANDRA_CONSISTENCYLEVEL_EACH_QUORUM
PDO::CASSANDRA_CONSISTENCYLEVEL_TWO
PDO::CASSANDRA_CONSISTENCYLEVEL_THREE

I thought I had put that put that on the README.md. Maybe I forgot to
commit, or it wasnt merged..

On Sat, Apr 27, 2013 at 7:39 PM, moldcraft notifications@github.com wrote:

"The WITH CONSISTENCY clause has been removed from CQL 3 commands in the
release version of CQL 3. Programmatically, set the consistency level at
the driver level. For example, call execute_cql3_query with the required
binary query, the compression settings, and consistency level." sourcehttp://www.datastax.com/docs/1.2/dml/data_consistency

How do I set now consistency?


Reply to this email directly or view it on GitHubhttps://github.com//issues/13
.

@ghost
Copy link
Author

ghost commented Apr 27, 2013

Thank You

@ghost ghost closed this as completed Apr 27, 2013
@ghost
Copy link
Author

ghost commented Apr 27, 2013

If set attribute like this

$db = new PDO(
  'cassandra:host=192.168.1.100;port=9160',
  null,
  null,
  array(
    PDO::ATTR_PERSISTENT => true,
    PDO::CASSANDRA_ATTR_CONSISTENCYLEVEL => PDO::CASSANDRA_CONSISTENCYLEVEL_QUORUM
  )
);

instead of this

$db->setAttribute(PDO::CASSANDRA_ATTR_CONSISTENCYLEVEL, PDO::CASSANDRA_CONSISTENCYLEVEL_QUORUM);

Is that correct?
It not showing any errors but I don't know if it works for sure (maybe it has no effect and not changing consistency)

@ghost ghost reopened this Apr 27, 2013
@sandrolex
Copy link
Contributor

yes, it should work as well.

On Sat, Apr 27, 2013 at 11:24 PM, moldcraft notifications@github.comwrote:

$db = new PDO(
'cassandra:host=192.168.1.100;port=9160',
null,
null,
array(
PDO::ATTR_PERSISTENT => true,
PDO::CASSANDRA_ATTR_CONSISTENCYLEVEL, PDO::CASSANDRA_CONSISTENCYLEVEL_QUORUM
));

Is that correct?
It works, just ask to be sure.


Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-17123577
.

@ghost ghost closed this as completed Apr 28, 2013
@RuslanZavacky
Copy link

Hey,

is there a way, after setting consistency via setAttribute, to check, what consistency level was sent to Cassandra?

@sandro-lex
Copy link
Contributor

Have you tried this?
$val = $db->getAttribute(PDO::CASSANDRA_ATTR_CONSISTENCYLEVEL);

@RuslanZavacky
Copy link

@sandro-lex yeap, getAttribute is not supported "SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute".

But I want to check it more on Cassandra level, I've triet to do it via logs with DEBUG level, but consistency level never show up there.

@sandro-lex
Copy link
Contributor

I had a glance at the code and it seems that it is not implemented.

But You can implement it if you feel like.
Have a look in the cassandra_driver.cpp file, there is a function called pdo_cassandra_handle_get_attribute(), then all you have to do is implement a case statement that returns the H->consistency value.

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

No branches or pull requests

3 participants