コード例 #1
0
ファイル: SuperColumn.class.php プロジェクト: ukd1/Pandra
 /**
  * Save all columns in this loaded columnfamily
  * @return void
  */
 public function save($consistencyLevel = NULL)
 {
     if (!$this->isModified()) {
         return FALSE;
     }
     $this->_parentCF->checkCFState();
     $ok = FALSE;
     if ($this->getDelete()) {
         if ($columnPath === NULL) {
             $columnPath = new cassandra_ColumnPath();
             $columnPath->column_family = $this->_parentCF->getName();
             $columnPath->super_column = $this->getName();
             $ok = PandraCore::delete($this->keySpace, $this->keyID, $columnPath, time(), PandraCore::getConsistency($consistencyLevel));
             if (!$ok) {
                 $this->registerError(PandraCore::$lastError);
             }
             return $ok;
         }
     } else {
         $this->bindTimeModifiedColumns();
         $ok = PandraCore::saveSuperColumn($this->_parentCF->getKeySpace(), $this->_parentCF->keyID, $this->_parentCF->getName(), $this->getName(), $this->getModifiedColumns(), PandraCore::getConsistency($consistencyLevel));
         if (!$ok) {
             $this->registerError(PandraCore::$lastError);
         }
         if ($ok) {
             $this->reset();
         }
         return $ok;
     }
     return FALSE;
 }
コード例 #2
0
ファイル: SuperColumn.class.php プロジェクト: ruflin/Pandra
 /**
  * Save all columns in this loaded columnfamily
  * @return void
  */
 public function save($consistencyLevel = NULL)
 {
     if (!$this->isModified()) {
         return FALSE;
     }
     $ok = $this->pathOK();
     if ($ok) {
         if ($this->getDelete()) {
             $columnPath = new cassandra_ColumnPath();
             $columnPath->column_family = $this->getColumnFamilyName();
             $columnPath->super_column = $this->getName();
             $ok = PandraCore::deleteColumnPath($this->getKeySpace(), $this->getKeyID(), $columnPath, NULL, PandraCore::getConsistency($consistencyLevel));
         } else {
             $this->bindTimeModifiedColumns();
             $ok = PandraCore::saveSuperColumn($this->getKeySpace(), $this->getKeyID(), array($this->getColumnFamilyName()), array($this->getName() => $this->getModifiedColumns()), PandraCore::getConsistency($consistencyLevel));
         }
         if ($ok) {
             $this->reset();
         } else {
             $this->registerError(PandraCore::$lastError);
         }
     }
     return $ok;
 }