예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function execute($params = null)
 {
     if (null !== $params) {
         foreach ($params as $param => $value) {
             $this->bindValue($param, $value);
         }
     }
     $this->_result = $this->_stmt->execute();
     if (!$this->_result) {
         throw new Exception($this->errorInfo(), $this->errorCode());
     }
     return true;
 }
예제 #2
0
 /**
  * Execute the prepared SQL query.
  *
  * @throws \Pop\Db\Adapter\Exception
  * @return void
  */
 public function execute()
 {
     if (null === $this->statement) {
         throw new Exception('Error: The database statement resource is not currently set.');
     }
     $this->result = $this->statement->execute();
 }
예제 #3
0
파일: SQLite3.php 프로젝트: Troutzorz/csapp
 /**
  * Move a cell object from one address to another
  *
  * @param	string		$fromAddress	Current address of the cell to move
  * @param	string		$toAddress		Destination address of the cell to move
  * @return	boolean
  */
 public function moveCell($fromAddress, $toAddress)
 {
     if ($fromAddress === $this->_currentObjectID) {
         $this->_currentObjectID = $toAddress;
     }
     $this->_deleteQuery->bindValue('id', $toAddress, SQLITE3_TEXT);
     $result = $this->_deleteQuery->execute();
     if ($result === false) {
         throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
     }
     $this->_updateQuery->bindValue('toid', $toAddress, SQLITE3_TEXT);
     $this->_updateQuery->bindValue('fromid', $fromAddress, SQLITE3_TEXT);
     $result = $this->_updateQuery->execute();
     if ($result === false) {
         throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
     }
     return TRUE;
 }
 /**
  * @param int      $id
  * @param array    $data
  * @param callable $callback
  *
  * @throws \Exception
  */
 public function import(&$id, array $data, callable $callback)
 {
     foreach ($data as $uid => $elem) {
         $valuesFullText = $this->valuesFullText($elem);
         $valuesFilter = $this->valuesFilter($elem);
         if (sizeof($valuesFullText) > 0) {
             $json = json_encode($elem);
             $num = 1;
             $this->stmtInsertFilter->bindValue($num++, $id, SQLITE3_INTEGER);
             if ($this->useuid) {
                 $this->stmtInsertFilter->bindValue($num++, $uid, SQLITE3_TEXT);
             }
             $this->stmtInsertFilter->bindValue($num++, $json, SQLITE3_TEXT);
             foreach ($valuesFilter as $valueFilter) {
                 $this->stmtInsertFilter->bindValue($num++, $valueFilter);
             }
             if (@$this->stmtInsertFilter->execute() === false) {
                 $lasterror = $this->db->lastErrorCode();
                 if ($lasterror != self::SQLITE_ERROR_CODE_CONSTRAINT) {
                     $this->output->writeln($lasterror . " : " . $this->db->lastErrorMsg());
                     throw new \Exception("cannot insert filter fields");
                 } else {
                     @$this->stmtInsertFilter->reset();
                     continue;
                 }
             }
             $num = 1;
             $this->stmtInsertFullText->bindValue($num++, $id, SQLITE3_INTEGER);
             foreach ($valuesFullText as $valueFullText) {
                 $this->stmtInsertFullText->bindValue($num++, $valueFullText, SQLITE3_TEXT);
             }
             if ($this->stmtInsertFullText->execute() === false) {
                 $this->output->writeln($this->db->lastErrorCode() . " : " . $this->db->lastErrorMsg());
                 throw new \Exception("cannot insert full text fields");
             }
             $id++;
         }
         $callback();
     }
 }
예제 #5
0
 public function remoteHasDone($task)
 {
     switch ($task->action) {
         case self::CMD_PUT:
             $this->_prepRemoteHasUploaded->bindValue(":path", $task->path);
             $this->_prepRemoteHasUploaded->execute();
             break;
         case self::CMD_DELETE:
             $this->_prepRemoteHasDeleted->bindValue(":path", $task->path);
             $this->_prepRemoteHasDeleted->execute();
             break;
         case self::CMD_MKDIR:
             $this->_prepRemoteHasUploaded->bindValue(":path", $task->path);
             $this->_prepRemoteHasUploaded->execute();
             break;
         case self::CMD_TS:
             $this->_prepRemoteHasUploaded->bindValue(":path", $task->path);
             $this->_prepRemoteHasUploaded->execute();
             break;
         default:
             $this->_out->logError("ignored command {$task->action}");
     }
 }
 /**
  * Binds fulltext parameters to a prepared statement as this happens in multiple places.
  *
  * @param \SQLite3Stmt $preparedStatement
  * @param $fulltext
  */
 protected function bindFulltextParametersToStatement(\SQLite3Stmt $preparedStatement, $fulltext)
 {
     $preparedStatement->bindValue(':h1', isset($fulltext['h1']) ? $fulltext['h1'] : '');
     $preparedStatement->bindValue(':h2', isset($fulltext['h2']) ? $fulltext['h2'] : '');
     $preparedStatement->bindValue(':h3', isset($fulltext['h3']) ? $fulltext['h3'] : '');
     $preparedStatement->bindValue(':h4', isset($fulltext['h4']) ? $fulltext['h4'] : '');
     $preparedStatement->bindValue(':h5', isset($fulltext['h5']) ? $fulltext['h5'] : '');
     $preparedStatement->bindValue(':h6', isset($fulltext['h6']) ? $fulltext['h6'] : '');
     $preparedStatement->bindValue(':text', isset($fulltext['text']) ? $fulltext['text'] : '');
 }
예제 #7
0
 public static function stmtExecute(SQLite3Stmt &$stmt)
 {
     SystemEvent::raise(SystemEvent::DEBUG, 'Executing.', __METHOD__);
     return $stmt->execute();
 }