mysql_connect
host callCapy
function mysql_connect(host : string, username : string, password : string, database : string) u64
Description
mysql_connect() creates a MySQL connection lease and returns its handle.
Use mysql_info(database, "connection") before database work. Call mysql_disconnect() after use. A failed connection can return a nonzero handle.
Parameters
host : the MySQL server host
username : the MySQL user name
password : the MySQL password
database : the initial database name
Return Values
a request-local MySQL connection handle
Example
Capy
var database := mysql_connect("localhost", "root", "", "")
if bool(mysql_info(database, "connection")) { print("connected\n") } else { print(string(mysql_info(database, "error")), "\n") }
if database { mysql_disconnect(database) }