Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "StdAfx.h"
- #include "FuSIONMySQL.h"
- #include <stdlib.h>
- #include <iostream>
- #include <cstdio>
- #include <cstdlib>
- #include "ServerFunctions.h"
- /*
- Include directly the different
- headers from cppconn/ and mysql_driver.h + mysql_util.h
- (and mysql_connection.h). This will reduce your build time!
- */
- // For MySQL Connection
- #include <mysql.h>
- using namespace std;
- // Defining Constant Variables
- #define SERVER "database.crysiswars.zyboxgaming.eu"
- #define USER "[classified]"
- #define PASSWORD "[classified]"
- #define DATABASE "[classified]"
- void FuSIONConnect()
- {
- MYSQL *connect;
- connect = mysql_init(NULL);
- if (!connect)
- {
- GF_Log("Failed to initialize FuSION Database connection", false);
- }
- connect = mysql_real_connect(connect, SERVER, USER, PASSWORD, DATABASE, 0, NULL, 0);
- if (connect)
- {
- GF_Log("Connected to FuSION Database", false);
- }
- else
- {
- GF_Log("Failed to initialize FuSION Database connection", false);
- }
- MYSQL_RES *res_set;
- MYSQL_ROW row;
- // Replace MySQL query with your query
- mysql_query(connect, "show tables");
- unsigned int i = 0;
- res_set = mysql_store_result(connect);
- unsigned int numrows = mysql_num_rows(res_set);
- cout << " Tables in " << DATABASE << " database " << endl;
- while (((row = mysql_fetch_row(res_set)) != NULL))
- {
- cout << row[i] << endl;
- }
- mysql_close(connect);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement