announce support pg

This commit is contained in:
xiaomlove
2026-04-18 12:15:14 +07:00
parent e3376c3f1b
commit 4afcb1bb08
9 changed files with 73 additions and 14 deletions
+16
View File
@@ -151,6 +151,11 @@ class NexusDB
return $this->driver->freeResult($result);
}
public function prepare(string $sql)
{
return $this->driver->prepare($sql);
}
public function isConnected()
{
return $this->isConnected;
@@ -506,4 +511,15 @@ class NexusDB
return compact('version', 'match', 'minVersion', 'dbType');
}
public static function unixTimestampField(string $field): string
{
if (self::isMysql()) {
return sprintf("UNIX_TIMESTAMP(%s)", $field);
} elseif (self::isPgsql()) {
return sprintf("EXTRACT(EPOCH FROM %s)", $field);
} else {
throw new \RuntimeException('Not supported database.');
}
}
}