mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
Merge branch 'master' of https://github.com/top-think/framework
This commit is contained in:
@@ -239,24 +239,22 @@ class Query
|
|||||||
/**
|
/**
|
||||||
* 启动事务
|
* 启动事务
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $label 事务标识
|
|
||||||
* @return bool|null
|
* @return bool|null
|
||||||
*/
|
*/
|
||||||
public function startTrans($label = '')
|
public function startTrans()
|
||||||
{
|
{
|
||||||
return $this->connection->startTrans($label);
|
return $this->connection->startTrans();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用于非自动提交状态下面的查询提交
|
* 用于非自动提交状态下面的查询提交
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $label 事务标识
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws PDOException
|
* @throws PDOException
|
||||||
*/
|
*/
|
||||||
public function commit($label = '')
|
public function commit()
|
||||||
{
|
{
|
||||||
return $this->connection->commit($label);
|
return $this->connection->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ class Merge extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
$db = $this->db();
|
$db = $this->db();
|
||||||
$db->startTrans('merge_save_' . $this->name);
|
$db->startTrans();
|
||||||
try {
|
try {
|
||||||
if ($this->isUpdate) {
|
if ($this->isUpdate) {
|
||||||
// 自动写入
|
// 自动写入
|
||||||
@@ -235,7 +235,7 @@ class Merge extends Model
|
|||||||
// 新增回调
|
// 新增回调
|
||||||
$this->trigger('after_insert', $this);
|
$this->trigger('after_insert', $this);
|
||||||
}
|
}
|
||||||
$db->commit('merge_save_' . $this->name);
|
$db->commit();
|
||||||
return $result;
|
return $result;
|
||||||
} catch (\PDOException $e) {
|
} catch (\PDOException $e) {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
@@ -255,7 +255,7 @@ class Merge extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
$db = $this->db();
|
$db = $this->db();
|
||||||
$db->startTrans('merge_delete_' . $this->name);
|
$db->startTrans();
|
||||||
try {
|
try {
|
||||||
$result = $db->delete($this->data);
|
$result = $db->delete($this->data);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@@ -270,7 +270,7 @@ class Merge extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->trigger('after_delete', $this);
|
$this->trigger('after_delete', $this);
|
||||||
$db->commit('merge_delete_' . $this->name);
|
$db->commit();
|
||||||
return $result;
|
return $result;
|
||||||
} catch (\PDOException $e) {
|
} catch (\PDOException $e) {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|||||||
Reference in New Issue
Block a user