-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b136d87
commit 1101205
Showing
37 changed files
with
557 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
namespace Staudenmeir\LaravelAdjacencyList\Query\Grammars; | ||
|
||
use HarryGulliford\Firebird\Query\Grammars\FirebirdGrammar as Base; | ||
use Illuminate\Database\Query\Builder; | ||
|
||
class FirebirdGrammar extends Base implements ExpressionGrammar | ||
{ | ||
use OrdersByPath; | ||
|
||
public function compileInitialPath($column, $alias) | ||
{ | ||
return 'cast(' . $this->wrap($column) . ' as varchar(8191)) as ' . $this->wrap($alias); | ||
} | ||
|
||
public function compileRecursivePath($column, $alias, bool $reverse = false) | ||
{ | ||
$wrappedColumn = $this->wrap($column); | ||
$wrappedAlias = $this->wrap($alias); | ||
$placeholder = 'cast(? as varchar(8191))'; | ||
|
||
return $reverse ? "($wrappedColumn || $placeholder || $wrappedAlias)" : "($wrappedAlias || $placeholder || $wrappedColumn)"; | ||
} | ||
|
||
public function getRecursivePathBindings($separator) | ||
{ | ||
return [$separator]; | ||
} | ||
|
||
public function selectPathList(Builder $query, $expression, $column, $pathSeparator, $listSeparator) | ||
{ | ||
return $query->selectRaw( | ||
'list(' . $this->wrap($column) . ", '$listSeparator')" | ||
)->from($expression); | ||
} | ||
|
||
public function compilePivotColumnNullValue(string $type, int $precision, int $scale): string | ||
{ | ||
return 'null'; | ||
} | ||
|
||
public function compileCycleDetection(string $localKey, string $path): string | ||
{ | ||
$localKey = $this->wrap($localKey); | ||
$path = $this->wrap($path); | ||
|
||
return "position($localKey || ?, $path) > 0 or position(? || $localKey || ?, $path) > 0"; | ||
} | ||
|
||
public function getCycleDetectionBindings(string $pathSeparator): array | ||
{ | ||
return [$pathSeparator, $pathSeparator, $pathSeparator]; | ||
} | ||
|
||
public function compileCycleDetectionInitialSelect(string $column): string | ||
{ | ||
return 'false as ' . $this->wrap($column); | ||
} | ||
|
||
public function compileCycleDetectionRecursiveSelect(string $sql, string $column): string | ||
{ | ||
return $sql; | ||
} | ||
|
||
public function compileCycleDetectionStopConstraint(string $column): string | ||
{ | ||
return 'not ' . $this->wrap($column); | ||
} | ||
|
||
public function supportsUnionInRecursiveExpression(): bool | ||
{ | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.