修正sqlsrv驱动

This commit is contained in:
thinkphp
2016-02-19 22:12:09 +08:00
parent 8ddb3a331c
commit c3e86347f5
2 changed files with 40 additions and 7 deletions

View File

@@ -987,7 +987,12 @@ class Model
protected function _create_filter(&$data) protected function _create_filter(&$data)
{} {}
// 数据自动验证 /**
* 数据自动验证
* @access protected
* @param array $data 数据
* @return void
*/
protected function dataValidate(&$data) protected function dataValidate(&$data)
{ {
if (!empty($this->options['validate'])) { if (!empty($this->options['validate'])) {
@@ -1038,7 +1043,12 @@ class Model
return; return;
} }
// 数据自动填充 /**
* 数据自动填充
* @access protected
* @param array $data 数据
* @return void
*/
protected function dataFill(&$data) protected function dataFill(&$data)
{ {
if (!empty($this->options['auto'])) { if (!empty($this->options['auto'])) {
@@ -1061,7 +1071,13 @@ class Model
} }
} }
// 获取数据值 /**
* 获取数据值
* @access protected
* @param array $data 数据
* @param string $key 数据标识 支持二维
* @return mixed
*/
protected function getDataValue($data, $key) protected function getDataValue($data, $key)
{ {
if (strpos($key, '.')) { if (strpos($key, '.')) {
@@ -1074,7 +1090,13 @@ class Model
return $value; return $value;
} }
// 获取数据自动验证或者完成的规则定义 /**
* 获取数据自动验证或者完成的规则定义
* @access protected
* @param array $data 数据
* @param string $type 数据类型 支持 validate auto
* @return array
*/
protected function getDataRule($data, $type) protected function getDataRule($data, $type)
{ {
if (is_string($data)) { if (is_string($data)) {
@@ -1117,7 +1139,7 @@ class Model
/** /**
* 数据自动填充 * 数据自动填充
* @access public * @access protected
* @param string $key 字段名 * @param string $key 字段名
* @param mixed $val 填充规则 * @param mixed $val 填充规则
* @param array $data 数据 * @param array $data 数据
@@ -1176,7 +1198,7 @@ class Model
/** /**
* 验证字段规则 * 验证字段规则
* @access public * @access protected
* @param mixed $value 字段值 * @param mixed $value 字段值
* @param mixed $val 验证规则 * @param mixed $val 验证规则
* @param array $data 数据 * @param array $data 数据

View File

@@ -92,6 +92,17 @@ class Sqlsrv extends Driver
return $info; return $info;
} }
/**
* order分析
* @access protected
* @param mixed $order
* @return string
*/
protected function parseOrder($order)
{
return !empty($order) ? ' ORDER BY ' . $order[0] : ' ORDER BY rand()';
}
/** /**
* 随机排序 * 随机排序
* @access protected * @access protected
@@ -111,7 +122,7 @@ class Sqlsrv extends Driver
protected function parseKey($key) protected function parseKey($key)
{ {
$key = trim($key); $key = trim($key);
if (!preg_match('/[,\'\"\*\(\)\[.\s]/', $key)) { if (!is_numeric($key) && !preg_match('/[,\'\"\*\(\)\[.\s]/', $key)) {
$key = '[' . $key . ']'; $key = '[' . $key . ']';
} }
return $key; return $key;