Skip to content
This repository was archived by the owner on Jan 4, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions ThinkPHP/Library/Think/Db/Driver.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,58 @@ protected function multiConnect($master = false)
);
return $this->connect($db_config, $r, $r == $m ? false : $db_master);
}

/**
* 启动XA事务
* @access public
* @param string $xid XA事务id
* @return void
*/
public function startTransXa($xid)
{
$this->initConnect(true);
if (!$this->linkID) {
return false;
}
$this->execute("XA START '$xid'");
}

/**
* 预编译XA事务
* @access public
* @param string $xid XA事务id
* @return void
*/
public function prepareXa($xid)
{
$this->initConnect(true);
$this->execute("XA END '$xid'");
$this->execute("XA PREPARE '$xid'");
}

/**
* 提交XA事务
* @access public
* @param string $xid XA事务id
* @return void
*/
public function commitXa($xid)
{
$this->initConnect(true);
$this->execute("XA COMMIT '$xid'");
}

/**
* 回滚XA事务
* @access public
* @param string $xid XA事务id
* @return void
*/
public function rollbackXa($xid)
{
$this->initConnect(true);
$this->execute("XA ROLLBACK '$xid'");
}

/**
* 析构方法
Expand Down