- 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
/**
* Check if data exists
*
- * @param string|array $table Table name or array [schema => table]
- * @param array $condition array of fields for condition
+ * @param string|array $table Table name or array [schema => table]
+ * @param array $condition array of fields for condition
* @return boolean Are there rows for that condition?
* @throws \Exception
*/
self::assertTrue(DBA::exists('config', []));
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::assertFalse(DBA::exists('config', ['k' => 'nonsense']));
}
*/
public function testExists() {
self::assertTrue(DBStructure::existsTable('config'));
-
self::assertFalse(DBStructure::existsTable('notatable'));
self::assertTrue(DBStructure::existsColumn('config', ['k']));