1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 17:12:41 +00:00
Arsse/tests/lib/DatabaseDrivers/PostgreSQL.php

33 lines
1.3 KiB
PHP
Raw Normal View History

<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse\Test\DatabaseDrivers;
use JKingWeb\Arsse\Arsse;
trait PostgreSQL {
2022-01-11 22:54:02 +00:00
use PostgreSQLCommon;
protected static $implementation = "PostgreSQL";
protected static $backend = "PostgreSQL";
protected static $dbResultClass = \JKingWeb\Arsse\Db\PostgreSQL\Result::class;
protected static $dbStatementClass = \JKingWeb\Arsse\Db\PostgreSQL\Statement::class;
protected static $dbDriverClass = \JKingWeb\Arsse\Db\PostgreSQL\Driver::class;
protected static $stringOutput = true;
2020-03-01 20:16:50 +00:00
public static function dbInterface() {
$connString = \JKingWeb\Arsse\Db\PostgreSQL\Driver::makeConnectionString(false, Arsse::$conf->dbPostgreSQLUser, Arsse::$conf->dbPostgreSQLPass, Arsse::$conf->dbPostgreSQLDb, Arsse::$conf->dbPostgreSQLHost, Arsse::$conf->dbPostgreSQLPort, "");
if (function_exists("pg_connect") && $d = @pg_connect($connString, \PGSQL_CONNECT_FORCE_NEW)) {
foreach (\JKingWeb\Arsse\Db\PostgreSQL\Driver::makeSetupQueries(Arsse::$conf->dbPostgreSQLSchema) as $q) {
pg_query($d, $q);
}
return $d;
} else {
return;
}
}
}