Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3924222
D2513.id6338.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
908 B
Referenced Files
None
Subscribers
None
D2513.id6338.diff
View Options
diff --git a/src/Engines/WithSQLite.php b/src/Engines/WithSQLite.php
new file mode 100644
--- /dev/null
+++ b/src/Engines/WithSQLite.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Keruald\Database\Engines;
+
+trait WithSQLite {
+
+ 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 type
+FROM sqlite_master
+WHERE TABLE_SCHEMA = "$escapedDatabase" AND TABLE_NAME = "$escapedView"
+EOF;
+
+ return $this->queryScalar($sql) === "VIEW";
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 12:30 (2 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2310621
Default Alt Text
D2513.id6338.diff (908 B)
Attached To
Mode
D2513: WIP: Support SQLite
Attached
Detach File
Event Timeline
Log In to Comment