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


PHP Stack::sl_ok方法代碼示例

本文整理匯總了PHP中Stack::sl_ok方法的典型用法代碼示例。如果您正苦於以下問題:PHP Stack::sl_ok方法的具體用法?PHP Stack::sl_ok怎麽用?PHP Stack::sl_ok使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Stack的用法示例。


在下文中一共展示了Stack::sl_ok方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: stack_delete_card

 public function stack_delete_card($card_id)
 {
     $this->stack_will_be_modified();
     $next_card_id = null;
     $this->file_db->beginTransaction();
     $stmt = $this->file_db->prepare('SELECT bkgnd_id, card_seq FROM card WHERE card_id=?');
     Stack::sl_ok($stmt, $this->file_db, 'Deleting Card (1)');
     Stack::sl_ok($stmt->execute(array(intval($card_id))), $this->file_db, 'Deleting Card (2)');
     $row = $stmt->fetch(PDO::FETCH_NUM);
     Stack::sl_ok($row, $this->file_db, 'Deleting Card (3)');
     $bkgnd_id = $row[0];
     $existing_seq = $row[1];
     $stmt = $this->file_db->prepare('SELECT COUNT(card.card_id) FROM card WHERE bkgnd_id=?');
     Stack::sl_ok($stmt, $this->file_db, 'Deleting Card (4)');
     Stack::sl_ok($stmt->execute(array(intval($bkgnd_id))), $this->file_db, 'Deleting Card (5)');
     $row = $stmt->fetch(PDO::FETCH_NUM);
     Stack::sl_ok($row, $this->file_db, 'Deleting Card (6)');
     $bkgnd_count = $row[0];
     $cleanup_bkgnd = $bkgnd_count == 1;
     $stmt = $this->file_db->prepare('SELECT COUNT(card.card_id) FROM card');
     Stack::sl_ok($stmt, $this->file_db, 'Deleting Card (7)');
     Stack::sl_ok($stmt->execute(), $this->file_db, 'Deleting Card (8)');
     $row = $stmt->fetch(PDO::FETCH_NUM);
     Stack::sl_ok($row, $this->file_db, 'Deleting Card (9)');
     $stack_count = $row[0];
     if ($stack_count == 1) {
         Stack::sl_ok(false, null, 'Deleting Card (10); Last Card in Stack');
     }
     $stmt = $this->file_db->prepare('DELETE FROM card WHERE card_id=?');
     Stack::sl_ok($stmt, $this->file_db, 'Deleting Card (11)');
     $rows = $stmt->execute(array(intval($card_id)));
     if ($rows === 0) {
         $rows = false;
     }
     Stack::sl_ok($rows, $this->file_db, 'Deleting Card (12)');
     $stmt = $this->file_db->prepare('UPDATE card SET card_seq=card_seq-10 WHERE card_seq>?');
     Stack::sl_ok($stmt, $this->file_db, 'Deleting Card (13)');
     Stack::sl_ok($stmt->execute(array(intval($existing_seq))), $this->file_db, 'Deleting Card (14)');
     if ($cleanup_bkgnd) {
         $stmt = $this->file_db->prepare('DELETE FROM bkgnd WHERE bkgnd_id=?');
         Stack::sl_ok($stmt, $this->file_db, 'Deleting Bkgnd (1)');
         $rows = $stmt->execute(array($bkgnd_id));
         if ($rows === 0) {
             $rows = false;
         }
         Stack::sl_ok($rows, $this->file_db, 'Deleting Bkgnd (2)');
     }
     $stmt = $this->file_db->prepare('SELECT card_id FROM card WHERE card_seq=?');
     Stack::sl_ok($stmt, $this->file_db, 'Deleting Card (15)');
     Stack::sl_ok($stmt->execute(array(intval($existing_seq))), $this->file_db, 'Deleting Card (16)');
     $row = $stmt->fetch(PDO::FETCH_NUM);
     if ($row) {
         $next_card_id = $row[0];
     } else {
         $next_card_id = $this->stack_get_first_card_id();
     }
     $this->file_db->commit();
     return $next_card_id;
 }
開發者ID:Happy-Ferret,項目名稱:cinsimp-web,代碼行數:59,代碼來源:stack.php

示例2: zap_all_cards

 public function zap_all_cards()
 {
     CinsImpError::unimplemented();
     // UNTIL REFACTORED, DISABLED
     $this->stack_will_be_modified();
     $stmt = $this->file_db->prepare('DELETE FROM card');
     Stack::sl_ok($stmt, $this->file_db, 'Deleting All Cards (1)');
     $rows = $stmt->execute();
     Stack::sl_ok($rows, $this->file_db, 'Deleting All Cards (2)');
     $stmt = $this->file_db->prepare('DELETE FROM bkgnd');
     Stack::sl_ok($stmt, $this->file_db, 'Deleting All Cards (3)');
     $rows = $stmt->execute();
     Stack::sl_ok($rows, $this->file_db, 'Deleting All Cards (4)');
 }
開發者ID:jhawcroft,項目名稱:cinsimp-web,代碼行數:14,代碼來源:stack.php


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