• Main Page
  • Data Structures
  • Files
  • File List

firebirdTransaction.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /**
00004  * Firebird/Interbase transaction class
00005  *
00006  * @package objSQL
00007  * @version 2.1.0
00008  * @author MT Jordan <mtjo62@gmail.com>
00009  * @link http://objsql.sourceforge.net
00010  * @copyright 2004-2010 openSource Partners
00011  * @license LGPL
00012  * @revision $Id: firebirdTransaction.php,v 1.4 2008-01-19 23:57:52-05 mt_jordan Exp $
00013  */
00014 
00015 class firebirdTransaction
00016 {
00017     /**********************************************
00018      * Internal variables
00019      *********************************************/
00020 
00021     /**
00022      * Transaction resource
00023      *
00024      * @access private
00025      * @var    mixed
00026      */
00027     private $objAutoCommit;
00028 
00029     /**
00030      * Database connection object
00031      *
00032      * @access private
00033      * @var    mixed
00034      */
00035     private $objConnection;
00036 
00037     /**********************************************
00038      * Class methods
00039      *********************************************/
00040 
00041     /**
00042      * Constructor
00043      *
00044      * @access public
00045      * @param  mixed $connection
00046      * @param  mixed $autocommit
00047      */
00048     public function __construct( $connection, $autocommit )
00049     {
00050         $this->objAutoCommit = $autocommit;
00051         $this->objConnection = $connection;
00052     }
00053 
00054     /**
00055      * Commit transaction
00056      *
00057      * @access public
00058      * @param  array $savepoint_array
00059      * @return bool
00060      */
00061     public function commit( $savepoint_array=false )
00062     {
00063         if ( $savepoint_array )
00064         {
00065             foreach ( $savepoint_array as $objSavepoints )
00066                 ibase_commit( $objSavepoints );
00067         }
00068 
00069         if ( is_resource( $this->objAutoCommit ) )
00070             return ibase_commit( $this->objAutoCommit );
00071     }
00072 
00073     /**
00074      * Rollback transaction
00075      *
00076      * @access public
00077      * @param  str   $savepoint
00078      * @param  mixed $savepoint_array
00079      * @return bool
00080      */
00081     public function rollback( $savepoint=false, $savepoint_array=false )
00082     {
00083         if ( is_array( $savepoint_array ) )
00084         {
00085             foreach ( $savepoint_array as $objSavepoints )
00086                 ibase_rollback( $objSavepoints );
00087         }
00088 
00089         if ( is_resource( $this->objAutoCommit ) )
00090             return ibase_commit( $this->objConnection );
00091     }
00092 
00093     /**
00094      * Create rollback savepoint
00095      *
00096      * @access public
00097      * @return mixed
00098      */
00099     public function savepoint()
00100     {
00101         return ibase_trans( $this->objConnection );
00102     }
00103 }
00104 
00105 ?>

Generated on Sat Jul 10 2010 15:14:38 for objSQL 2.1.0 by  doxygen 1.7.1