1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00
Arsse/tests/lib/DatabaseDrivers/PostgreSQL.php
J. King 1b80ad37bc Merge branch 'csfixer3'
Code style cleanup to mostly conform to PSR-12
2023-03-22 23:33:05 -04:00

33 lines
1.3 KiB
PHP

<?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 {
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;
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;
}
}
}