本文整理汇总了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;
}
示例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)');
}