From 5c3f26c02cd5d04bb74c2c566a3072d29a502a8e Mon Sep 17 00:00:00 2001 From: Tigrov Date: Wed, 27 Sep 2023 17:45:48 +0700 Subject: [PATCH] Execute `Query` without `->from()` --- src/DQLQueryBuilder.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/DQLQueryBuilder.php b/src/DQLQueryBuilder.php index b0d2aa2..2496a35 100644 --- a/src/DQLQueryBuilder.php +++ b/src/DQLQueryBuilder.php @@ -60,6 +60,15 @@ public function selectExists(string $rawSql): string return 'SELECT CASE WHEN EXISTS(' . $rawSql . ') THEN 1 ELSE 0 END FROM DUAL'; } + public function buildFrom(array|null $tables, array &$params): string + { + if (empty($tables)) { + return 'FROM DUAL'; + } + + return parent::buildFrom($tables, $params); + } + protected function defaultExpressionBuilders(): array { return array_merge(