Skip to content

Commit

Permalink
modify default connect constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
hotdang-ca committed Jul 22, 2022
1 parent 3ecfc76 commit eaae869
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/src/mysql_client/connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,20 @@ class MySQLConnection {
/// SET @@collation_connection=$_collation, @@character_set_client=utf8, @@character_set_connection=utf8, @@character_set_results=utf8
/// ```
static Future<MySQLConnection> createConnection({
required String host,
required dynamic host,
required int port,
required String userName,
required String password,
bool secure = true,
String? databaseName,
String collation = 'utf8_general_ci',
}) async {
final socket = await Socket.connect(host, port);
socket.setOption(SocketOption.tcpNoDelay, true);
final Socket socket = await Socket.connect(host, port);

if (socket.address.type != InternetAddressType.unix) {
// no support for extensions on sockets
socket.setOption(SocketOption.tcpNoDelay, true);
}

final client = MySQLConnection._(
socket: socket,
Expand Down

0 comments on commit eaae869

Please sign in to comment.