Skip to content

Commit 919c301

Browse files
author
hetao
committed
修复php返回int为string类型,同时删除不用的mysql_xxx方法
1 parent 43e4cff commit 919c301

4 files changed

Lines changed: 5 additions & 104 deletions

File tree

‎plugins/db/Db.php‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,7 @@ private function __query($sql, $retry=false){
346346
}
347347
//Connect
348348
if(!isset(Db::$_globals[$this->_key])){
349-
if($this->_engine_name == "mysql"){
350-
require_once(SLIGHTPHP_PLUGINS_DIR."/db/DbMysql.php");
351-
$this->engine = new \SlightPHP\DbMysql($this->params);
352-
}elseif($this->_engine_name =="mysqli"){
349+
if($this->_engine_name == "mysql" || $this->_engine_name =="mysqli"){
353350
require_once(SLIGHTPHP_PLUGINS_DIR."/db/DbMysqli.php");
354351
$this->engine = new \SlightPHP\DbMysqli($this->params);
355352
}else{

‎plugins/db/DbMysql.php‎

Lines changed: 0 additions & 99 deletions
This file was deleted.

‎plugins/db/DbMysqli.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public function connect(){
6262
if($this->_mysqli->connect_errno){
6363
return false;
6464
}
65+
$this->_mysqli->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE,true);
6566
if(!empty($this->_charset)){
6667
$this->_mysqli->query("SET NAMES ".$this->_charset);
6768
}

‎plugins/db/DbPDO.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ public function connect(){
6868
$this->_user,
6969
$this->_password,
7070
array(
71-
\PDO::ATTR_PERSISTENT => $this->_persistent
71+
\PDO::ATTR_PERSISTENT => $this->_persistent,
72+
\PDO::ATTR_STRINGIFY_FETCHES => false,
73+
\PDO::ATTR_EMULATE_PREPARES => false,
7274
)
7375
);
7476
}catch(\PDOException $e){

0 commit comments

Comments
 (0)