Document request-scoped MySQL cleanup
This commit is contained in:
@@ -15,6 +15,8 @@ Establishes a connection to a MySQL server and returns a pointer to the connecti
|
||||
|
||||
This connection handle is then used with helpers such as `mysql_query()`, `mysql_error()`, and `mysql_disconnect()`.
|
||||
|
||||
MySQL handles are request-scoped framework resources. If a request exits without calling `mysql_disconnect()`, UCE closes any remaining MySQL handles during request cleanup. Call `mysql_disconnect()` when you want to close early, but never store a `MySQL*` in globals, sessions, or other state that can outlive the current request.
|
||||
|
||||
:example
|
||||
MySQL* db = mysql_connect();
|
||||
print(db != 0 ? "connected to MySQL" : "no MySQL server reachable with these credentials", "\n");
|
||||
|
||||
@@ -10,7 +10,7 @@ m : pointer to an existing MySQL connection struct
|
||||
:content
|
||||
Closes an existing connection to a MySQL server.
|
||||
|
||||
Call this when you are done using a `MySQL*` connection handle.
|
||||
Call this when you want to release a `MySQL*` connection handle before the request ends. UCE also closes any remaining MySQL handles automatically during request cleanup, including handles skipped by exceptions or fatal request recovery. A `MySQL*` is only valid inside the request that opened it; do not cache it across requests.
|
||||
|
||||
:example
|
||||
MySQL* db = mysql_connect();
|
||||
|
||||
Reference in New Issue
Block a user