-
Notifications
You must be signed in to change notification settings - Fork 14
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
Showing
5 changed files
with
108 additions
and
10 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
58 changes: 58 additions & 0 deletions
58
src/lib/Persistence/Legacy/SharedGateway/DatabasePlatform/PostgresqlGateway.php
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,58 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Core\Persistence\Legacy\SharedGateway\DatabasePlatform; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Ibexa\Core\Persistence\Legacy\SharedGateway\Gateway; | ||
|
||
final class PostgresqlGateway implements Gateway | ||
{ | ||
/** @var \Doctrine\DBAL\Connection */ | ||
private $connection; | ||
|
||
public function __construct(Connection $connection) | ||
{ | ||
$this->connection = $connection; | ||
} | ||
|
||
public function getColumnNextIntegerValue( | ||
string $tableName, | ||
string $columnName, | ||
string $sequenceName | ||
): ?int { | ||
return null; | ||
} | ||
|
||
public function getLastInsertedId(string $sequenceName): int | ||
{ | ||
return (int)$this->connection->lastInsertId($sequenceName); | ||
} | ||
|
||
/** | ||
* Return a language sub select query for setName. | ||
* | ||
* The query generates the proper language mask at the runtime of the INSERT/UPDATE query | ||
* generated by setName. | ||
* | ||
* @see setName | ||
*/ | ||
public function getSetNameLanguageMaskSubQuery(): string | ||
{ | ||
return <<<SQL | ||
(SELECT | ||
CASE | ||
WHEN (initial_language_id = :language_id AND (language_mask & :language_id) <> 0 ) | ||
THEN (cast(:language_id as BIGINT) | 1) | ||
ELSE :language_id | ||
END | ||
FROM ezcontentobject | ||
WHERE id = :content_id) | ||
SQL; | ||
} | ||
} |
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