注释改进

This commit is contained in:
thinkphp
2016-05-18 12:30:55 +08:00
parent 5dc8cd481e
commit a00c4c51fe
4 changed files with 47 additions and 34 deletions

View File

@@ -595,22 +595,23 @@ abstract class Connection
* 批处理执行SQL语句
* 批处理的指令都认为是execute操作
* @access public
* @param array $sql SQL批处理指令
* @param array $sqlArray SQL批处理指令
* @return boolean
*/
public function batchQuery($sql = [])
public function batchQuery($sqlArray = [])
{
if (!is_array($sql)) {
if (!is_array($sqlArray)) {
return false;
}
// 自动启动事务支持
$this->startTrans(NOW_TIME);
$label = microtime(true);
$this->startTrans($label);
try {
foreach ($sql as $_sql) {
$result = $this->execute($_sql);
foreach ($sqlArray as $sql) {
$result = $this->execute($sql);
}
// 提交事务
$this->commit(NOW_TIME);
$this->commit($label);
} catch (\PDOException $e) {
$this->rollback();
return false;
@@ -717,9 +718,10 @@ abstract class Connection
}
/**
* 数据库调试 记录当前SQL
* 数据库调试 记录当前SQL及分析性能
* @access protected
* @param boolean $start 调试开始标记 true 开始 false 结束
* @return void
*/
protected function debug($start)
{
@@ -782,7 +784,7 @@ abstract class Connection
/**
* 初始化数据库连接
* @access protected
* @param boolean $master 主服务器
* @param boolean $master 是否主服务器
* @return void
*/
protected function initConnect($master = true)