Betriebsurlaub
This commit is contained in:
@@ -3,18 +3,32 @@
|
||||
if (!function_exists('vacationSyncTableExists')) {
|
||||
function vacationSyncTableExists(PDO $pdo, string $table): bool
|
||||
{
|
||||
$stmt = $pdo->prepare("SHOW TABLES LIKE :table_name");
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT COUNT(*)
|
||||
FROM information_schema.TABLES
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = :table_name"
|
||||
);
|
||||
$stmt->execute(['table_name' => $table]);
|
||||
return (bool)$stmt->fetchColumn();
|
||||
return (int)$stmt->fetchColumn() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('vacationSyncTableHasColumn')) {
|
||||
function vacationSyncTableHasColumn(PDO $pdo, string $table, string $column): bool
|
||||
{
|
||||
$stmt = $pdo->prepare("SHOW COLUMNS FROM `" . $table . "` LIKE :column_name");
|
||||
$stmt->execute(['column_name' => $column]);
|
||||
return (bool)$stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT COUNT(*)
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = :table_name
|
||||
AND COLUMN_NAME = :column_name"
|
||||
);
|
||||
$stmt->execute([
|
||||
'table_name' => $table,
|
||||
'column_name' => $column,
|
||||
]);
|
||||
return (int)$stmt->fetchColumn() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user