MySQLConnectionPool class

Class to create and manage pool of database connections

Constructors

MySQLConnectionPool.new({required dynamic host, required int port, required String userName, required dynamic password, required int maxConnections, String? databaseName, bool secure = true, String collation = 'utf8_general_ci', int timeoutMs = 10000})
Creates new pool

Properties

activeConnectionsQty int
Number of active connections in this pool Active are connections which are currently interacting with the database
no setter
allConnectionsQty int
Active + Idle connections
no setter
collation String
final
databaseName String?
final
hashCode int
The hash code for this object.
no setterinherited
host → dynamic
final
idleConnectionsQty int
Number of idle connections in this pool Idle are connections which are currently not interacting with the database and ready to be used
no setter
maxConnections int
final
port int
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secure bool
final
timeoutMs int
final
userName String
final

Methods

close() Future<void>
Closes all connections in this pool and frees resources
execute(String query, [Map<String, dynamic>? params, bool iterable = false]) Future<IResultSet>
See MySQLConnection.execute
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prepare(String query, [bool iterable = false]) Future<PreparedStmt>
See MySQLConnection.prepare
toString() String
A string representation of this object.
inherited
transactional<T>(FutureOr<T> callback(MySQLConnection conn)) Future<T>
See MySQLConnection.transactional
withConnection<T>(FutureOr<T> callback(MySQLConnection conn)) FutureOr<T>
Get free connection from this pool (possibly new connection) and invoke callback function with this connection

Operators

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