Some application expect the mysql connection continue to work after a long time (until it close the connection, e.g., as the program terminates). The mysql server will close the connection after certain period of idle time, e.g., 24 hours. After the server disconnect, using the connection will fail.
The library should check the status of the connection (like ping()), and reconnect if it is closed. When it is reconnect, the initialization should be done, such as setting the connection options.
This should be transparent to the mysql client lib user.