Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 24 |
|
0.00% |
0 / 9 |
CRAP | |
0.00% |
0 / 1 |
| PDOTrait | |
0.00% |
0 / 24 |
|
0.00% |
0 / 9 |
272 | |
0.00% |
0 / 1 |
| setPDOAccess | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getPDOAccess | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| query | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| exec | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| prepare | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| beginTransaction | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| commit | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| rollBack | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| inTransaction | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BO\Zmsdldb\Importer; |
| 4 | |
| 5 | use BO\Zmsdldb\PDOAccess; |
| 6 | |
| 7 | trait PDOTrait |
| 8 | { |
| 9 | protected $pdoAccess; |
| 10 | |
| 11 | public function setPDOAccess(PDOAccess $pdoAccess): self |
| 12 | { |
| 13 | $this->pdoAccess = $pdoAccess; |
| 14 | return $this; |
| 15 | } |
| 16 | |
| 17 | public function getPDOAccess(): PDOAccess |
| 18 | { |
| 19 | return $this->pdoAccess; |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * parameters see https://www.php.net/manual/de/pdo.query.php |
| 24 | */ |
| 25 | public function query(...$args) |
| 26 | { |
| 27 | try { |
| 28 | return $this->getPDOAccess()->query(...$args); |
| 29 | } catch (\Exception $e) { |
| 30 | throw $e; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * parameters see https://www.php.net/manual/de/pdo.exec.php |
| 36 | */ |
| 37 | |
| 38 | public function exec(...$args) |
| 39 | { |
| 40 | try { |
| 41 | return $this->getPDOAccess()->exec(...$args); |
| 42 | } catch (\Exception $e) { |
| 43 | throw $e; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * parameters see https://www.php.net/manual/de/pdo.prepare.php |
| 49 | */ |
| 50 | public function prepare(...$args) |
| 51 | { |
| 52 | try { |
| 53 | return $this->getPDOAccess()->prepare(...$args); |
| 54 | } catch (\Exception $e) { |
| 55 | throw $e; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | public function beginTransaction() |
| 60 | { |
| 61 | try { |
| 62 | return $this->getPDOAccess()->beginTransaction(); |
| 63 | } catch (\Exception $e) { |
| 64 | throw $e; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | public function commit() |
| 69 | { |
| 70 | try { |
| 71 | return $this->getPDOAccess()->commit(); |
| 72 | } catch (\Exception $e) { |
| 73 | throw $e; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | public function rollBack() |
| 78 | { |
| 79 | try { |
| 80 | return $this->getPDOAccess()->rollBack(); |
| 81 | } catch (\Exception $e) { |
| 82 | throw $e; |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | public function inTransaction() |
| 87 | { |
| 88 | try { |
| 89 | return $this->getPDOAccess()->inTransaction(); |
| 90 | } catch (\Exception $e) { |
| 91 | throw $e; |
| 92 | } |
| 93 | } |
| 94 | } |