Total Complexity | 4 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class SqlServerGrammar extends Base |
||
8 | { |
||
9 | use CompilesViews; |
||
10 | |||
11 | /** |
||
12 | * Compile the query to drop a view. |
||
13 | * |
||
14 | * @param string $name |
||
15 | * @param bool $ifExists |
||
16 | * @return string |
||
17 | */ |
||
18 | 11 | public function compileDropView($name, $ifExists) |
|
19 | { |
||
20 | 11 | $ifExists = $ifExists ? 'if exists ('.$this->compileViewExists().') ' : ''; |
|
21 | |||
22 | 11 | return $ifExists.'drop view '.$this->wrapTable($name); |
|
23 | } |
||
24 | |||
25 | /** |
||
26 | * Compile the query to determine if a view exists. |
||
27 | * |
||
28 | * @return string |
||
29 | */ |
||
30 | 11 | public function compileViewExists() |
|
31 | { |
||
32 | 11 | return "select * from sys.objects where type = 'V' and name = ?"; |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * Compile the query to determine the column listing of a view. |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | 1 | public function compileViewColumnListing() |
|
43 | join sys.objects as objects on objects.object_id = columns.object_id |
||
44 | where objects.type = 'V' and objects.name = ?"; |
||
45 | } |
||
47 |