1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 16:54:44 +02:00

Add WireDatabasePDO tableExists() method

This commit is contained in:
Ryan Cramer
2019-06-07 12:12:24 -04:00
parent 5235ab2a89
commit 08bea26a17

View File

@@ -593,6 +593,23 @@ class WireDatabasePDO extends Wire implements WireDatabase {
return $tables;
}
/**
* Does the given table exist in this database?
*
* #pw-group-custom
*
* @param string $table
* @return bool
* @since 3.0.133
*
*/
public function tableExists($table) {
$query = $this->prepare('SHOW TABLES LIKE ?');
$query->execute(array($table));
$result = $query->fetchColumn();
return !empty($result);
}
/**
* Is the given string a database comparison operator?
*