本文整理匯總了PHP中type::commit方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::commit方法的具體用法?PHP type::commit怎麽用?PHP type::commit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::commit方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: commit
/**
* 提交事務
*
* @return boolean
*/
public function commit()
{
if (is_null($this->db)) {
$this->db = \Util\Db\Manager::getInstance($this->dbName);
}
return $this->db->commit();
}
示例2: deleteProduct
/**
* Funktion zum endgültigem Löschen von Produkten
* @param type $id
* @param type $db
*/
function deleteProduct($id, $db)
{
$user_id = $_SESSION['user_id'];
//debug($id);
try {
$db->beginTransaction();
$stmt = $db->prepare('SELECT ' . 'products.product_image_path ' . 'FROM products ' . 'WHERE products.product_id = ?');
$stmt->execute(array($id));
$image_path = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt = $db->prepare('DELETE ' . 'FROM package_has_products ' . 'WHERE package_has_products.product_id = ? ' . 'AND package_has_products.user_id = ?');
$stmt->execute(array($id, $user_id));
$stmt = $db->prepare('DELETE ' . 'FROM products ' . 'WHERE products.product_id = ?');
$stmt->execute(array($id));
$stmt = $db->prepare('DELETE ' . 'FROM product_has_category ' . 'WHERE product_has_category.product_id = ?');
$stmt->execute(array($id));
$stmt = $db->prepare('SELECT ' . 'product_has_properties.properties_id ' . 'FROM product_has_properties ' . 'WHERE product_has_properties.product_id = ?');
$stmt->execute(array($id));
$properties = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($properties as $key => $property) {
$stmt = $db->prepare('DELETE ' . 'FROM properties ' . 'WHERE property_id = ?');
$stmt->execute(array($property['properties_id']));
}
$stmt = $db->prepare('DELETE ' . 'FROM product_has_properties ' . 'WHERE product_has_properties.product_id = ?');
$stmt->execute(array($id));
$stmt = $db->prepare('DELETE ' . 'FROM product_has_subcategory ' . 'WHERE product_has_subcategory.product_id = ?');
$stmt->execute(array($id));
$stmt = $db->prepare('DELETE ' . 'FROM user_has_products ' . 'WHERE user_has_products.product_id = ? ' . 'AND user_has_products.user_id = ?');
$stmt->execute(array($id, $user_id));
$db->commit();
} catch (PDOException $e) {
$db->rollBack();
$e->getMessage();
}
if (empty($e)) {
$img = '';
if (is_dir($image_path['product_image_path']) && ($pp = opendir($image_path['product_image_path']))) {
while (($file = readdir($pp)) !== false) {
if ($file != "." && $file != "..") {
$img[] = $file;
}
}
closedir($pp);
}
foreach ($img as $key => $image) {
unlink($image_path['product_image_path'] . $image);
}
rmdir($image_path['product_image_path']);
return true;
} else {
//var_dump($e);
return false;
}
}
示例3: genericExecuteCall
/**
* @version 1.10
* @todo metodo generico para executar metodos call
* OBS. AINDA NÃO FOI TESTADO
* @param type $callabeFunction
* @param array $array
* @return type
* @throws PDOException
*/
public final function genericExecuteCall($callabeFunction = null, array $array = NULL)
{
try {
$this->con->beginTransaction();
$valuesExecute = $this->prepareKeyValues($array);
$sql = "CALL {$callabeFunction}( " . implode(',', array_keys($valuesExecute)) . " );";
$stmt = $this->con->prepare($sql);
$this->con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt->execute($valuesExecute);
//trabalhar a exception pelo erro gerado
$this->con->errorCode();
$this->con->commit();
return TRUE;
} catch (PDOException $ex) {
$this->con->rollBack();
throw $ex;
}
}
示例4: commit
public function commit()
{
if (self::$link) {
self::$link->commit();
}
}
示例5: commit
/**
*
*/
public function commit()
{
//
$this->_pdo->commit();
}