There are 3 types of batch statements: * Cassandra::BATCH_LOGGED - this is the default batch type. This batch guarantees that either all or none of its statements will be executed. This behavior is achieved by writing a batch log on the coordinator, which slows down the execution somewhat. * Cassandra::BATCH_UNLOGGED - this batch will not be verified when executed, which makes it faster than a LOGGED batch, but means that some of its statements might fail, while others - succeed. * Cassandra::BATCH_COUNTER - this batch is used for counter updates, which are, unlike other writes, not idempotent.
См. также: Cassandra::BATCH_LOGGED
См. также: Cassandra::BATCH_UNLOGGED
См. также: Cassandra::BATCH_COUNTER
Наследование: implements cassandra\Statement
Пример #1
0
 /**
  * Sends SQL statements to the database server returning the success state.
  * Use this method only when the SQL statement sent to the server doesn't return any rows
  * @param   string $cqlStatement - CQL statement
  * @param   array $bindParams - bind parameters, default null
  * @param   array $bindTypes - bind types, default null
  * @return  bool
  * @throws  \PhalconCassandra\Db\Exception\Cassandra
  */
 public function execute($cqlStatement, $bindParams = null, $bindTypes = null)
 {
     $statement = $this->_prepareStatement($cqlStatement, $bindParams, $bindTypes);
     if ($this->_transactionLevel) {
         $this->_batch->add($statement, $bindParams);
     } else {
         $params = ['consistency' => $this->getConsistency()];
         if ($bindParams) {
             $params['arguments'] = $bindParams;
         }
         try {
             $this->_session->execute($statement, new ExecutionOptions($params));
         } catch (BaseException $e) {
             throw new CException($e->getMessage(), $e->getCode());
         }
     }
     $this->_affectedRows = 1;
     if ($this->_eventsManager instanceof ManagerInterface) {
         $this->_eventsManager->fire('db:afterQuery', $this, $bindParams);
     }
     $this->_consistency = null;
     return true;
 }