Cassandra\BatchStatement::add PHP Метод

add() публичный Метод

Adds a statement to this batch.
public add ( cassandra\Statement $statement, array $arguments = null ) : BatchStatement
$statement cassandra\Statement the statement to add
$arguments array positional or named arguments
Результат BatchStatement self
    public function add(Statement $statement, array $arguments = null)
    {
    }

Usage Example

Пример #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;
 }
BatchStatement