Skip to content

Commit a78a795

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: [Lock] Fix using fractional TTLs on all platforms [Lock] Fixes an issue with PostgreSQL when using fractional TTLs [Console][Table] Fix unnecessary wrapping disable detecting modified indexes with DBAL 4.3 [cache] RedisTrait::doFetch should use pipeline instead of mget for Relay\Cluster relax assertions for forward compatibility with Symfony 7.4 [Console][Table] Fix invalid UTF-8 due to text wrapping
2 parents ee6d96d + 538856c commit a78a795

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Store/DoctrineDbalStore.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,12 @@ private function getCurrentTimestampStatement(): string
251251
}
252252

253253
return match (true) {
254-
$platform instanceof \Doctrine\DBAL\Platforms\AbstractMySQLPlatform => 'UNIX_TIMESTAMP()',
255-
$platform instanceof $sqlitePlatformClass => 'strftime(\'%s\',\'now\')',
256-
$platform instanceof \Doctrine\DBAL\Platforms\PostgreSQLPlatform => 'CAST(EXTRACT(epoch FROM NOW()) AS INT)',
257-
$platform instanceof \Doctrine\DBAL\Platforms\OraclePlatform => '(SYSDATE - TO_DATE(\'19700101\',\'yyyymmdd\'))*86400 - TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone), 1, 3))*3600',
258-
$platform instanceof \Doctrine\DBAL\Platforms\SQLServerPlatform => 'DATEDIFF(s, \'1970-01-01\', GETUTCDATE())',
259-
default => (string) time(),
254+
$platform instanceof \Doctrine\DBAL\Platforms\AbstractMySQLPlatform => 'UNIX_TIMESTAMP(NOW(6))',
255+
$platform instanceof $sqlitePlatformClass => "(julianday('now') - 2440587.5) * 86400.0",
256+
$platform instanceof \Doctrine\DBAL\Platforms\PostgreSQLPlatform => 'CAST(EXTRACT(epoch FROM NOW()) AS DOUBLE PRECISION)',
257+
$platform instanceof \Doctrine\DBAL\Platforms\OraclePlatform => "(CAST(systimestamp AT TIME ZONE 'UTC' AS DATE) - DATE '1970-01-01') * 86400 + TO_NUMBER(TO_CHAR(systimestamp AT TIME ZONE 'UTC', 'SSSSS.FF'))",
258+
$platform instanceof \Doctrine\DBAL\Platforms\SQLServerPlatform => "CAST(DATEDIFF_BIG(ms, '1970-01-01', SYSUTCDATETIME()) AS FLOAT) / 1000.0",
259+
default => (new \DateTimeImmutable())->format('U.u'),
260260
};
261261
}
262262

Store/PdoStore.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,12 @@ private function getDriver(): string
220220
private function getCurrentTimestampStatement(): string
221221
{
222222
return match ($this->getDriver()) {
223-
'mysql' => 'UNIX_TIMESTAMP()',
224-
'sqlite' => 'strftime(\'%s\',\'now\')',
225-
'pgsql' => 'CAST(EXTRACT(epoch FROM NOW()) AS INT)',
226-
'oci' => '(SYSDATE - TO_DATE(\'19700101\',\'yyyymmdd\'))*86400 - TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone), 1, 3))*3600',
227-
'sqlsrv' => 'DATEDIFF(s, \'1970-01-01\', GETUTCDATE())',
228-
default => (string) time(),
223+
'mysql' => 'UNIX_TIMESTAMP(NOW(6))',
224+
'sqlite' => "(julianday('now') - 2440587.5) * 86400.0",
225+
'pgsql' => 'CAST(EXTRACT(epoch FROM NOW()) AS DOUBLE PRECISION)',
226+
'oci' => "(CAST(systimestamp AT TIME ZONE 'UTC' AS DATE) - DATE '1970-01-01') * 86400 + TO_NUMBER(TO_CHAR(systimestamp AT TIME ZONE 'UTC', 'SSSSS.FF'))",
227+
'sqlsrv' => "CAST(DATEDIFF_BIG(ms, '1970-01-01', SYSUTCDATETIME()) AS FLOAT) / 1000.0",
228+
default => (new \DateTimeImmutable())->format('U.u'),
229229
};
230230
}
231231

0 commit comments

Comments
 (0)