web-base/Core/Driver/SQL/Expression/CurrentTimeStamp.class.php

21 lines
509 B
PHP
Raw Normal View History

2021-04-08 19:08:05 +02:00
<?php
2022-11-18 18:06:46 +01:00
namespace Core\Driver\SQL\Expression;
2021-04-08 19:08:05 +02:00
use Core\Driver\SQL\MySQL;
use Core\Driver\SQL\PostgreSQL;
use Core\Driver\SQL\SQL;
use Exception;
2021-04-08 19:08:05 +02:00
class CurrentTimeStamp extends Expression {
function getExpression(SQL $sql, array &$params): string {
if ($sql instanceof MySQL) {
return "NOW()";
} else if ($sql instanceof PostgreSQL) {
return "CURRENT_TIMESTAMP";
} else {
throw new Exception("CurrentTimeStamp Not implemented for driver type: " . get_class($sql));
}
}
2021-04-08 19:08:05 +02:00
}