@@ -45,6 +45,10 @@ |
||
45 | 45 | abstract protected function __raw(string $sql, string $index = null, bool $assoc = true); |
46 | 46 | abstract protected function __prepared(string $sql, array $values = [], string $index = null, bool $assoc = true); |
47 | 47 | abstract protected function __multi(string $sql, array $values); |
48 | + |
|
49 | + /** |
|
50 | + * @param callable $callback |
|
51 | + */ |
|
48 | 52 | abstract protected function __multi_callback(string $sql, array $data, $callback); |
49 | 53 | |
50 | 54 | /** |
@@ -12,10 +12,10 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\Database\Drivers; |
14 | 14 | |
15 | +use Psr\SimpleCache\CacheInterface; |
|
15 | 16 | use chillerlan\Database\DBException; |
16 | 17 | use chillerlan\Database\DBOptions; |
17 | 18 | use chillerlan\Database\DBResult; |
18 | -use Psr\SimpleCache\CacheInterface; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @see http://blog.mclaughlinsoftware.com/2010/02/21/php-binding-a-wildcard/ LIKE %...% -> LIKE CONCAT('%',?,'%') |
@@ -18,7 +18,7 @@ |
||
18 | 18 | use Psr\SimpleCache\CacheInterface; |
19 | 19 | |
20 | 20 | /** |
21 | - * @see http://blog.mclaughlinsoftware.com/2010/02/21/php-binding-a-wildcard/ LIKE %...% -> LIKE CONCAT('%',?,'%') |
|
21 | + * @see http://blog.mclaughlinsoftware.com/2010/02/21/php-binding-a-wildcard/ LIKE %...% -> LIKE CONCAT('%',?,'%') |
|
22 | 22 | */ |
23 | 23 | abstract class DBDriverAbstract implements DBDriverInterface{ |
24 | 24 |
@@ -14,7 +14,8 @@ |
||
14 | 14 | |
15 | 15 | use chillerlan\Database\DBException; |
16 | 16 | use chillerlan\Database\Drivers\{DBDriverAbstract, DBDriverInterface}; |
17 | -use PDO, PDOException, PDOStatement; |
|
17 | +use PDO; |
|
18 | +use PDOStatement; |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * |
@@ -161,16 +161,16 @@ |
||
161 | 161 | * |
162 | 162 | * @return void |
163 | 163 | */ |
164 | - protected function bindParams(PDOStatement &$stmt, array $values){ |
|
164 | + protected function bindParams(PDOStatement&$stmt, array $values){ |
|
165 | 165 | $param_no = 1; |
166 | 166 | |
167 | 167 | foreach($values as $v){ |
168 | 168 | |
169 | 169 | switch(gettype($v)){ |
170 | 170 | case 'boolean': $type = PDO::PARAM_BOOL; break; |
171 | - case 'integer': $type = PDO::PARAM_INT; break; |
|
171 | + case 'integer': $type = PDO::PARAM_INT; break; |
|
172 | 172 | case 'NULL' : $type = PDO::PARAM_NULL; break; |
173 | - default: $type = PDO::PARAM_STR; break; |
|
173 | + default: $type = PDO::PARAM_STR; break; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | $stmt->bindValue($param_no, $v, $type); |
@@ -12,11 +12,11 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\DatabaseTest\Drivers; |
14 | 14 | |
15 | -use chillerlan\Database\Drivers\DBDriverInterface; |
|
15 | +use Psr\SimpleCache\CacheInterface; |
|
16 | 16 | use chillerlan\DatabaseTest\TestAbstract; |
17 | +use chillerlan\Database\Drivers\DBDriverInterface; |
|
17 | 18 | use chillerlan\SimpleCache\Cache; |
18 | 19 | use chillerlan\SimpleCache\Drivers\MemoryCacheDriver; |
19 | -use Psr\SimpleCache\CacheInterface; |
|
20 | 20 | |
21 | 21 | abstract class DriverTestAbstract extends TestAbstract{ |
22 | 22 |
@@ -18,21 +18,21 @@ |
||
18 | 18 | */ |
19 | 19 | trait Magic{ |
20 | 20 | |
21 | - public function __get(string $name) { |
|
21 | + public function __get(string $name){ |
|
22 | 22 | return $this->get($name); |
23 | 23 | } |
24 | 24 | |
25 | - public function __set(string $name, $value) { |
|
25 | + public function __set(string $name, $value){ |
|
26 | 26 | $this->set($name, $value); |
27 | 27 | } |
28 | 28 | |
29 | - private function get(string $name) { |
|
29 | + private function get(string $name){ |
|
30 | 30 | $method = 'magic_get_'.$name; |
31 | 31 | |
32 | 32 | return method_exists($this, $method) ? $this->$method() : null; |
33 | 33 | } |
34 | 34 | |
35 | - private function set(string $name, $value) { |
|
35 | + private function set(string $name, $value){ |
|
36 | 36 | $method = 'magic_set_'.$name; |
37 | 37 | |
38 | 38 | if(method_exists($this, $method)){ |
@@ -18,21 +18,21 @@ |
||
18 | 18 | */ |
19 | 19 | trait Magic{ |
20 | 20 | |
21 | - public function __get(string $name) { |
|
21 | + public function __get(string $name){ |
|
22 | 22 | return $this->get($name); |
23 | 23 | } |
24 | 24 | |
25 | - public function __set(string $name, $value) { |
|
25 | + public function __set(string $name, $value){ |
|
26 | 26 | $this->set($name, $value); |
27 | 27 | } |
28 | 28 | |
29 | - private function get(string $name) { |
|
29 | + private function get(string $name){ |
|
30 | 30 | $method = 'magic_get_'.$name; |
31 | 31 | |
32 | 32 | return method_exists($this, $method) ? $this->$method() : null; |
33 | 33 | } |
34 | 34 | |
35 | - private function set(string $name, $value) { |
|
35 | + private function set(string $name, $value){ |
|
36 | 36 | $method = 'magic_set_'.$name; |
37 | 37 | |
38 | 38 | if(method_exists($this, $method)){ |