|
@@ -145,7 +145,7 @@ discard block |
|
|
block discarded – undo |
|
145
|
145
|
public function testCannotStablishConnection() |
|
146
|
146
|
{ |
|
147
|
147
|
$options = $this->options; |
|
148
|
|
- $options["dbhost"] = 'myserver'; // this server does not exists |
|
|
148
|
+ $options["dbhost"] = 'myserver'; // this server does not exists |
|
149
|
149
|
|
|
150
|
150
|
$conn = new MySQL($options); |
|
151
|
151
|
|
|
@@ -273,7 +273,7 @@ discard block |
|
|
block discarded – undo |
|
273
|
273
|
$this->assertEquals(2, $conn->getNumFields()); |
|
274
|
274
|
$this->assertEquals(0, $conn->getRowsAffected()); |
|
275
|
275
|
|
|
276
|
|
- $rowset = $conn->getArrayResult(); # array with results |
|
|
276
|
+ $rowset = $conn->getArrayResult(); # array with results |
|
277
|
277
|
$row = array_shift($rowset); |
|
278
|
278
|
|
|
279
|
279
|
$this->assertArrayHasKey("ID", $row); |
|
@@ -300,12 +300,12 @@ discard block |
|
|
block discarded – undo |
|
300
|
300
|
$conn->execute($sql); |
|
301
|
301
|
$rowcount = count($conn->getArrayResult()); |
|
302
|
302
|
|
|
303
|
|
- $this->assertTrue(($rowcount === 1)); # the row is available for now |
|
|
303
|
+ $this->assertTrue(($rowcount === 1)); # the row is available for now |
|
304
|
304
|
|
|
305
|
305
|
# properties modified by execute() method |
|
306
|
306
|
$this->assertEquals(1, $conn->getNumRows()); |
|
307
|
307
|
$this->assertEquals(2, $conn->getNumFields()); |
|
308
|
|
- $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
|
308
|
+ $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
309
|
309
|
|
|
310
|
310
|
$this->assertTrue($conn->commit()); |
|
311
|
311
|
|
|
@@ -314,7 +314,7 @@ discard block |
|
|
block discarded – undo |
|
314
|
314
|
$conn->execute($sql); |
|
315
|
315
|
$rowcount = count($conn->getArrayResult()); |
|
316
|
316
|
|
|
317
|
|
- $this->assertTrue(($rowcount === 1)); # the row is available |
|
|
317
|
+ $this->assertTrue(($rowcount === 1)); # the row is available |
|
318
|
318
|
} |
|
319
|
319
|
|
|
320
|
320
|
/** |
|
@@ -337,12 +337,12 @@ discard block |
|
|
block discarded – undo |
|
337
|
337
|
$conn->execute($sql); |
|
338
|
338
|
$rowcount = count($conn->getArrayResult()); |
|
339
|
339
|
|
|
340
|
|
- $this->assertTrue(($rowcount === 1)); # the row is available for now |
|
|
340
|
+ $this->assertTrue(($rowcount === 1)); # the row is available for now |
|
341
|
341
|
|
|
342
|
342
|
# properties modified by execute() method |
|
343
|
343
|
$this->assertEquals(1, $conn->getNumRows()); |
|
344
|
344
|
$this->assertEquals(2, $conn->getNumFields()); |
|
345
|
|
- $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
|
345
|
+ $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
346
|
346
|
|
|
347
|
347
|
$this->assertTrue($conn->rollback()); |
|
348
|
348
|
|
|
@@ -351,7 +351,7 @@ discard block |
|
|
block discarded – undo |
|
351
|
351
|
$conn->execute($sql); |
|
352
|
352
|
$rowcount = count($conn->getArrayResult()); |
|
353
|
353
|
|
|
354
|
|
- $this->assertNotTrue(($rowcount === 1)); # the row is not available |
|
|
354
|
+ $this->assertNotTrue(($rowcount === 1)); # the row is not available |
|
355
|
355
|
} |
|
356
|
356
|
|
|
357
|
357
|
/** |
|
@@ -383,12 +383,12 @@ discard block |
|
|
block discarded – undo |
|
383
|
383
|
$conn->execute($sql); |
|
384
|
384
|
$rowcount = count($conn->getArrayResult()); |
|
385
|
385
|
|
|
386
|
|
- $this->assertTrue(($rowcount === 4)); # the rows are available for now |
|
|
386
|
+ $this->assertTrue(($rowcount === 4)); # the rows are available for now |
|
387
|
387
|
|
|
388
|
388
|
# properties modified by execute() method |
|
389
|
389
|
$this->assertEquals(4, $conn->getNumRows()); |
|
390
|
390
|
$this->assertEquals(2, $conn->getNumFields()); |
|
391
|
|
- $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
|
391
|
+ $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
392
|
392
|
|
|
393
|
393
|
$this->assertTrue($conn->commit()); |
|
394
|
394
|
|
|
@@ -397,7 +397,7 @@ discard block |
|
|
block discarded – undo |
|
397
|
397
|
$conn->execute($sql); |
|
398
|
398
|
$rowcount = count($conn->getArrayResult()); |
|
399
|
399
|
|
|
400
|
|
- $this->assertTrue(($rowcount === 4)); # the row is available |
|
|
400
|
+ $this->assertTrue(($rowcount === 4)); # the row is available |
|
401
|
401
|
} |
|
402
|
402
|
|
|
403
|
403
|
/** |
|
@@ -429,12 +429,12 @@ discard block |
|
|
block discarded – undo |
|
429
|
429
|
$conn->execute($sql); |
|
430
|
430
|
$rowcount = count($conn->getArrayResult()); |
|
431
|
431
|
|
|
432
|
|
- $this->assertTrue(($rowcount === 4)); # the rows are available for now |
|
|
432
|
+ $this->assertTrue(($rowcount === 4)); # the rows are available for now |
|
433
|
433
|
|
|
434
|
434
|
# properties modified by execute() method |
|
435
|
435
|
$this->assertEquals(4, $conn->getNumRows()); |
|
436
|
436
|
$this->assertEquals(2, $conn->getNumFields()); |
|
437
|
|
- $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
|
437
|
+ $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
438
|
438
|
|
|
439
|
439
|
$this->assertTrue($conn->rollback()); |
|
440
|
440
|
|
|
@@ -443,7 +443,7 @@ discard block |
|
|
block discarded – undo |
|
443
|
443
|
$conn->execute($sql); |
|
444
|
444
|
$rowcount = count($conn->getArrayResult()); |
|
445
|
445
|
|
|
446
|
|
- $this->assertNotTrue(($rowcount === 4)); # the row is available |
|
|
446
|
+ $this->assertNotTrue(($rowcount === 4)); # the row is available |
|
447
|
447
|
} |
|
448
|
448
|
|
|
449
|
449
|
/** |
|
@@ -474,12 +474,12 @@ discard block |
|
|
block discarded – undo |
|
474
|
474
|
$conn->execute($sql); |
|
475
|
475
|
$rowcount = count($conn->getArrayResult()); |
|
476
|
476
|
|
|
477
|
|
- $this->assertTrue(($rowcount === 2)); # the rows are available for now |
|
|
477
|
+ $this->assertTrue(($rowcount === 2)); # the rows are available for now |
|
478
|
478
|
|
|
479
|
479
|
# properties modified by execute() method |
|
480
|
480
|
$this->assertEquals(2, $conn->getNumRows()); |
|
481
|
481
|
$this->assertEquals(2, $conn->getNumFields()); |
|
482
|
|
- $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
|
482
|
+ $this->assertEquals(0, $conn->getRowsAffected()); # nothing affected (autocommit = false) |
|
483
|
483
|
|
|
484
|
484
|
# ends the transaction |
|
485
|
485
|
$conn->endTransaction(); |
|
@@ -489,7 +489,7 @@ discard block |
|
|
block discarded – undo |
|
489
|
489
|
$conn->execute($sql); |
|
490
|
490
|
$rowcount = count($conn->getArrayResult()); |
|
491
|
491
|
|
|
492
|
|
- $this->assertTrue(($rowcount === 2)); # the row is available |
|
|
492
|
+ $this->assertTrue(($rowcount === 2)); # the row is available |
|
493
|
493
|
} |
|
494
|
494
|
|
|
495
|
495
|
/** |
|
@@ -533,7 +533,7 @@ discard block |
|
|
block discarded – undo |
|
533
|
533
|
$conn->execute($sql); |
|
534
|
534
|
$rowcount = count($conn->getArrayResult()); |
|
535
|
535
|
|
|
536
|
|
- $this->assertNotTrue(($rowcount === 0)); # the rows are not available |
|
|
536
|
+ $this->assertNotTrue(($rowcount === 0)); # the rows are not available |
|
537
|
537
|
|
|
538
|
538
|
# remove all work |
|
539
|
539
|
$conn->execute("DROP TABLE MYTABLE"); |