cleanup, docs
This commit is contained in:
@@ -27,4 +27,13 @@ DValue rows = mysql_query(m,
|
||||
The result is returned as a `DValue`, which makes it easy to iterate through rows and read fields with the usual `DValue` accessors.
|
||||
|
||||
:example
|
||||
print("mysql_query is resource-bound; configure the service or connection, then call it in request code.\n");
|
||||
MySQL* db = mysql_connect();
|
||||
if(db != 0)
|
||||
{
|
||||
DValue rows = mysql_query(db, "select 'ada@example.test' as email, 1 + 1 as total");
|
||||
String email = "none"; String total = "?";
|
||||
rows.each([&](DValue r, String key) { email = r["email"].to_string(); total = r["total"].to_string(); });
|
||||
print(email, " / total=", total, "\n");
|
||||
mysql_disconnect(db);
|
||||
}
|
||||
else print("(requires a reachable MySQL server)\n");
|
||||
|
||||
Reference in New Issue
Block a user