PostgreSQLConnection class

Instances of this class connect to and communicate with a PostgreSQL database.

The primary type of this library, a connection is responsible for connecting to databases and executing queries. A connection may be opened with open after it is created.

Implemented types

Constructors

PostgreSQLConnection(String host, int port, String databaseName, {Encoding encoding = utf8, String? username, String? password, int timeoutInSeconds = 30, int queryTimeoutInSeconds = 30, Object timeZone = 'UTC', bool useSSL = false, bool isUnixSocket = false, bool allowClearTextPassword = false, ReplicationMode replicationMode = ReplicationMode.none})
Creates an instance of PostgreSQLConnection.

Properties

allowClearTextPassword → bool
If true, allows password in clear text for authentication.
final
databaseName → String
Name of database this connection refers to.
final
encoding → Encoding
dataBase charset
final
hashCode → int
The hash code for this object.
no setterinherited
host → String
Hostname of database this connection refers to.
final
isClosed → bool
Reports on the latest known status of the connection: whether it was open or failed for some reason.
no setter
isUnixSocket → bool
If true, connection is made via unix socket.
final
messages → Stream<ServerMessage>
Stream of server messages
no setter
notifications → Stream<Notification>
Stream of notification from the database.
no setter
password → String?
Password for authenticating this connection.
final
port → int
Port of database this connection refers to.
final
processID → int
The processID of this backend.
no setter
queryTimeoutInSeconds → int
The default timeout for PostgreSQLExecutionContext's execute and query methods.
final
queueSize → int
Returns this context queue size
no setterinherited
replicationMode → ReplicationMode
The replication mode for connecting in streaming replication mode.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
settings → Map<String, String>
Settings values from the connected database.
final
socket → Socket?
no setter
timeoutInSeconds → int
The amount of time this connection will wait during connecting before giving up.
final
timeZone ↔ TimeZoneSettings
The timeZone of this connection for date operations that don't specify a timeZone.
getter/setter pair
username → String?
Username for authenticating this connection.
final
useSSL → bool
Whether or not this connection should connect securely.
final

Methods

addMessage(ClientMessage message) → void
Adds a Client Message to the existing connection
cancelTransaction({String? reason}) → void
Cancels a transaction on this context.
override
close() → Future
Closes a connection.
execute(String fmtString, {dynamic substitutionValues = const <String, dynamic>{}, int? timeoutInSeconds, PlaceholderIdentifier placeholderIdentifier = PlaceholderIdentifier.atSign}) → Future<int>
Executes a query on this context.
inherited
mappedResultsQuery(String fmtString, {dynamic substitutionValues = const <String, dynamic>{}, bool? allowReuse, int? timeoutInSeconds, PlaceholderIdentifier placeholderIdentifier = PlaceholderIdentifier.atSign}) → Future<List<Map<String, Map<String, dynamic>>>>
Executes a query on this connection and returns each row as a Map.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open() → Future
Establishes a connection with a PostgreSQL database.
query(String fmtString, {dynamic substitutionValues, bool? allowReuse, int? timeoutInSeconds, bool? useSimpleQueryProtocol, PlaceholderIdentifier placeholderIdentifier = PlaceholderIdentifier.atSign}) → Future<PostgreSQLResult>
Break change
inherited
queryAsMap(String fmtString, {dynamic substitutionValues = const <String, dynamic>{}, bool? allowReuse, int? timeoutInSeconds, PlaceholderIdentifier placeholderIdentifier = PlaceholderIdentifier.atSign}) → Future<List<Map<String, dynamic>>>
Executes a query on this connection and returns each row as a Map.
inherited
toString() → String
A string representation of this object.
inherited
transaction(Future queryBlock(PostgreSQLExecutionContext connection), {int? commitTimeoutInSeconds}) → Future
Executes a series of queries inside a transaction on this connection.

Operators

operator ==(Object other) → bool
The equality operator.
inherited