|
@@ -780,7 +780,7 @@ class ModelDb
|
|
|
if(is_mobile())
|
|
|
{
|
|
|
$sql = $this->buildSelectSql($options);
|
|
|
- $result = DB::getAll($sql,($options['lock'] === true || $options['master'] === true || defined('TRANS_MASTER')) ? 'master' : 'slave');
|
|
|
+ $result = DB::getAll($sql,($options['lock'] === true || $options['master'] === true) ? 'master' : 'slave');
|
|
|
return $result;
|
|
|
}
|
|
|
else
|
|
@@ -794,7 +794,7 @@ class ModelDb
|
|
|
return $_cache[$key];
|
|
|
}
|
|
|
}
|
|
|
- $result = DB::getAll($sql, ($options['lock'] === true || $options['master'] === true || defined('TRANS_MASTER')) ? 'master' : 'slave');
|
|
|
+ $result = DB::getAll($sql, ($options['lock'] === true || $options['master'] === true) ? 'master' : 'slave');
|
|
|
if ($options['cache'] === true && !isset($_cache[$key])) {
|
|
|
$_cache[$key] = $result;
|
|
|
}
|
|
@@ -823,21 +823,21 @@ class ModelDb
|
|
|
['%TABLE%','%DISTINCT%','%FIELD%','%JOIN%','%WHERE%','%GROUP%','%HAVING%','%ORDER%','%LIMIT%','%UNION%','%INDEX%'],
|
|
|
[
|
|
|
$this->parseTable($options),
|
|
|
- $this->parseDistinct(isset($options['distinct'])?$options['distinct']:false),
|
|
|
- $this->parseField(isset($options['field'])?$options['field']:'*'),
|
|
|
- $this->parseJoin(isset($options['on'])?$options: []),
|
|
|
- $this->parseWhere(isset($options['where'])?$options['where']:''),
|
|
|
- $this->parseGroup(isset($options['group'])?$options['group']:''),
|
|
|
- $this->parseHaving(isset($options['having'])?$options['having']:''),
|
|
|
- $this->parseOrder(isset($options['order'])?$options['order']:''),
|
|
|
- $this->parseLimit(isset($options['limit'])?$options['limit']:''),
|
|
|
- $this->parseUnion(isset($options['union'])?$options['union']:''),
|
|
|
- $this->parseIndex(isset($options['index'])?$options['index']:'')
|
|
|
+ $this->parseDistinct(isset($options['distinct']) ? $options['distinct'] : false),
|
|
|
+ $this->parseField(isset($options['field']) ? $options['field'] : '*'),
|
|
|
+ $this->parseJoin(isset($options['on']) ? $options : []),
|
|
|
+ $this->parseWhere(isset($options['where']) ? $options['where'] : ''),
|
|
|
+ $this->parseGroup(isset($options['group']) ? $options['group'] : ''),
|
|
|
+ $this->parseHaving(isset($options['having']) ? $options['having'] : ''),
|
|
|
+ $this->parseOrder(isset($options['order']) ? $options['order'] : ''),
|
|
|
+ $this->parseLimit(isset($options['limit']) ? $options['limit'] : ''),
|
|
|
+ $this->parseUnion(isset($options['union']) ? $options['union'] : ''),
|
|
|
+ $this->parseIndex(isset($options['index']) ? $options['index'] : '')
|
|
|
],$sql);
|
|
|
return $sql;
|
|
|
}
|
|
|
|
|
|
- protected function parseUnion(){
|
|
|
+ protected function parseUnion($value){
|
|
|
return '';
|
|
|
}
|
|
|
|
|
@@ -954,6 +954,7 @@ class ModelDb
|
|
|
{
|
|
|
// 查询字段的安全过滤
|
|
|
if(!preg_match('/^[A-Z_\|\&\-.a-z0-9]+$/',trim($key))){
|
|
|
+ $error = "";
|
|
|
throw_exception($error);
|
|
|
}
|
|
|
// 多条件支持
|