public class SessionState
SessionState contains all session variables for a connection.
Constructors
SessionState(OptionsMetadata options)
public SessionState(OptionsMetadata options)
Name | Description |
options | OptionsMetadata |
Methods
commit()
public void commit()
Commits the current transaction and persists any changes to the settings (except local changes).
generatePGSettingsCte()
public String generatePGSettingsCte()
Generates a Common Table Expression that represents the pg_settings table. Note that the generated query adds two additional CTEs that could in theory hide existing user tables. It is however strongly recommended that user tables never start with 'pg_', as all system tables in PostgreSQL start with 'pg_' and 'pg_catalog' is by design always included in the search_path and is by default the first entry on the search_path. This means that user tables that start with 'pg_' always risk being hidden by user tables, unless pg_catalog has been explicitly added to the search_path after one or more user schemas.
Type | Description |
String |
get(String extension, String name)
public PGSetting get(String extension, String name)
Returns the current value of the specified setting.
Name | Description |
extension | String |
name | String |
Type | Description |
PGSetting |
getAll()
public List<PGSetting> getAll()
Returns all settings and their current values.
Type | Description |
List<PGSetting> |
getDdlTransactionMode()
public OptionsMetadata.DdlTransactionMode getDdlTransactionMode()
Returns the DdlTransactionMode that is used for this connection at this time.
Type | Description |
OptionsMetadata.DdlTransactionMode |
getServerVersion()
public String getServerVersion()
Returns the PostgreSQL version.
Type | Description |
String |
getTimezone()
public ZoneId getTimezone()
Returns the ZoneId of the current timezone for this session.
Type | Description |
ZoneId |
isForceAutocommit()
public boolean isForceAutocommit()
Returns whether transaction statements should be ignored and all statements should be executed in autocommit mode.
Type | Description |
boolean |
isReplacePgCatalogTables()
public boolean isReplacePgCatalogTables()
Returns the current setting for replacing pg_catalog tables with common table expressions.
Type | Description |
boolean |
resetAll()
public void resetAll()
Resets all values to their 'reset' value.
rollback()
public void rollback()
Rolls back the current transaction and abandons any pending changes to the settings.
set(String extension, String name, String setting)
public void set(String extension, String name, String setting)
Sets the value of the specified setting. The new value will be persisted if the current transaction is committed. The value will be lost if the transaction is rolled back.
Name | Description |
extension | String |
name | String |
setting | String |
setConnectionStartupValue(String extension, String name, String value)
public void setConnectionStartupValue(String extension, String name, String value)
Sets the value of the specified setting at connection startup.
Name | Description |
extension | String |
name | String |
value | String |
setLocal(String extension, String name, String setting)
public void setLocal(String extension, String name, String setting)
Sets the value of the specified setting for the current transaction. This value is lost when the transaction is committed or rolled back.
Name | Description |
extension | String |
name | String |
setting | String |