Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3764750
D2513.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.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
Sat, Nov 23, 08:05 (13 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2257542
Default Alt Text
D2513.diff (908 B)
Attached To
Mode
D2513: WIP: Support SQLite
Attached
Detach File
Event Timeline
Log In to Comment