@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | protected function initialize() |
32 | 32 | { |
33 | 33 | // Point类型支持 |
34 | - Query::extend('point', function ($query, $field, $value = null, $fun = 'GeomFromText', $type = 'POINT') { |
|
34 | + Query::extend('point', function($query, $field, $value = null, $fun = 'GeomFromText', $type = 'POINT') { |
|
35 | 35 | if (!is_null($value)) { |
36 | 36 | $query->data($field, ['point', $value, $fun, $type]); |
37 | 37 | } else { |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | protected function parseDsn($config) |
55 | 55 | { |
56 | 56 | if (!empty($config['socket'])) { |
57 | - $dsn = 'mysql:unix_socket=' . $config['socket']; |
|
57 | + $dsn = 'mysql:unix_socket='.$config['socket']; |
|
58 | 58 | } elseif (!empty($config['hostport'])) { |
59 | - $dsn = 'mysql:host=' . $config['hostname'] . ';port=' . $config['hostport']; |
|
59 | + $dsn = 'mysql:host='.$config['hostname'].';port='.$config['hostport']; |
|
60 | 60 | } else { |
61 | - $dsn = 'mysql:host=' . $config['hostname']; |
|
61 | + $dsn = 'mysql:host='.$config['hostname']; |
|
62 | 62 | } |
63 | - $dsn .= ';dbname=' . $config['database']; |
|
63 | + $dsn .= ';dbname='.$config['database']; |
|
64 | 64 | |
65 | 65 | if (!empty($config['charset'])) { |
66 | - $dsn .= ';charset=' . $config['charset']; |
|
66 | + $dsn .= ';charset='.$config['charset']; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return $dsn; |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | if (strpos($tableName, '.')) { |
84 | 84 | $tableName = str_replace('.', '`.`', $tableName); |
85 | 85 | } |
86 | - $tableName = '`' . $tableName . '`'; |
|
86 | + $tableName = '`'.$tableName.'`'; |
|
87 | 87 | } |
88 | 88 | |
89 | - $sql = 'SHOW COLUMNS FROM ' . $tableName; |
|
89 | + $sql = 'SHOW COLUMNS FROM '.$tableName; |
|
90 | 90 | $pdo = $this->query($sql, [], false, true); |
91 | 91 | $result = $pdo->fetchAll(PDO::FETCH_ASSOC); |
92 | 92 | $info = []; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function getTables($dbName = '') |
118 | 118 | { |
119 | - $sql = !empty($dbName) ? 'SHOW TABLES FROM ' . $dbName : 'SHOW TABLES '; |
|
119 | + $sql = !empty($dbName) ? 'SHOW TABLES FROM '.$dbName : 'SHOW TABLES '; |
|
120 | 120 | $pdo = $this->query($sql, [], false, true); |
121 | 121 | $result = $pdo->fetchAll(PDO::FETCH_ASSOC); |
122 | 122 | $info = []; |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | */ |
137 | 137 | protected function getExplain($sql) |
138 | 138 | { |
139 | - $pdo = $this->linkID->prepare("EXPLAIN " . $this->queryStr); |
|
139 | + $pdo = $this->linkID->prepare("EXPLAIN ".$this->queryStr); |
|
140 | 140 | |
141 | 141 | foreach ($this->bind as $key => $val) { |
142 | 142 | // 占位符 |
143 | - $param = is_int($key) ? $key + 1 : ':' . $key; |
|
143 | + $param = is_int($key) ? $key + 1 : ':'.$key; |
|
144 | 144 | |
145 | 145 | if (is_array($val)) { |
146 | 146 | if (PDO::PARAM_INT == $val[1] && '' === $val[0]) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | if (isset($result['extra'])) { |
164 | 164 | if (strpos($result['extra'], 'filesort') || strpos($result['extra'], 'temporary')) { |
165 | - $this->log('SQL:' . $this->queryStr . '[' . $result['extra'] . ']', 'warn'); |
|
165 | + $this->log('SQL:'.$this->queryStr.'['.$result['extra'].']', 'warn'); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 |