@@ -173,7 +173,7 @@ |
||
173 | 173 | |
174 | 174 | public function setLastConnection($id) |
175 | 175 | { |
176 | - uksort($this->connections, function ($a, $b) use ($id) { |
|
176 | + uksort($this->connections, function($a, $b) use ($id) { |
|
177 | 177 | if ($a === $id) return 1; |
178 | 178 | if ($b === $id) return -1; |
179 | 179 | return 0; |
@@ -174,8 +174,12 @@ |
||
174 | 174 | public function setLastConnection($id) |
175 | 175 | { |
176 | 176 | uksort($this->connections, function ($a, $b) use ($id) { |
177 | - if ($a === $id) return 1; |
|
178 | - if ($b === $id) return -1; |
|
177 | + if ($a === $id) { |
|
178 | + return 1; |
|
179 | + } |
|
180 | + if ($b === $id) { |
|
181 | + return -1; |
|
182 | + } |
|
179 | 183 | return 0; |
180 | 184 | }); |
181 | 185 | } |
@@ -108,7 +108,7 @@ |
||
108 | 108 | * |
109 | 109 | * @param $query |
110 | 110 | * @param Connection|null $connection |
111 | - * @return mixed |
|
111 | + * @return null|Result |
|
112 | 112 | */ |
113 | 113 | public function query($query, Connection $connection = null) |
114 | 114 | { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | public function connect($server = null, $username = null, $password = null, $newLink = false, $clientFlags = 0) |
48 | 48 | { |
49 | - if ($server === null) $server = ini_get("mysql.default_host"); |
|
49 | + if ($server === null) $server = ini_get("mysql.default_host"); |
|
50 | 50 | if ($username === null) $username = ini_get("mysql.default_user"); |
51 | 51 | if ($password === null) $password = ini_get("mysql.default_password"); |
52 | 52 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | $escaped = $connection->quote($unescapedString); |
284 | 284 | // Hack! |
285 | - if ($escaped[0] === "'" && $escaped[strlen($escaped)-1] === "'") { |
|
285 | + if ($escaped[0] === "'" && $escaped[strlen($escaped) - 1] === "'") { |
|
286 | 286 | return substr($escaped, 1, -1); |
287 | 287 | } |
288 | 288 |
@@ -46,9 +46,15 @@ |
||
46 | 46 | |
47 | 47 | public function connect($server = null, $username = null, $password = null, $newLink = false, $clientFlags = 0) |
48 | 48 | { |
49 | - if ($server === null) $server = ini_get("mysql.default_host"); |
|
50 | - if ($username === null) $username = ini_get("mysql.default_user"); |
|
51 | - if ($password === null) $password = ini_get("mysql.default_password"); |
|
49 | + if ($server === null) { |
|
50 | + $server = ini_get("mysql.default_host"); |
|
51 | + } |
|
52 | + if ($username === null) { |
|
53 | + $username = ini_get("mysql.default_user"); |
|
54 | + } |
|
55 | + if ($password === null) { |
|
56 | + $password = ini_get("mysql.default_password"); |
|
57 | + } |
|
52 | 58 | |
53 | 59 | // @todo: implement $newLInk and $clientFlags |
54 | 60 |
@@ -46,6 +46,11 @@ discard block |
||
46 | 46 | return $connection->close(); |
47 | 47 | } |
48 | 48 | |
49 | + /** |
|
50 | + * @param string $server |
|
51 | + * @param string $username |
|
52 | + * @param string $password |
|
53 | + */ |
|
49 | 54 | public function connect($server = null, $username = null, $password = null, $newLink = false, $clientFlags = 0) |
50 | 55 | { |
51 | 56 | if ($server === null) $server = ini_get("mysql.default_host"); |
@@ -314,6 +319,9 @@ discard block |
||
314 | 319 | // @todo |
315 | 320 | } |
316 | 321 | |
322 | + /** |
|
323 | + * @param string $query |
|
324 | + */ |
|
317 | 325 | public function query($query, Connection $linkIdentifier = null) |
318 | 326 | { |
319 | 327 | $connection = $this->manager->getOpenConnectionOrFail($linkIdentifier); |
@@ -347,6 +355,9 @@ discard block |
||
347 | 355 | return $row[$field]; |
348 | 356 | } |
349 | 357 | |
358 | + /** |
|
359 | + * @param string $databaseName |
|
360 | + */ |
|
350 | 361 | public function selectDb($databaseName, Connection $linkIdentifier = null) |
351 | 362 | { |
352 | 363 | $connection = $this->manager->getOpenConnectionOrFail($linkIdentifier); |