Answer the question
In order to leave comments, you need to log in
How is timeout in PostgreSQLConnection different from timeout in query?
@override
Future<PostgreSQLResult> query(
String fmtString, {
Map<String, dynamic> substitutionValues,
bool allowReuse,
int timeoutInSeconds,
}) =>
_query(
fmtString,
substitutionValues: substitutionValues,
allowReuse: allowReuse,
timeoutInSeconds: timeoutInSeconds,
);
class PostgreSQLConnection extends Object
with _PostgreSQLExecutionContextMixin
implements PostgreSQLExecutionContext {
/// Creates an instance of [PostgreSQLConnection].
///
/// [host] must be a hostname, e.g. "foobar.com" or IP address. Do not include scheme or port.
/// [port] is the port to connect to the database on. It is typically 5432 for default PostgreSQL settings.
/// [databaseName] is the name of the database to connect to.
/// [username] and [password] are optional if the database requires user authentication.
/// [timeoutInSeconds] refers to the amount of time [PostgreSQLConnection] will wait while establishing a connection before it gives up.
/// [queryTimeoutInSeconds] refers to the default timeout for [PostgreSQLExecutionContext]'s execute and query methods.
/// [timeZone] is the timezone the connection is in. Defaults to 'UTC'.
/// [useSSL] when true, uses a secure socket when connecting to a PostgreSQL database.
PostgreSQLConnection(
this.host,
this.port,
this.databaseName, {
this.username,
this.password,
this.timeoutInSeconds = 30,
this.queryTimeoutInSeconds = 30,
this.timeZone = 'UTC',
this.useSSL = false,
this.isUnixSocket = false,
}) {
_connectionState = _PostgreSQLConnectionStateClosed();
_connectionState.connection = this;
}
List<List<dynamic>> result = await connection.query(body['sql']).timeout(Duration(seconds: 90));
void main() async {
connection = PostgreSQLConnection('localhost', 5432, 'db', username: 'postgres', password: '123456');
await connection.open();
// далее сам код.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question