Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Impossible to save a column with an empty value #21

Closed
JordanP opened this Issue · 2 comments

2 participants

@JordanP

Code Sample :
// Create column without validator
$c = new PandraColumn('aNonExistentCol', 'isempty');
$c->setValue('');
$c->setParent(new PandraColumnFamily('myKeyID', 'Keyspace1', 'Standard1'));
var_dump($c->isModified());
$c->save();

This displays bool(false) whereas is should displays bool(true). As a consequence, the column is not saved.

IMHO the problem is in Column.class.php line 153 (method setValue()) :
if ($this->value == $value) return TRUE;
It should be
if ($this->value === $value) return TRUE;
Because, as I am sure you know, in PHP NULL == '' and cassandra_Column initiate the property 'value' with NULL

@mjpearson
Owner

Hi, thanks

This may be a Thrift issue, I haven't been able to write empty columns using it during testing so figured it wasn't supported. However, testing an empty 'set' in the CLI says this is not the case...

As for using the identity vs equality operator to check if a value has been changed, Cassandra stores column values as StringLiterals, so there isn't a need to make a type distinction. The empty value issue changes this though, so will look further @ Thrift

@mjpearson
Owner

resolved and committed, (empty value issue due to bad test case ;) )

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.