/**
* 事务封装方法
* @access public 将此方法放入框架model.class.php中
* @param array $sqls 要执行的sql数组或语句
* @param array $vals sql语句中要替换的值
* @return boolean
*/
public function transExecuteSql($sqls)
{
  $this->startTrans();
  if(is_array($sqls))
{
foreach($sqls as $k => $sql)
{
  $result=$this->db->execute($sql);
  if(!$result)
  {
    $this->rollBack();
    return false;
  }
}
}else{
  $result=$this->db->execute($sqls);
  if(!$result)
  {
    $this->rollBack();
    return false;
  }
}
  $this->commit();
  return true;
}

相关文章:

  • 2021-08-26
  • 2021-08-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-13
  • 2021-10-21
  • 2021-11-24
  • 2022-12-23
相关资源
相似解决方案