|
@@ -14,9 +14,11 @@ class MysqlCli |
|
@@ -14,9 +14,11 @@ class MysqlCli |
|
14
|
private int $period = 300;
|
14
|
private int $period = 300;
|
|
15
|
private int $lastReconnectTime = 0;
|
15
|
private int $lastReconnectTime = 0;
|
|
16
|
private $connectConfig = null;
|
16
|
private $connectConfig = null;
|
|
|
|
17
|
+ private $database = null;
|
|
17
|
|
18
|
|
|
18
|
public function __construct($host,$port,$database,$username,$password,$charset='utf8',$prefix='', $connectCount = 20)
|
19
|
public function __construct($host,$port,$database,$username,$password,$charset='utf8',$prefix='', $connectCount = 20)
|
|
19
|
{
|
20
|
{
|
|
|
|
21
|
+ $this->database = $database;
|
|
20
|
$this->prefix = $prefix;
|
22
|
$this->prefix = $prefix;
|
|
21
|
$this->connectConfig = [
|
23
|
$this->connectConfig = [
|
|
22
|
'host' => $host,
|
24
|
'host' => $host,
|
|
@@ -114,7 +116,7 @@ class MysqlCli |
|
@@ -114,7 +116,7 @@ class MysqlCli |
|
114
|
$data = $this->execute('SELECT', $sql);
|
116
|
$data = $this->execute('SELECT', $sql);
|
|
115
|
$newData = [];
|
117
|
$newData = [];
|
|
116
|
if (empty($col)) {
|
118
|
if (empty($col)) {
|
|
117
|
- $newsql = 'SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME="' . $this->parseTable($table) . '" ORDER BY `ORDINAL_POSITION` ASC';
|
119
|
+ $newsql = 'SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = "'.$this->database.'" AND TABLE_NAME="' . $this->parseTable($table) . '" ORDER BY `ORDINAL_POSITION` ASC';
|
|
118
|
$coldata = $this->execute('SELECT', $newsql);
|
120
|
$coldata = $this->execute('SELECT', $newsql);
|
|
119
|
if (!$coldata) {
|
121
|
if (!$coldata) {
|
|
120
|
return false;
|
122
|
return false;
|