pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

kohana private pastebin - collaborative debugging tool What's a private pastebin?


Posted by vijinho on Thu 10 Apr 15:17
report abuse | download | new post

  1. <?php
  2. /**
  3.  * Fail Default Database Class
  4.  *
  5.  * @package    Fail
  6.  * @author     Vijay Mahrra
  7.  * @copyright  (c) 2008 Fail (UK) Limited
  8.  */
  9. class Database extends Database_Core {
  10.  
  11.     /**
  12.      * Transaction status variable
  13.      *
  14.      * @var in_transaction
  15.      */
  16.     protected $in_transaction = false;
  17.  
  18.     public function __construct()
  19.     {
  20.         parent::__construct();
  21.     }
  22.  
  23.     public function __destruct()
  24.     {
  25.         self::trans_rollback();
  26.     }
  27.  
  28.     /**
  29.      * Status of transaction
  30.      *
  31.      * @return  void
  32.      */
  33.     public function trans_status()
  34.     {
  35.         return $this->in_transaction;
  36.     }
  37.  
  38.     /**
  39.      * Start a transaction
  40.      *
  41.      * @return  void
  42.      */
  43.     public function trans_start()
  44.     {
  45.         if ($this->in_transaction === false) {
  46.             $this->query('SET AUTOCOMMIT=0');
  47.             $this->query('BEGIN');
  48.         }
  49.         $this->in_transaction = true;
  50.     }
  51.  
  52.     /**
  53.      * Finish the transaction
  54.      *
  55.      * @return  void
  56.      */
  57.     public function trans_complete()
  58.     {
  59.         if ($this->in_transaction === true) {
  60.             $this->query('COMMIT');
  61.             $this->query('SET AUTOCOMMIT=1');
  62.         }
  63.         $this->in_transaction = false;
  64.     }
  65.  
  66.     /**
  67.      * Undo the transaction
  68.      *
  69.      * @return  void
  70.      */
  71.     public function trans_rollback()
  72.     {
  73.         if ($this->in_transaction === true) {
  74.             $this->query('ROLLBACK');
  75.             $this->query('SET AUTOCOMMIT=1');
  76.         }
  77.         $this->in_transaction = false;
  78.     }
  79. }
  80. ?>

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post