protected SqlContentEntityStorageSchema::isTableEmpty($table_name)
Checks whether a database table is non-existent or empty.
Empty tables can be dropped and recreated without data loss.
string $table_name: The database table to check.
bool TRUE if the table is empty, FALSE otherwise.
protected function isTableEmpty($table_name) { return !$this->database->schema()->tableExists($table_name) || !$this->database->select($table_name) ->countQuery() ->range(0, 1) ->execute() ->fetchField(); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Sql!SqlContentEntityStorageSchema.php/function/SqlContentEntityStorageSchema::isTableEmpty/8.1.x