Skip to content

Commit 4e14cc7

Browse files
committed
Add compileExists grammar
1 parent 8e1c1c2 commit 4e14cc7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Query/Grammars/DB2Grammar.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,21 @@ protected function compileOffset(Builder $query, $offset)
179179
return '';
180180
}
181181

182+
/**
183+
* Compile an exists statement into SQL.
184+
*
185+
* @param \Illuminate\Database\Query\Builder $query
186+
* @return string
187+
*/
188+
public function compileExists(Builder $query)
189+
{
190+
$existsQuery = clone $query;
191+
192+
$existsQuery->columns = [];
193+
194+
return $this->compileSelect($existsQuery->selectRaw('1')->limit(1));
195+
}
196+
182197
/**
183198
* Get the format for database stored dates.
184199
*

0 commit comments

Comments
 (0)