public static function deleteById(ezcDbHandler $db, $id, $prefix = '') { //$db->beginTransaction(); $q = $db->createDeleteQuery(); $q->deleteFrom($db->quoteIdentifier($prefix . 'pipe_execution'))->where($q->expr->eq($db->quoteIdentifier('id'), $q->bindValue((int) $id))); $stmt = $q->prepare(); $stmt->execute(); $q = $db->createDeleteQuery(); $q->deleteFrom($db->quoteIdentifier($prefix . 'pipe_execution_state'))->where($q->expr->eq($db->quoteIdentifier('execution_id'), $q->bindValue((int) $id))); $stmt = $q->prepare(); $stmt->execute(); //$db->commit(); }
/** * Deletes all rows with given $action and optionally $id. * * If $id is set only autogenerated entries will be removed. * * @param mixed $action * @param mixed|null $id * * @return boolean */ public function remove($action, $id = null) { /** @var $query \ezcQueryDelete */ $query = $this->dbHandler->createDeleteQuery(); $query->deleteFrom($this->dbHandler->quoteTable('ezurlalias_ml'))->where($query->expr->eq($this->dbHandler->quoteColumn("action"), $query->bindValue($action, null, \PDO::PARAM_STR))); if ($id !== null) { $query->where($query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn("is_alias"), $query->bindValue(0, null, \PDO::PARAM_INT)), $query->expr->eq($this->dbHandler->quoteColumn("id"), $query->bindValue($id, null, \PDO::PARAM_INT)))); } $query->prepare()->execute(); }
/** * Cleanup execution / execution_state tables. * * @param string $tableName * @throws ezcDbException */ protected function cleanupTable($tableName) { $query = $this->db->createDeleteQuery(); $query->deleteFrom($this->db->quoteIdentifier($this->options['prefix'] . $tableName)); $id = $query->expr->eq($this->db->quoteIdentifier('execution_id'), $query->bindValue((int) $this->id)); if ($tableName == 'execution') { $parent = $query->expr->eq($this->db->quoteIdentifier('execution_parent'), $query->bindValue((int) $this->id)); $query->where($query->expr->lOr($id, $parent)); } else { $query->where($id); } $statement = $query->prepare(); $statement->execute(); }
/** * Deletes all group assignments for a Type. * * @param mixed $typeId * @param int $status * * @return void */ public function deleteGroupAssignmentsForType($typeId, $status) { $q = $this->dbHandler->createDeleteQuery(); $q->deleteFrom($this->dbHandler->quoteTable('ezcontentclass_classgroup'))->where($q->expr->lAnd($q->expr->eq($this->dbHandler->quoteColumn('contentclass_id'), $q->bindValue($typeId, null, \PDO::PARAM_INT)), $q->expr->eq($this->dbHandler->quoteColumn('contentclass_version'), $q->bindValue($status, null, \PDO::PARAM_INT)))); $q->prepare()->execute(); }