예제 #1
0
 /**
  * Saves this individual column path
  * @param string $keyID row key
  * @param sring $keySpace key space
  * @param string $columnFamily column family name
  * @param int $consistencyLevel cassandra save consistency level
  * @return bool save ok
  */
 public function save($keyID, $keySpace, $columnFamily, $consistencyLevel = NULL)
 {
     if (!$this->isModified()) {
         return TRUE;
     }
     // Build the column path for modifying this individual column
     $columnPath = new cassandra_ColumnPath();
     $columnPath->column_family = $columnFamily;
     $columnPath->column = $this->name;
     $ok = FALSE;
     if ($this->_delete) {
         $ok = PandraCore::deleteColumnPath($keySpace, $keyID, $columnPath, $this->bindTime(), PandraCore::getConsistency($consistencyLevel));
     } else {
         $ok = PandraCore::saveColumnPath($keySpace, $keyID, $columnPath, $this->callback === NULL ? $this->value : $this->callbackvalue(), $this->bindTime(), PandraCore::getConsistency($consistencyLevel));
     }
     if (!$ok) {
         if (empty(PandraCore::$errors)) {
             $errorStr = 'Unkown Error';
         } else {
             $errorStr = PandraCore::$errors;
         }
         $this->registerError($errorStr);
     }
     if ($ok) {
         $this->reset();
     }
     return $ok;
 }
예제 #2
0
 /**
  * Saves this individual column path, where a parent has been set (setParent()) keyid, keyspace, columnfamily or supercolumn
  * will be inherited for the save.
  * @return bool save ok
  */
 public function save($consistencyLevel = NULL)
 {
     if (!$this->isModified()) {
         $this->registerError("Column " . $this->name . " is not modified");
         return FALSE;
     }
     // Build the column path for modifying this individual column
     $columnPath = new cassandra_ColumnPath();
     $columnPath->column_family = $this->getColumnFamilyName();
     $columnPath->super_column = $this->getSuperColumnName();
     $columnPath->column = $this->getName();
     $ok = FALSE;
     if ($this->isDeleted()) {
         $ok = PandraCore::deleteColumnPath($this->getKeySpace(), $this->getKeyID(), $columnPath, $this->bindTime(), PandraCore::getConsistency($consistencyLevel));
     } else {
         $ok = PandraCore::saveColumnPath($this->getKeySpace(), $this->getKeyID(), $columnPath, $this->callbackvalue(), $this->bindTime(), PandraCore::getConsistency($consistencyLevel));
     }
     if (!$ok) {
         if (empty(PandraCore::$lastError)) {
             $errorStr = 'Unknown Error';
         } else {
             $errorStr = PandraCore::$lastError;
         }
         $this->registerError($errorStr);
     }
     if ($ok) {
         $this->reset();
     }
     return $ok;
 }