Added some transactions

This commit is contained in:
jengo 2001-06-04 01:17:40 +00:00
parent b1f5d1b2da
commit 0e768f7268
2 changed files with 5 additions and 2 deletions

View File

@ -234,6 +234,7 @@
$sql = "insert into phpgw_accounts"; $sql = "insert into phpgw_accounts";
$sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)"; $sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
$sql .= "values (".$accountid.", '".$accountname."','u', '".md5($passwd)."', '".$accountname."', 'AutoCreated', ".time().", 'A')"; $sql .= "values (".$accountid.", '".$accountname."','u', '".md5($passwd)."', '".$accountname."', 'AutoCreated', ".time().", 'A')";
$this->db->transaction_begin();
$this->db->query($sql); $this->db->query($sql);
$this->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('".$accountid."', '$default_prefs')"); $this->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('".$accountid."', '$default_prefs')");
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 'u', 1)",__LINE__,__FILE__); $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 'u', 1)",__LINE__,__FILE__);
@ -244,6 +245,8 @@
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__); $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__);
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__); $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__);
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__); $this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__);
$this->db->transaction_commit();
return $accountid; return $accountid;
} }
} //end of class } //end of class

View File

@ -146,7 +146,7 @@
if (! $phpgw->acl->check('session_only_preferences',1,'preferences')) if (! $phpgw->acl->check('session_only_preferences',1,'preferences'))
{ {
$this->db->lock('phpgw_preferences'); $this->db->transaction_begin();
$this->db->query("delete from phpgw_preferences where preference_owner='" . $this->account_id $this->db->query("delete from phpgw_preferences where preference_owner='" . $this->account_id
. "'",__LINE__,__FILE__); . "'",__LINE__,__FILE__);
@ -162,7 +162,7 @@
$this->db->query("insert into phpgw_preferences (preference_owner,preference_value) values ('" $this->db->query("insert into phpgw_preferences (preference_owner,preference_value) values ('"
. $this->account_id . "','" . $pref_info . "')",__LINE__,__FILE__); . $this->account_id . "','" . $pref_info . "')",__LINE__,__FILE__);
$this->db->unlock(); $this->db->transaction_commit();
} }
else else
{ {