當前位置: 首頁>>代碼示例>>PHP>>正文


PHP type::commit方法代碼示例

本文整理匯總了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();
 }
開發者ID:echoOly,項目名稱:php_base,代碼行數:12,代碼來源:BaseModel.php

示例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;
    }
}
開發者ID:bassels,項目名稱:moebel-mafia,代碼行數:58,代碼來源:deleteProduct.php

示例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;
     }
 }
開發者ID:brunoblauzius,項目名稱:sistema,代碼行數:27,代碼來源:DAO.php

示例4: commit

 public function commit()
 {
     if (self::$link) {
         self::$link->commit();
     }
 }
開發者ID:desalort,項目名稱:FSAutoventas,代碼行數:6,代碼來源:fs_mysql.php

示例5: commit

 /**
  *
  */
 public function commit()
 {
     //
     $this->_pdo->commit();
 }
開發者ID:javanile,項目名稱:schemadb,代碼行數:8,代碼來源:PdoSocket.php


注:本文中的type::commit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。