/** * {@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; }
/** * 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(); }
/** * 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(); } }
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}"); } }
public static function stmtExecute(SQLite3Stmt &$stmt) { SystemEvent::raise(SystemEvent::DEBUG, 'Executing.', __METHOD__); return $stmt->execute(); }