Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Like in PHP, I like to use -> and/or :: for the OOP shit
- #define database-> database_
- #define database:: database_
- hook OnGameModeInit() {
- database->intialize("localhost", "root", "", "db");
- }
- hook OnGameModeExit() {
- database->destruct();
- }
- //Some functions that would be such as public function smth()
- database::initialize(host[], user[], pass[], db[]) {
- new MySQLOpt:options = mysql_init_options();
- mysql_set_option(options, SERVER_PORT, 3306);
- mysql_set_option(options, AUTO_RECONNECT, false);
- mysql_set_option(options, POOL_SIZE, 2);
- mysql_connect(host, user, pass, db, options);
- if(mysql_errno(SQL::mc) != 0) {
- log->write("Could not create connection with the database manager.");
- }
- }
- database::destruct() {
- mysql_close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement