mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-09 08:02:48 +08:00
数据库数据读取改为默认 保持数据库字段大小写 Connection类fieldCase方法改为public
This commit is contained in:
@@ -257,11 +257,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
list($type, $param) = explode(':', $type, 2);
|
list($type, $param) = explode(':', $type, 2);
|
||||||
}
|
}
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'timestamp':
|
case 'datetime':
|
||||||
$format = !empty($param) ? $param : $this->dateFormat;
|
$format = !empty($param) ? $param : $this->dateFormat;
|
||||||
$value = date($format, $_SERVER['REQUEST_TIME']);
|
$value = date($format, $_SERVER['REQUEST_TIME']);
|
||||||
break;
|
break;
|
||||||
case 'datetime':
|
case 'timestamp':
|
||||||
$value = $_SERVER['REQUEST_TIME'];
|
$value = $_SERVER['REQUEST_TIME'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ use PDOStatement;
|
|||||||
use think\App;
|
use think\App;
|
||||||
use think\Collection;
|
use think\Collection;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
|
use think\db\exception\BindParamException;
|
||||||
use think\db\Query;
|
use think\db\Query;
|
||||||
use think\Debug;
|
use think\Debug;
|
||||||
use think\Exception;
|
use think\Exception;
|
||||||
use think\exception\PDOException;
|
use think\exception\PDOException;
|
||||||
use think\db\exception\BindParamException;
|
|
||||||
use think\Log;
|
use think\Log;
|
||||||
|
|
||||||
abstract class Connection
|
abstract class Connection
|
||||||
@@ -102,7 +102,7 @@ abstract class Connection
|
|||||||
|
|
||||||
// PDO连接参数
|
// PDO连接参数
|
||||||
protected $params = [
|
protected $params = [
|
||||||
PDO::ATTR_CASE => PDO::CASE_LOWER,
|
PDO::ATTR_CASE => PDO::CASE_NATURAL,
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
|
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
|
||||||
PDO::ATTR_STRINGIFY_FETCHES => false,
|
PDO::ATTR_STRINGIFY_FETCHES => false,
|
||||||
@@ -188,7 +188,7 @@ abstract class Connection
|
|||||||
* @param array $info 字段信息
|
* @param array $info 字段信息
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function fieldCase($info)
|
public function fieldCase($info)
|
||||||
{
|
{
|
||||||
// 字段大小写转换
|
// 字段大小写转换
|
||||||
switch ($this->attrCase) {
|
switch ($this->attrCase) {
|
||||||
@@ -330,7 +330,7 @@ abstract class Connection
|
|||||||
}
|
}
|
||||||
// 根据参数绑定组装最终的SQL语句
|
// 根据参数绑定组装最终的SQL语句
|
||||||
$this->queryStr = $this->getRealSql($sql, $bind);
|
$this->queryStr = $this->getRealSql($sql, $bind);
|
||||||
|
|
||||||
//释放前次的查询结果
|
//释放前次的查询结果
|
||||||
if (!empty($this->PDOStatement)) {
|
if (!empty($this->PDOStatement)) {
|
||||||
$this->free();
|
$this->free();
|
||||||
@@ -482,7 +482,7 @@ abstract class Connection
|
|||||||
if (!empty($class)) {
|
if (!empty($class)) {
|
||||||
// 返回指定数据集对象类
|
// 返回指定数据集对象类
|
||||||
$result = new $class($result);
|
$result = new $class($result);
|
||||||
} elseif ('collection' == $this->resultSetType){
|
} elseif ('collection' == $this->resultSetType) {
|
||||||
// 返回数据集Collection对象
|
// 返回数据集Collection对象
|
||||||
$result = new Collection($result);
|
$result = new Collection($result);
|
||||||
}
|
}
|
||||||
@@ -551,7 +551,7 @@ abstract class Connection
|
|||||||
|
|
||||||
++$this->transTimes;
|
++$this->transTimes;
|
||||||
|
|
||||||
if ($this->transTimes == 1) {
|
if (1 == $this->transTimes) {
|
||||||
$this->linkID->beginTransaction();
|
$this->linkID->beginTransaction();
|
||||||
} elseif ($this->transTimes > 1 && $this->supportSavepoint()) {
|
} elseif ($this->transTimes > 1 && $this->supportSavepoint()) {
|
||||||
$this->linkID->exec(
|
$this->linkID->exec(
|
||||||
@@ -570,7 +570,7 @@ abstract class Connection
|
|||||||
{
|
{
|
||||||
$this->initConnect(true);
|
$this->initConnect(true);
|
||||||
|
|
||||||
if ($this->transTimes == 1) {
|
if (1 == $this->transTimes) {
|
||||||
$this->linkID->commit();
|
$this->linkID->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,7 +587,7 @@ abstract class Connection
|
|||||||
{
|
{
|
||||||
$this->initConnect(true);
|
$this->initConnect(true);
|
||||||
|
|
||||||
if ($this->transTimes == 1) {
|
if (1 == $this->transTimes) {
|
||||||
$this->linkID->rollBack();
|
$this->linkID->rollBack();
|
||||||
} elseif ($this->transTimes > 1 && $this->supportSavepoint()) {
|
} elseif ($this->transTimes > 1 && $this->supportSavepoint()) {
|
||||||
$this->linkID->exec(
|
$this->linkID->exec(
|
||||||
|
|||||||
Reference in New Issue
Block a user