Browse Source

Test setting of schema name

microsub
J. King 6 years ago
parent
commit
93af381436
  1. 15
      lib/Db/PostgreSQL/Driver.php
  2. 1
      tests/lib/AbstractTest.php

15
lib/Db/PostgreSQL/Driver.php

@ -76,7 +76,8 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
"SET statement_timeout = '$timeout'", "SET statement_timeout = '$timeout'",
]; ];
if (strlen($schema) > 0) { if (strlen($schema) > 0) {
$out[] = 'SET search_path = \'"'.str_replace('"', '""', $schema).'", "$user", public\''; $schema = '"'.str_replace('"', '""', $schema).'"';
$out[] = "SET search_path = $schema, public";
} }
return $out; return $out;
} }
@ -92,11 +93,6 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
} }
} }
public static function driverName(): string {
return Arsse::$lang->msg("Driver.Db.PostgreSQL.Name");
}
public static function schemaID(): string { public static function schemaID(): string {
return "PostgreSQL"; return "PostgreSQL";
} }
@ -150,11 +146,18 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
public function __destruct() { public function __destruct() {
} }
/** @codeCoverageIgnore */
public static function driverName(): string {
return Arsse::$lang->msg("Driver.Db.PostgreSQL.Name");
}
/** @codeCoverageIgnore */
public static function requirementsMet(): bool { public static function requirementsMet(): bool {
// stub: native interface is not yet supported // stub: native interface is not yet supported
return false; return false;
} }
/** @codeCoverageIgnore */
protected function makeConnection(string $user, string $pass, string $db, string $host, int $port, string $service) { protected function makeConnection(string $user, string $pass, string $db, string $host, int $port, string $service) {
// stub: native interface is not yet supported // stub: native interface is not yet supported
throw new \Exception; throw new \Exception;

1
tests/lib/AbstractTest.php

@ -47,6 +47,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
'dbPostgreSQLUser' => "arsse_test", 'dbPostgreSQLUser' => "arsse_test",
'dbPostgreSQLPass' => "arsse_test", 'dbPostgreSQLPass' => "arsse_test",
'dbPostgreSQLDb' => "arsse_test", 'dbPostgreSQLDb' => "arsse_test",
'dbPostgreSQLSchema' => "arsse_test",
]; ];
Arsse::$conf = ($force ? null : Arsse::$conf) ?? (new Conf)->import($defaults)->import($conf); Arsse::$conf = ($force ? null : Arsse::$conf) ?? (new Conf)->import($defaults)->import($conf);
} }

Loading…
Cancel
Save