mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进Query类的value和column方法 支持 fetchSql方法
This commit is contained in:
@@ -391,6 +391,10 @@ class Query
|
|||||||
unset($this->options['field']);
|
unset($this->options['field']);
|
||||||
}
|
}
|
||||||
$pdo = $this->field($field)->fetchPdo(true)->find();
|
$pdo = $this->field($field)->fetchPdo(true)->find();
|
||||||
|
if (is_string($pdo)) {
|
||||||
|
// 返回SQL语句
|
||||||
|
return $pdo;
|
||||||
|
}
|
||||||
$result = $pdo->fetchColumn();
|
$result = $pdo->fetchColumn();
|
||||||
if (isset($cache)) {
|
if (isset($cache)) {
|
||||||
// 缓存数据
|
// 缓存数据
|
||||||
@@ -430,6 +434,10 @@ class Query
|
|||||||
$field = $key . ',' . $field;
|
$field = $key . ',' . $field;
|
||||||
}
|
}
|
||||||
$pdo = $this->field($field)->fetchPdo(true)->select();
|
$pdo = $this->field($field)->fetchPdo(true)->select();
|
||||||
|
if (is_string($pdo)) {
|
||||||
|
// 返回SQL语句
|
||||||
|
return $pdo;
|
||||||
|
}
|
||||||
if (1 == $pdo->columnCount()) {
|
if (1 == $pdo->columnCount()) {
|
||||||
$result = $pdo->fetchAll(PDO::FETCH_COLUMN);
|
$result = $pdo->fetchAll(PDO::FETCH_COLUMN);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user