Location: PHPKode > projects > Journalness > Journalness_4.1.1_Full/includes/database/adodbSQL_drivers/mysql/mysql_transaction_module.inc
<?php
/**
 * ADOdb Lite Transaction Module for Mysql
 * 
 */

eval('class mysql_transaction_EXTENDER extends '. $last_module . '_ADOConnection { }');

class mysql_transaction_ADOConnection extends mysql_transaction_EXTENDER
{
	var $autoCommit = true;
	var $transOff = 0;
	var $transCnt = 0;
	var $transaction_status = true;

	function StartTrans($errfn = 'ADODB_TransMonitor')
	{
		if ($this->transOff > 0) {
			$this->transOff += 1;
			return;
		}

		$this->transaction_status = true;

		if ($this->debug && $this->transCnt > 0)
			ADOConnection::outp("Bad Transaction: StartTrans called within BeginTrans");

		$this->BeginTrans();
		$this->transOff = 1;
	}

	function BeginTrans()
	{
		return false;
	}

	function CompleteTrans($autoComplete = true)
	{
		if ($this->transOff > 1) {
			$this->transOff -= 1;
			return true;
		}

		$this->transOff = 0;
		if ($this->transaction_status && $autoComplete) {
			if (!$this->CommitTrans()) {
				$this->transaction_status = false;
				if ($this->debug)
					ADOConnection::outp("Smart Commit failed");
			} else
				if ($this->debug)
					ADOConnection::outp("Smart Commit occurred");
		} else {
			$this->transaction_status = false;
			$this->RollbackTrans();
			if ($this->debug)
				ADOCOnnection::outp("Smart Rollback occurred");
		}

		return $this->transaction_status;
	}

	function CommitTrans($ok=true) 
	{
		return true;
	}

	function RollbackTrans() 
	{
		return false;
	}

	function FailTrans()
	{
		if ($this->debug) 
			if ($this->transOff == 0) {
				ADOConnection::outp("FailTrans outside StartTrans/CompleteTrans");
			} else {
				ADOConnection::outp("FailTrans was called");
			}
		$this->transaction_status = false;
	}

	function HasFailedTrans()
	{
		if ($this->transOff > 0)
			return $this->transaction_status == false;

		return false;
	}

	function RowLock($table,$where)
	{
		return false;
	}

	function CommitLock($table)
	{
		return $this->CommitTrans();
	}

	function RollbackLock($table)
	{
		return $this->RollbackTrans();
	}
}

eval('class mysql_transaction_resultset_EXTENDER extends '. $last_module . '_ResultSet { }');

class mysql_transaction_ResultSet extends mysql_transaction_resultset_EXTENDER
{
}
?>
Return current item: Journalness