mirror of
https://github.com/friendica/friendica
synced 2024-12-26 13:04:38 +01:00
Changed:
- DBA::exists() should only be used for checking if records exists. - if you want to check if a table exists, please ALWAYS use DBStructure::existsTable() instead
This commit is contained in:
parent
cc750d743b
commit
6743de63f5
3 changed files with 2 additions and 6 deletions
|
@ -218,8 +218,8 @@ class DBA
|
||||||
/**
|
/**
|
||||||
* Check if data exists
|
* Check if data exists
|
||||||
*
|
*
|
||||||
* @param string|array $table Table name or array [schema => table]
|
* @param string|array $table Table name or array [schema => table]
|
||||||
* @param array $condition array of fields for condition
|
* @param array $condition array of fields for condition
|
||||||
* @return boolean Are there rows for that condition?
|
* @return boolean Are there rows for that condition?
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -55,9 +55,6 @@ class DBATest extends DatabaseTest
|
||||||
self::assertTrue(DBA::exists('config', []));
|
self::assertTrue(DBA::exists('config', []));
|
||||||
self::assertFalse(DBA::exists('notable', []));
|
self::assertFalse(DBA::exists('notable', []));
|
||||||
|
|
||||||
self::assertTrue(DBA::exists('config', null));
|
|
||||||
self::assertFalse(DBA::exists('notable', null));
|
|
||||||
|
|
||||||
self::assertTrue(DBA::exists('config', ['k' => 'hostname']));
|
self::assertTrue(DBA::exists('config', ['k' => 'hostname']));
|
||||||
self::assertFalse(DBA::exists('config', ['k' => 'nonsense']));
|
self::assertFalse(DBA::exists('config', ['k' => 'nonsense']));
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,6 @@ class DBStructureTest extends DatabaseTest
|
||||||
*/
|
*/
|
||||||
public function testExists() {
|
public function testExists() {
|
||||||
self::assertTrue(DBStructure::existsTable('config'));
|
self::assertTrue(DBStructure::existsTable('config'));
|
||||||
|
|
||||||
self::assertFalse(DBStructure::existsTable('notatable'));
|
self::assertFalse(DBStructure::existsTable('notatable'));
|
||||||
|
|
||||||
self::assertTrue(DBStructure::existsColumn('config', ['k']));
|
self::assertTrue(DBStructure::existsColumn('config', ['k']));
|
||||||
|
|
Loading…
Reference in a new issue