From bbbd60f1f590cab19bbbee7198059e0bba9acbb4 Mon Sep 17 00:00:00 2001 From: lsces Date: Mon, 2 Mar 2026 18:24:25 +0000 Subject: A little bit of hacking of the delete functions but these really need a more generic solution. The hack is to get various joins working for webtrees but it would be more flexible if I could rework the joins to allow where not exists() to work. --- src/Query/Grammars/FirebirdGrammar.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Query/Grammars/FirebirdGrammar.php b/src/Query/Grammars/FirebirdGrammar.php index 50cf731..0cde76f 100755 --- a/src/Query/Grammars/FirebirdGrammar.php +++ b/src/Query/Grammars/FirebirdGrammar.php @@ -86,7 +86,7 @@ class FirebirdGrammar extends Grammar */ public function compileDelete(Builder $query) { - if (isset($query->joins) || isset($query->limit)) { + if (isset($query->joins) ) { // || isset($query->limit)) { return $this->compileDeleteWithJoinsOrLimit($query); } @@ -102,12 +102,15 @@ class FirebirdGrammar extends Grammar protected function compileDeleteWithJoinsOrLimit(Builder $query) { $table = $this->wrapTable($query->from); - $alias = last(preg_split('/\s+as\s+/i', $query->from)); - - $selectSql = $this->compileSelect($query->select($alias.'.p_id')); - - return "delete from {$table} where {$this->wrap('p_id')} in ({$selectSql})"; + switch ($alias) { + case 'block_setting' : $field = 'block_id'; break; + case 'places' : $field = 'p_id'; break; + default : $field = $alias.'_id'; + } + $selectSql = $this->compileSelect($query->select($alias.'.'.$field)); + + return "delete from {$table} where {$this->wrap($field)} in ({$selectSql})"; } /** -- cgit v1.3