Class SessionState (0.18.1)

public class SessionState

SessionState contains all session variables for a connection.

Inheritance

java.lang.Object > SessionState

Constructors

SessionState(OptionsMetadata options)

public SessionState(OptionsMetadata options)
Parameter
NameDescription
optionsOptionsMetadata

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.

Returns
TypeDescription
String

get(String extension, String name)

public PGSetting get(String extension, String name)

Returns the current value of the specified setting.

Parameters
NameDescription
extensionString
nameString
Returns
TypeDescription
PGSetting

getAll()

public List<PGSetting> getAll()

Returns all settings and their current values.

Returns
TypeDescription
List<PGSetting>

getDdlTransactionMode()

public OptionsMetadata.DdlTransactionMode getDdlTransactionMode()

Returns the DdlTransactionMode that is used for this connection at this time.

Returns
TypeDescription
OptionsMetadata.DdlTransactionMode

getServerVersion()

public String getServerVersion()

Returns the PostgreSQL version.

Returns
TypeDescription
String

getTimezone()

public ZoneId getTimezone()

Returns the ZoneId of the current timezone for this session.

Returns
TypeDescription
ZoneId

isForceAutocommit()

public boolean isForceAutocommit()

Returns whether transaction statements should be ignored and all statements should be executed in autocommit mode.

Returns
TypeDescription
boolean

isReplacePgCatalogTables()

public boolean isReplacePgCatalogTables()

Returns the current setting for replacing pg_catalog tables with common table expressions.

Returns
TypeDescription
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.

Parameters
NameDescription
extensionString
nameString
settingString

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.

Parameters
NameDescription
extensionString
nameString
valueString

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.

Parameters
NameDescription
extensionString
nameString
settingString