1 | <?php |
||
9 | class RetryConnection implements Connection, ConnectionWrapper |
||
10 | { |
||
11 | use ConnectionWrapperTrait; |
||
12 | |||
13 | private $wrappedConnectionParams; |
||
14 | private $retryStrategy; |
||
15 | private $transactionLevel = 0; |
||
16 | |||
17 | use CallAndRetry; |
||
18 | |||
19 | public function __construct(Array $wrappedConnectionParams, RetryStrategy $retryStrategy) |
||
24 | |||
25 | /** |
||
26 | * Prepares a statement for execution and returns a Statement object. |
||
27 | * |
||
28 | * @param string $prepareString |
||
29 | * |
||
30 | * @return \Doctrine\DBAL\Driver\Statement |
||
31 | */ |
||
32 | public function prepare($prepareString) { |
||
39 | |||
40 | /** |
||
41 | * Executes an SQL statement, returning a result set as a Statement object. |
||
42 | * |
||
43 | * @return \Doctrine\DBAL\Driver\Statement |
||
44 | */ |
||
45 | public function query() { |
||
48 | |||
49 | /** |
||
50 | * Quotes a string for use in a query. |
||
51 | * |
||
52 | * @param string $input |
||
53 | * @param integer $type |
||
54 | * |
||
55 | * @return string |
||
56 | */ |
||
57 | public function quote($input, $type = \PDO::PARAM_STR) { |
||
60 | |||
61 | /** |
||
62 | * Executes an SQL statement and return the number of affected rows. |
||
63 | * |
||
64 | * @param string $statement |
||
65 | * |
||
66 | * @return integer |
||
67 | */ |
||
68 | public function exec($statement) { |
||
71 | |||
72 | /** |
||
73 | * Returns the ID of the last inserted row or sequence value. |
||
74 | * |
||
75 | * @param string|null $name |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | public function lastInsertId($name = null) { |
||
82 | |||
83 | /** |
||
84 | * Initiates a transaction. |
||
85 | * |
||
86 | * @return boolean TRUE on success or FALSE on failure. |
||
87 | */ |
||
88 | public function beginTransaction() { |
||
92 | |||
93 | /** |
||
94 | * Commits a transaction. |
||
95 | * |
||
96 | * @return boolean TRUE on success or FALSE on failure. |
||
97 | */ |
||
98 | public function commit() { |
||
102 | |||
103 | /** |
||
104 | * Rolls back the current transaction, as initiated by beginTransaction(). |
||
105 | * |
||
106 | * @return boolean TRUE on success or FALSE on failure. |
||
107 | */ |
||
108 | public function rollBack() { |
||
112 | |||
113 | /** |
||
114 | * Returns the error code associated with the last operation on the database handle. |
||
115 | * |
||
116 | * @return string|null The error code, or null if no operation has been run on the database handle. |
||
117 | */ |
||
118 | public function errorCode() { |
||
121 | |||
122 | /** |
||
123 | * Returns extended error information associated with the last operation on the database handle. |
||
124 | * |
||
125 | * @return array |
||
126 | */ |
||
127 | public function errorInfo() { |
||
130 | |||
131 | public function close() |
||
135 | |||
136 | public function transactionLevel() |
||
140 | |||
141 | private function callWrappedConnectionAndRetry($method, array $arguments) |
||
147 | |||
148 | protected function wrap() |
||
156 | } |
||
157 |