1 | <?php |
||
10 | class RetryConnection implements Connection |
||
11 | { |
||
12 | private $wrappedConnectionParams; |
||
13 | private $retryStrategy; |
||
14 | private $transactionLevel = 0; |
||
15 | private $wrappedConnection; |
||
16 | private $wrappedDriver; |
||
17 | |||
18 | use CallAndRetry; |
||
19 | |||
20 | public function __construct(Array $wrappedConnectionParams, RetryStrategy $retryStrategy) |
||
25 | |||
26 | /** |
||
27 | * Prepares a statement for execution and returns a Statement object. |
||
28 | * |
||
29 | * @param string $prepareString |
||
30 | * |
||
31 | * @return \Doctrine\DBAL\Driver\Statement |
||
32 | */ |
||
33 | public function prepare($prepareString) { |
||
40 | |||
41 | /** |
||
42 | * Executes an SQL statement, returning a result set as a Statement object. |
||
43 | * |
||
44 | * @return \Doctrine\DBAL\Driver\Statement |
||
45 | * @throws \Exception |
||
46 | */ |
||
47 | public function query() { |
||
50 | |||
51 | /** |
||
52 | * Quotes a string for use in a query. |
||
53 | * |
||
54 | * @param string $input |
||
55 | * @param integer $type |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | public function quote($input, $type = \PDO::PARAM_STR) { |
||
62 | |||
63 | /** |
||
64 | * Executes an SQL statement and return the number of affected rows. |
||
65 | * |
||
66 | * @param string $statement |
||
67 | * |
||
68 | * @return integer |
||
69 | */ |
||
70 | public function exec($statement) { |
||
73 | |||
74 | /** |
||
75 | * Returns the ID of the last inserted row or sequence value. |
||
76 | * |
||
77 | * @param string|null $name |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | public function lastInsertId($name = null) { |
||
84 | |||
85 | /** |
||
86 | * Initiates a transaction. |
||
87 | * |
||
88 | * @return boolean TRUE on success or FALSE on failure. |
||
89 | */ |
||
90 | public function beginTransaction() { |
||
94 | |||
95 | /** |
||
96 | * Commits a transaction. |
||
97 | * |
||
98 | * @return boolean TRUE on success or FALSE on failure. |
||
99 | */ |
||
100 | public function commit() { |
||
104 | |||
105 | /** |
||
106 | * Rolls back the current transaction, as initiated by beginTransaction(). |
||
107 | * |
||
108 | * @return boolean TRUE on success or FALSE on failure. |
||
109 | */ |
||
110 | public function rollBack() { |
||
114 | |||
115 | /** |
||
116 | * Returns the error code associated with the last operation on the database handle. |
||
117 | * |
||
118 | * @return string|null The error code, or null if no operation has been run on the database handle. |
||
119 | */ |
||
120 | public function errorCode() { |
||
123 | |||
124 | /** |
||
125 | * Returns extended error information associated with the last operation on the database handle. |
||
126 | * |
||
127 | * @return array |
||
128 | */ |
||
129 | public function errorInfo() { |
||
132 | |||
133 | public function close() |
||
141 | |||
142 | public function transactionLevel() |
||
146 | |||
147 | /** |
||
148 | * @param $method |
||
149 | * @param array $arguments |
||
150 | * @return mixed |
||
151 | * @throws \Exception |
||
152 | */ |
||
153 | private function callWrappedConnectionAndRetry($method, array $arguments) |
||
159 | |||
160 | protected function wrap() |
||
168 | |||
169 | /** |
||
170 | * @inherit |
||
171 | * @return \Doctrine\DBAL\Driver\PDOConnection |
||
172 | */ |
||
173 | public function wrappedConnection() |
||
180 | |||
181 | public function wrappedDriver() |
||
188 | |||
189 | } |
||
190 |