mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 18:24:57 +02:00
Add WireDatabasePDO tableExists() method
This commit is contained in:
@@ -593,6 +593,23 @@ class WireDatabasePDO extends Wire implements WireDatabase {
|
|||||||
return $tables;
|
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?
|
* Is the given string a database comparison operator?
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user