traits 修改

This commit is contained in:
ThinkPHP
2013-04-18 09:58:32 +08:00
parent 9de2abac95
commit d875ab2782
2 changed files with 4 additions and 29 deletions

View File

@@ -16,6 +16,9 @@ trait Auto {
protected $_validate = []; // 自动验证定义
protected $_auto = []; // 自动完成定义
public function test($auto=''){
echo 'auto';
}
/**
* 创建数据对象 但不保存到数据库
* @access public

View File

@@ -9,7 +9,7 @@
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace Traits\Think;
namespace Traits\Think\Model;
trait Extend {
@@ -176,34 +176,6 @@ trait Extend {
}
}
/**
* 批处理执行SQL语句
* 批处理的指令都认为是execute操作
* @access public
* @param array $sql SQL批处理指令
* @return boolean
*/
public function patchQuery($sql=[]) {
if(!is_array($sql)) return false;
// 自动启动事务支持
$this->startTrans();
try{
foreach ($sql as $_sql){
$result = $this->execute($_sql);
if(false === $result) {
// 发生错误自动回滚事务
$this->rollback();
return false;
}
}
// 提交事务
$this->commit();
} catch (\Think\Exception $e) {
$this->rollback();
}
return true;
}
/**
* 得到分表的的数据表名
* @access public