MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | OPTIONAL |
| 2 | SYNOPSIS |
| 3 | int db_connect(string database) |
| 4 | int db_connect(string database, string user) |
| 5 | int db_connect(string database, string user, string password) |
| 6 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 7 | DESCRIPTION |
| 8 | Connect to the database <database> on the local mySQL-server. |
| 9 | The return-value is the handle for this connection. Automatic |
| 10 | reconnects are enabled for this connection; see mysql(C) for |
| 11 | implications. |
| 12 | If the database does not exist or the server is NOT started, |
| 13 | a runtime-error is raised. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 14 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 15 | If specified, the connection is made for <user> with <password>. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 16 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 17 | The function is available only if the driver is compiled with |
| 18 | mySQL support. In that case, __MYSQL__ is defined. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 19 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 20 | The efun triggers a privilege violation ("mysql", "db_connect"). |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 21 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 22 | HISTORY |
| 23 | Added in 3.2.9 . |
| 24 | LDMud 3.2.11 added the privilege violation. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 25 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 26 | SEE ALSO |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 27 | db_affected_rows(E), db_conv_string(E), db_close(E), db_coldefs(E), |
| 28 | db_exec(E), db_error(E), db_fetch(E), db_handles(E), |
| 29 | db_insert_id(E), mysql(C), privilege_violation(M) |