Page MenuHomeDevCentral

WithMySQL.php
No OneTemporary

WithMySQL.php

<?php
namespace Keruald\Database\Engines;
trait WithMySQL {
public function isExistingTable (string $database, string $table) : bool {
$escapedTable = $this->escape($table);
$sql = "SHOW TABLE STATUS
FROM `$database`
WHERE Name = '$escapedTable'";
return $this->queryScalar($sql) === $table;
}
public function isView (string $database, string $view) : bool {
$escapedView = $this->escape($view);
$escapedDatabase = $this->escape($database);
$sql = <<<EOF
SELECT TABLE_TYPE
FROM information_schema.tables
WHERE TABLE_SCHEMA = "$escapedDatabase" AND TABLE_NAME = "$escapedView"
EOF;
return $this->queryScalar($sql) === "VIEW";
}
}

File Metadata

Mime Type
text/x-php
Expires
Thu, Sep 18, 19:00 (4 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2991311
Default Alt Text
WithMySQL.php (741 B)

Event Timeline