| Home | Libraries | People | FAQ | More

###### any_connection::close (2 of 2 overloads)

Cleanly closes the connection to the server.

###### Synopsis

    void
    close();

###### Description

This function does the following:

- Sends a quit request. This is required by the MySQL protocol, to inform the server that we're closing the connection gracefully.
- If the connection is using TLS (`this->uses_ssl() == true`), performs the TLS shutdown.
- Closes the transport-level connection (the TCP or UNIX socket).

Since this function involves writing a message to the server, it can fail. Only use this function if you know that the connection is healthy and you want to cleanly close it.

If you don't call this function, the destructor or successive connects will perform a transport-layer close. This doesn't cause any resource leaks, but may cause warnings to be written to the server logs.