[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7214] Fix db related transaction abort log problem
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7214] Fix db related transaction abort log problem |
Date: |
Tue, 12 Apr 2011 16:45:12 +0000 |
Revision: 7214
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7214
Author: sigurdne
Date: 2011-04-12 16:45:11 +0000 (Tue, 12 Apr 2011)
Log Message:
-----------
Fix db related transaction abort log problem
Modified Paths:
--------------
trunk/admin/inc/class.solog.inc.php
trunk/booking/inc/class.sobilling_sequential_number_generator.inc.php
trunk/calendar/inc/class.socalendar_sql.inc.php
trunk/phpgwapi/inc/accounts/class.accounts_sql.inc.php
trunk/phpgwapi/inc/class.acl.inc.php
trunk/phpgwapi/inc/class.contacts_sql.inc.php
trunk/phpgwapi/inc/class.custom_fields.inc.php
trunk/phpgwapi/inc/class.db.inc.php
trunk/phpgwapi/inc/class.db_adodb.inc.php
trunk/phpgwapi/inc/class.db_pdo.inc.php
trunk/phpgwapi/inc/class.preferences.inc.php
trunk/property/inc/class.db_mssql.inc.php
trunk/property/inc/class.soadmin_entity.inc.php
trunk/property/inc/class.soadmin_location.inc.php
trunk/property/inc/class.solocation.inc.php
trunk/property/inc/class.sopending_action.inc.php
Modified: trunk/admin/inc/class.solog.inc.php
===================================================================
--- trunk/admin/inc/class.solog.inc.php 2011-04-12 13:26:50 UTC (rev 7213)
+++ trunk/admin/inc/class.solog.inc.php 2011-04-12 16:45:11 UTC (rev 7214)
@@ -25,7 +25,7 @@
$account_id = (int) $account_id;
if ($account_id > 0)
{
- return " WHEEE log_account_id = $account_id";
+ return " WHERE log_account_id = $account_id";
}
}
Modified: trunk/booking/inc/class.sobilling_sequential_number_generator.inc.php
===================================================================
--- trunk/booking/inc/class.sobilling_sequential_number_generator.inc.php
2011-04-12 13:26:50 UTC (rev 7213)
+++ trunk/booking/inc/class.sobilling_sequential_number_generator.inc.php
2011-04-12 16:45:11 UTC (rev 7214)
@@ -92,7 +92,7 @@
throw new LogicException("Cannot be reused over
multiple transactions");
}
- if ($this->get_db()->Transaction === false) {
+ if ($this->get_db()->get_transaction() === false) {
throw new LogicException("Must only be called
within a transaction");
}
@@ -133,7 +133,7 @@
}
function get_current() {
- if ($this->used || ($this->get_db()->Transaction ===
false && $this->locked)) {
+ if ($this->used || ($this->get_db()->get_transaction()
=== false && $this->locked)) {
$this->set_used();
throw new LogicException("Cannot be reused over
multiple transactions");
}
@@ -154,4 +154,4 @@
$this->locked = false;
$this->used = true;
}
- }
\ No newline at end of file
+ }
Modified: trunk/calendar/inc/class.socalendar_sql.inc.php
===================================================================
--- trunk/calendar/inc/class.socalendar_sql.inc.php 2011-04-12 13:26:50 UTC
(rev 7213)
+++ trunk/calendar/inc/class.socalendar_sql.inc.php 2011-04-12 16:45:11 UTC
(rev 7214)
@@ -92,7 +92,7 @@
$this->delete_event( (int) $this->stream->f('cal_id'));
}
// $this->stream->lock(array('phpgw_cal_user'));
- if ( $this->stream->Transaction )
+ if ( $this->stream->get_transaction() )
{
$this->global_lock = true;
}
@@ -507,7 +507,7 @@
);
$this->stream->lock($locks);
*/
- if ( $this->stream->Transaction )
+ if ( $this->stream->get_transaction() )
{
$this->global_lock = true;
}
Modified: trunk/phpgwapi/inc/accounts/class.accounts_sql.inc.php
===================================================================
--- trunk/phpgwapi/inc/accounts/class.accounts_sql.inc.php 2011-04-12
13:26:50 UTC (rev 7213)
+++ trunk/phpgwapi/inc/accounts/class.accounts_sql.inc.php 2011-04-12
16:45:11 UTC (rev 7214)
@@ -100,7 +100,7 @@
*/
public function create_group_account($account)
{
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
@@ -154,7 +154,7 @@
*/
public function create_user_account($account)
{
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
Modified: trunk/phpgwapi/inc/class.acl.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.acl.inc.php 2011-04-12 13:26:50 UTC (rev
7213)
+++ trunk/phpgwapi/inc/class.acl.inc.php 2011-04-12 16:45:11 UTC (rev
7214)
@@ -409,7 +409,7 @@
unset($subs);
unset($_locations);
- if ( $this->_db->Transaction )
+ if ( $this->_db->get_transaction() )
{
$this->global_lock = true;
}
Modified: trunk/phpgwapi/inc/class.contacts_sql.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.contacts_sql.inc.php 2011-04-12 13:26:50 UTC
(rev 7213)
+++ trunk/phpgwapi/inc/class.contacts_sql.inc.php 2011-04-12 16:45:11 UTC
(rev 7214)
@@ -2391,7 +2391,7 @@
$principal['preferred_address'] = '';
}
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
@@ -2478,7 +2478,7 @@
$this->org = createObject('phpgwapi.contact_org');
if ($action == PHPGW_SQL_RUN_SQL)
{
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
@@ -2511,7 +2511,7 @@
$this->person = createObject('phpgwapi.contact_person');
if ($action == PHPGW_SQL_RUN_SQL)
{
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
@@ -2569,7 +2569,7 @@
if ($action == PHPGW_SQL_RUN_SQL)
{
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
@@ -2616,7 +2616,7 @@
$data['my_creatby'] =
$this->get_user_id();
if ($action == PHPGW_SQL_RUN_SQL)
{
- if ( $this->db->Transaction )
+ if (
$this->db->get_transaction() )
{
$this->global_lock =
true;
}
@@ -2646,7 +2646,7 @@
$this->location = createObject('phpgwapi.contact_addr');
if ($action == PHPGW_SQL_RUN_SQL)
{
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
@@ -2686,7 +2686,7 @@
$this->comm = createObject('phpgwapi.contact_comm');
if ($action == PHPGW_SQL_RUN_SQL)
{
- if ( $this->db->Transaction &&
!$this->local_lock)
+ if ( $this->db->get_transaction() &&
!$this->local_lock)
{
$this->global_lock = true;
}
@@ -2719,7 +2719,7 @@
$this->note = createObject('phpgwapi.contact_note');
if ($action == PHPGW_SQL_RUN_SQL)
{
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
@@ -2752,7 +2752,7 @@
$this->others = createObject('phpgwapi.contact_others');
if ($action == PHPGW_SQL_RUN_SQL)
{
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
@@ -2927,7 +2927,7 @@
function delete_org_person_relation($org_id, $person_id,
$action=PHPGW_SQL_RUN_SQL)
{
$relations =
createObject('phpgwapi.contact_org_person');
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
@@ -3933,7 +3933,7 @@
foreach($records as $data)
{
$this->relations =
createObject('phpgwapi.contact_org_person');
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
@@ -3967,7 +3967,7 @@
if(!$this->exist_org_person_relation($new_organization_id,
$data['my_person_id']))
{
$this->relations =
createObject('phpgwapi.contact_org_person');
- if ( $this->db->Transaction )
+ if (
$this->db->get_transaction() )
{
$this->global_lock =
true;
}
@@ -4100,7 +4100,7 @@
*/
function unlock_table()
{
- if(!$this->global_lock && $this->db->Transaction)
+ if( !$this->global_lock && $this->db->get_transaction()
)
{
$this->db->transaction_commit();
$this->locked = NULL;
Modified: trunk/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.custom_fields.inc.php 2011-04-12 13:26:50 UTC
(rev 7213)
+++ trunk/phpgwapi/inc/class.custom_fields.inc.php 2011-04-12 16:45:11 UTC
(rev 7214)
@@ -320,7 +320,7 @@
unset($attrib);
- if ( $this->_db->Transaction )
+ if ( $this->_db->get_transaction() )
{
$this->global_lock = true;
}
Modified: trunk/phpgwapi/inc/class.db.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.db.inc.php 2011-04-12 13:26:50 UTC (rev 7213)
+++ trunk/phpgwapi/inc/class.db.inc.php 2011-04-12 16:45:11 UTC (rev 7214)
@@ -106,7 +106,7 @@
var $fetchmode = 'ASSOC';//'BOTH';
- var $Transaction = false;
+ protected $Transaction = false;
var $persistent = false;
/**
@@ -669,4 +669,9 @@
$next_id = $this->f('maximum')+1;
return $next_id;
}
+
+ public function get_transaction()
+ {
+ return $this->Transaction;
+ }
}
Modified: trunk/phpgwapi/inc/class.db_adodb.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.db_adodb.inc.php 2011-04-12 13:26:50 UTC (rev
7213)
+++ trunk/phpgwapi/inc/class.db_adodb.inc.php 2011-04-12 16:45:11 UTC (rev
7214)
@@ -377,9 +377,21 @@
*/
public function transaction_abort()
{
+ $ret = false;
$this->Transaction = false;
- $this->adodb->FailTrans();
- return $this->adodb->HasFailedTrans();
+ try
+ {
+ $this->adodb->FailTrans();
+ $ret = $this->adodb->HasFailedTrans();
+ }
+ catch(Exception $e)
+ {
+ if ( $e )
+ {
+ throw $e;
+ }
+ }
+ return $ret;
}
/**
Modified: trunk/phpgwapi/inc/class.db_pdo.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.db_pdo.inc.php 2011-04-12 13:26:50 UTC (rev
7213)
+++ trunk/phpgwapi/inc/class.db_pdo.inc.php 2011-04-12 16:45:11 UTC (rev
7214)
@@ -361,6 +361,7 @@
if ( $e && $this->Halt_On_Error == 'yes' )
{
$this->transaction_abort();
+
if($file)
{
trigger_error('Error: ' .
$e->getMessage() . "<br>SQL: $sql\n in File: $file\n on Line: $line\n",
E_USER_ERROR);
@@ -446,6 +447,7 @@
if ( $e && $this->Halt_On_Error == 'yes' )
{
$this->transaction_abort();
+
if($file)
{
trigger_error('Error: ' .
$e->getMessage() . "<br>SQL: $sql\n in File: $file\n on Line: $line\n",
E_USER_ERROR);
@@ -561,8 +563,21 @@
*/
public function transaction_abort()
{
+ $ret = false;
$this->Transaction = false;
- return $this->db->rollBack();
+ try
+ {
+ $ret = $this->db->rollBack();
+ }
+ catch(PDOException $e)
+ {
+ if ( $e )
+ {
+ trigger_error('Error: ' .
$e->getMessage(), E_USER_ERROR);
+ // throw $e;
+ }
+ }
+ return $ret;
}
/**
Modified: trunk/phpgwapi/inc/class.preferences.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.preferences.inc.php 2011-04-12 13:26:50 UTC
(rev 7213)
+++ trunk/phpgwapi/inc/class.preferences.inc.php 2011-04-12 16:45:11 UTC
(rev 7214)
@@ -608,7 +608,7 @@
if (!
$GLOBALS['phpgw']->acl->check('session_only_preferences',1,'preferences'))
{
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
Modified: trunk/property/inc/class.db_mssql.inc.php
===================================================================
--- trunk/property/inc/class.db_mssql.inc.php 2011-04-12 13:26:50 UTC (rev
7213)
+++ trunk/property/inc/class.db_mssql.inc.php 2011-04-12 16:45:11 UTC (rev
7214)
@@ -28,7 +28,7 @@
var $Error = '';
var $Auto_Free = 0; ## set this to 1 to automatically
free results
var $Debug = false;
- var $Transaction = false;
+ protected $Transaction = false;
function connect()
{
@@ -379,5 +379,11 @@
$return = array();
return $return;
}
+
+ public function get_transaction()
+ {
+ return $this->Transaction;
+ }
+
}
Modified: trunk/property/inc/class.soadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.soadmin_entity.inc.php 2011-04-12 13:26:50 UTC
(rev 7213)
+++ trunk/property/inc/class.soadmin_entity.inc.php 2011-04-12 16:45:11 UTC
(rev 7214)
@@ -608,7 +608,7 @@
else
{
$receipt['error'][] = array('msg' =>
lang('table could not be added') );
- if($this->db->Transaction)
+ if( $this->db->get_transaction() )
{
$this->db->transaction_abort();
}
Modified: trunk/property/inc/class.soadmin_location.inc.php
===================================================================
--- trunk/property/inc/class.soadmin_location.inc.php 2011-04-12 13:26:50 UTC
(rev 7213)
+++ trunk/property/inc/class.soadmin_location.inc.php 2011-04-12 16:45:11 UTC
(rev 7214)
@@ -458,7 +458,7 @@
else
{
$receipt['error'][] = array('msg' =>
lang('table could not be added'));
- if($this->db->Transaction)
+ if( $this->db->get_transaction() )
{
$this->db->transaction_abort();
}
Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2011-04-12 13:26:50 UTC (rev
7213)
+++ trunk/property/inc/class.solocation.inc.php 2011-04-12 16:45:11 UTC (rev
7214)
@@ -1415,7 +1415,7 @@
function update_location()
{
- if ( $this->db->Transaction )
+ if ( $this->db->get_transaction() )
{
$this->global_lock = true;
}
Modified: trunk/property/inc/class.sopending_action.inc.php
===================================================================
--- trunk/property/inc/class.sopending_action.inc.php 2011-04-12 13:26:50 UTC
(rev 7213)
+++ trunk/property/inc/class.sopending_action.inc.php 2011-04-12 16:45:11 UTC
(rev 7214)
@@ -114,7 +114,7 @@
$reminder = 1;
- if( $this->db->Transaction )
+ if( $this->db->get_transaction() )
{
$this->global_transaction = true;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7214] Fix db related transaction abort log problem,
Sigurd Nes <=