mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-29 10:49:22 +02:00
Add $db->hasTableAndColumns($table, $columns), credits to @opentibiabr Team
This commit is contained in:
parent
1708a48186
commit
9c15c2fa68
@ -220,6 +220,19 @@ class OTS_DB_MySQL extends OTS_Base_DB
|
|||||||
return $this->hasTable($table) && ($this->has_column_cache[$table . '.' . $column] = count($this->query('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $column . "'")->fetchAll()) > 0);
|
return $this->hasTable($table) && ($this->has_column_cache[$table . '.' . $column] = count($this->query('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $column . "'")->fetchAll()) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasTableAndColumns(string $table, array $columns = []): bool
|
||||||
|
{
|
||||||
|
if (!$this->hasTable($table)) return false;
|
||||||
|
|
||||||
|
foreach ($columns as $column) {
|
||||||
|
if (!$this->hasColumn($table, $column)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function revalidateCache() {
|
public function revalidateCache() {
|
||||||
foreach($this->has_table_cache as $key => $value) {
|
foreach($this->has_table_cache as $key => $value) {
|
||||||
$this->hasTableInternal($key);
|
$this->hasTableInternal($key);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user