SilverStripe\PostgreSQL\PostgreSQLDatabase
PostgreSQL connector class.
Synopsis
class PostgreSQLDatabase
extends Database
{
- // constants
- const MASTER_DATABASE = 'postgres';
- const MASTER_SCHEMA = 'public';
- // members
- protected PostgreSQLSchemaManager $schemaManager;
- protected $schema;
- protected bool $transactionNesting = 0;
- protected bool $supportsTransactions = true;
- private static bool $allow_query_master_postgres = true;
- private static boolean $model_schema_as_database = true;
- private static string $search_language = 'english';
- private static string $default_fts_cluster_method = 'GIN';
- private static string $default_fts_search_method = '@@@';
- protected string $databaseOriginal = '';
- protected string $schemaOriginal = '';
- protected array $parameters = ;
- // methods
- public static string default_fts_cluster_method()
- public static string default_fts_search_method()
- public static bool allow_query_master_postgres()
- public static bool model_schema_as_database()
- public static string search_language()
- public void connect()
- protected void connectMaster()
- protected void connectDefault()
- public void selectTimezone()
- public void supportsCollations()
- public void supportsTimezoneOverride()
- public void getDatabaseServer()
- public string currentSchema()
- public boolean setSchema()
- public void setSchemaSearchPath()
- public PaginatedList searchEngine()
- public void supportsTransactions()
- public void supportsExtensions()
- public void transactionStart()
- public void transactionSavepoint()
- public void transactionRollback()
- public void transactionDepth()
- public void transactionEnd()
- public void comparisonClause()
- public string formattedDatetimeClause()
- public string datetimeIntervalClause()
- public string datetimeDifferenceClause()
- public void now()
- public void random()
- public string schemaToDatabaseName()
- public string databaseToSchemaName()
- public void dropSelectedDatabase()
- public void getSelectedDatabase()
- public void selectDatabase()
- public void clearTable()
Hierarchy
Extends
- SilverStripe\ORM\Connect\Database
Uses
- SilverStripe\Core\Config\Configurable
Tasks
Line | Task |
---|---|
368+ | Properly extract the search functions out of the core. |
375 | properly handle boolean operators here. |
Constants
Name | Value |
---|---|
MASTER_DATABASE | 'postgres' |
MASTER_SCHEMA | 'public' |
Members
private
- $allow_query_master_postgres
—
SilverStripe\PostgreSQL\bool
Determines whether to check a database exists on the host by querying the 'postgres' database and running createDatabase. - $default_fts_cluster_method
- $default_fts_search_method
-
$model_schema_as_database
For instances where multiple databases are used beyond the initial connection you may set this option to true to force database switches to switch schemas instead of using databases. This may be useful if the database user does not have cross-database permissions, and in cases where multiple databases are used (such as in running test cases). -
$search_language
Override the language that tsearch uses. By default it is 'english, but could be any of the supported languages that can be found in the pg_catalog.pg_ts_config table.
protected
- $databaseOriginal
—
string
The database name specified at initial connection - $parameters
—
array
Connection parameters specified at inital connection - $schema
—
string
The currently selected database schema name. - $schemaManager
—
SilverStripe\PostgreSQL\PostgreSQLSchemaManager
Database schema manager object - $schemaOriginal
—
string
The schema name specified at initial construction. When model_schema_as_database is set to true selecting the $databaseOriginal database will instead reset the schema to this - $supportsTransactions
—
SilverStripe\PostgreSQL\bool
Toggle if transactions are supported. Defaults to true. - $transactionNesting — SilverStripe\PostgreSQL\bool
Methods
protected
public
- allow_query_master_postgres() — Determines whether to check a database exists on the host by querying the 'postgres' database and running createDatabase.
- clearTable() — Delete all entries from the table instead of truncating it.
- comparisonClause()
- connect()
- currentSchema() — Returns the name of the current schema in use
- databaseToSchemaName() — Translates a requested database name to a schema name to substitute internally.
- datetimeDifferenceClause() — Function to return an SQL datetime expression that can be used with Postgres used for querying a datetime substraction
- datetimeIntervalClause() — Function to return an SQL datetime expression that can be used with Postgres used for querying a datetime addition
- default_fts_cluster_method() — Full text cluster method. (e.g. GIN or GiST)
- default_fts_search_method() — Full text search method.
- dropSelectedDatabase()
- formattedDatetimeClause() — Function to return an SQL datetime expression that can be used with Postgres used for querying a datetime in a certain format
- getDatabaseServer()
- getSelectedDatabase()
- model_schema_as_database() — For instances where multiple databases are used beyond the initial connection you may set this option to true to force database switches to switch schemas instead of using databases. This may be useful if the database user does not have cross-database permissions, and in cases where multiple databases are used (such as in running test cases).
- now()
- random()
- schemaToDatabaseName() — Determines the name of the current database to be reported externally by substituting the schema name for the database name.
- searchEngine() — The core search engine configuration.
- search_language() — Override the language that tsearch uses. By default it is 'english, but could be any of the supported languages that can be found in the pg_catalog.pg_ts_config table.
- selectDatabase()
- selectTimezone() — Sets the system timezone for the database connection
- setSchema() — Utility method to manually set the schema to an alternative Check existance & sets search path to the supplied schema name
- setSchemaSearchPath() — Override the schema search path. Search using the arguments supplied.
- supportsCollations()
- supportsExtensions()
- supportsTimezoneOverride()
- supportsTransactions()
- transactionDepth()
- transactionEnd()
- transactionRollback()
- transactionSavepoint()
- transactionStart()