function PdoStore::getCurrentTimestampStatement
Provides an SQL function to get the current timestamp regarding the current connection's driver.
File
-
vendor/
symfony/ lock/ Store/ PdoStore.php, line 220
Class
- PdoStore
- PdoStore is a PersistingStoreInterface implementation using a PDO connection.
Namespace
Symfony\Component\Lock\StoreCode
private function getCurrentTimestampStatement() : string {
return match ($this->getDriver()) { 'mysql' => 'UNIX_TIMESTAMP()',
'sqlite' => 'strftime(\'%s\',\'now\')',
'pgsql' => 'CAST(EXTRACT(epoch FROM NOW()) AS INT)',
'oci' => '(SYSDATE - TO_DATE(\'19700101\',\'yyyymmdd\'))*86400 - TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone), 1, 3))*3600',
'sqlsrv' => 'DATEDIFF(s, \'1970-01-01\', GETUTCDATE())',
default => (string) time(),
};
}