当前位置: 首页>>代码示例>>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;未经允许,请勿转载。