Skip to content

Commit eaae869

Browse files
committed
modify default connect constructor
1 parent 3ecfc76 commit eaae869

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/src/mysql_client/connection.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,20 @@ class MySQLConnection {
7070
/// SET @@collation_connection=$_collation, @@character_set_client=utf8, @@character_set_connection=utf8, @@character_set_results=utf8
7171
/// ```
7272
static Future<MySQLConnection> createConnection({
73-
required String host,
73+
required dynamic host,
7474
required int port,
7575
required String userName,
7676
required String password,
7777
bool secure = true,
7878
String? databaseName,
7979
String collation = 'utf8_general_ci',
8080
}) async {
81-
final socket = await Socket.connect(host, port);
82-
socket.setOption(SocketOption.tcpNoDelay, true);
81+
final Socket socket = await Socket.connect(host, port);
82+
83+
if (socket.address.type != InternetAddressType.unix) {
84+
// no support for extensions on sockets
85+
socket.setOption(SocketOption.tcpNoDelay, true);
86+
}
8387

8488
final client = MySQLConnection._(
8589
socket: socket,

0 commit comments

Comments
 (0)