$query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
$result = $query->execute(array($uri));
$this->assertTrue((bool)$result);
- $row = $result->fetchRow();
- $this->assertArrayHasKey('carddata', $row);
- $this->assertEquals($carddata, $row['carddata']);
- $this->assertEquals(1, $result->numRows());
+ $rowset = $result->fetchAll();
+ $this->assertEquals(1, count($rowset));
+ $this->assertArrayHasKey('carddata', $rowset[0]);
+ $this->assertEquals($carddata, $rowset[0]['carddata']);
// Try to insert a new row
$result = OC_DB::insertIfNotExist('*PREFIX*'.$this->table2,
$query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
$result = $query->execute(array($uri));
$this->assertTrue((bool)$result);
- $row = $result->fetchRow();
- $this->assertArrayHasKey('carddata', $row);
// Test that previously inserted data isn't overwritten
- $this->assertEquals($carddata, $row['carddata']);
// And that a new row hasn't been inserted.
- $this->assertEquals(1, $result->numRows());
-
+ $rowset = $result->fetchAll();
+ $this->assertEquals(1, count($rowset));
+ $this->assertArrayHasKey('carddata', $rowset[0]);
+ $this->assertEquals($carddata, $rowset[0]['carddata']);
}
public function testUtf8Data() {
$this->assertTrue(\OC_Preferences::deleteKey('Deleteuser', 'deleteapp', 'deletekey'));
$query = \OC_DB::prepare('SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?');
$result = $query->execute(array('Deleteuser', 'deleteapp', 'deletekey'));
- $this->assertEquals(0, $result->numRows());
+ $this->assertEquals(0, count($result->fetchAll()));
}
public function testDeleteApp() {
$this->assertTrue(\OC_Preferences::deleteApp('Deleteuser', 'deleteapp'));
$query = \OC_DB::prepare('SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?');
$result = $query->execute(array('Deleteuser', 'deleteapp'));
- $this->assertEquals(0, $result->numRows());
+ $this->assertEquals(0, count($result->fetchAll()));
}
public function testDeleteUser() {
$this->assertTrue(\OC_Preferences::deleteUser('Deleteuser'));
$query = \OC_DB::prepare('SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?');
$result = $query->execute(array('Deleteuser'));
- $this->assertEquals(0, $result->numRows());
+ $this->assertEquals(0, count($result->fetchAll()));
}
public function testDeleteAppFromAllUsers() {
$this->assertTrue(\OC_Preferences::deleteAppFromAllUsers('someapp'));
$query = \OC_DB::prepare('SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `appid` = ?');
$result = $query->execute(array('someapp'));
- $this->assertEquals(0, $result->numRows());
+ $this->assertEquals(0, count($result->fetchAll()));
}
}