1 | <?php |
||
10 | class Zend1 implements AdapterInterface |
||
11 | { |
||
12 | private $connection; |
||
13 | private $options; |
||
14 | |||
15 | /** |
||
16 | * @param Options $options |
||
17 | * @param ZendDbAdapter $connection |
||
18 | */ |
||
19 | 119 | public function __construct(Options $options, ZendDbAdapter $connection) |
|
24 | |||
25 | /** |
||
26 | * @return ZendDbAdapter |
||
27 | */ |
||
28 | 114 | private function getConnection(): ZendDbAdapter |
|
32 | |||
33 | /** |
||
34 | * @return Options |
||
35 | */ |
||
36 | 15 | public function getOptions(): Options |
|
40 | |||
41 | 35 | public function beginTransaction(): void |
|
46 | |||
47 | 18 | public function commitTransaction(): void |
|
52 | |||
53 | 18 | public function rollbackTransaction(): void |
|
58 | |||
59 | 34 | public function isInTransaction(): bool |
|
65 | |||
66 | 31 | public function canHandleNestedTransaction(): bool |
|
67 | { |
||
68 | 31 | return false; |
|
69 | } |
||
70 | |||
71 | 108 | public function quoteIdentifier(string $columnName): string |
|
76 | |||
77 | 15 | public function executeInsertSQL(string $sql, array $params = array()) |
|
78 | { |
||
79 | 15 | $options = $this->getOptions(); |
|
80 | 15 | $this->executeSQL($sql, $params); |
|
81 | |||
82 | 15 | if (array_key_exists($options->getIdColumnName(), $params)) { |
|
83 | 2 | return $params[$options->getIdColumnName()]; |
|
84 | } else { |
||
85 | 13 | if ('' != $options->getSequenceName()) { |
|
86 | 13 | $lastGeneratedValue = $this->getConnection() |
|
87 | 13 | ->lastSequenceId($options->getSequenceName()); |
|
88 | } else { |
||
89 | $lastGeneratedValue = $this->getConnection() |
||
90 | ->lastInsertId(); |
||
91 | } |
||
92 | |||
93 | 13 | return $lastGeneratedValue; |
|
94 | } |
||
95 | } |
||
96 | |||
97 | 60 | public function executeSQL(string $sql, array $params = array()): void |
|
102 | |||
103 | 87 | public function executeSelectSQL(string $sql, array $params = array()): array |
|
109 | } |
||
110 |