Skip to content

Commit

Permalink
Merge pull request zim32#32 from hotdang-ca/feature/unix_socket_conne…
Browse files Browse the repository at this point in the history
…ction_support

Feature/unix socket connection support
  • Loading branch information
zim32 authored Jul 27, 2022
2 parents 3ecfc76 + 500df64 commit d086f12
Show file tree
Hide file tree
Showing 2 changed files with 482 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
Loading

0 comments on commit d086f12

Please sign in to comment.