|
@@ 156-171 (lines=16) @@
|
| 153 |
|
self::assertEquals(2, $id); |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
public function testReuseStatementWithParameterBoundByReference() |
| 157 |
|
{ |
| 158 |
|
$this->_conn->insert('stmt_test', array('id' => 1)); |
| 159 |
|
$this->_conn->insert('stmt_test', array('id' => 2)); |
| 160 |
|
|
| 161 |
|
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test WHERE id = ?'); |
| 162 |
|
$stmt->bindParam(1, $id); |
| 163 |
|
|
| 164 |
|
$id = 1; |
| 165 |
|
$stmt->execute(); |
| 166 |
|
self::assertEquals(1, $stmt->fetchColumn()); |
| 167 |
|
|
| 168 |
|
$id = 2; |
| 169 |
|
$stmt->execute(); |
| 170 |
|
self::assertEquals(2, $stmt->fetchColumn()); |
| 171 |
|
} |
| 172 |
|
|
| 173 |
|
public function testReuseStatementWithReboundValue() |
| 174 |
|
{ |
|
@@ 189-205 (lines=17) @@
|
| 186 |
|
self::assertEquals(2, $stmt->fetchColumn()); |
| 187 |
|
} |
| 188 |
|
|
| 189 |
|
public function testReuseStatementWithReboundParam() |
| 190 |
|
{ |
| 191 |
|
$this->_conn->insert('stmt_test', array('id' => 1)); |
| 192 |
|
$this->_conn->insert('stmt_test', array('id' => 2)); |
| 193 |
|
|
| 194 |
|
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test WHERE id = ?'); |
| 195 |
|
|
| 196 |
|
$x = 1; |
| 197 |
|
$stmt->bindParam(1, $x); |
| 198 |
|
$stmt->execute(); |
| 199 |
|
self::assertEquals(1, $stmt->fetchColumn()); |
| 200 |
|
|
| 201 |
|
$y = 2; |
| 202 |
|
$stmt->bindParam(1, $y); |
| 203 |
|
$stmt->execute(); |
| 204 |
|
self::assertEquals(2, $stmt->fetchColumn()); |
| 205 |
|
} |
| 206 |
|
|
| 207 |
|
/** |
| 208 |
|
* @dataProvider emptyFetchProvider |