#include "mysql.h" // MySQL Include File
#define SERVER "localhost"
#define USER "root"
#define PASSWORD ""
#define DATABASE "cdcol"
MYSQL* testcon;
BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved) // this is where the DLL first starts.
{
engine_bind();
return TRUE;
}
DLLFUNC const char gs_mysqltest(const char *abfrage)
{
MYSQL *connect; // Create a pointer to the MySQL instance
connect=mysql_init(NULL); // Initialise the instance
connect=mysql_real_connect(connect,SERVER,USER,PASSWORD,DATABASE,0,NULL,0);
MYSQL_RES *res_set; /* Create a pointer to recieve the return value.*/
MYSQL_ROW row; /* Assign variable for rows. */
mysql_query(connect,abfrage);
unsigned int i = 0; /* Create a counter for the rows */
res_set = mysql_store_result(connect); /* Receive the result and store it in res_set */
my_ulonglong numrows = mysql_num_rows(res_set); /* Create the count to print all rows */
/* This while is to print all rows and not just the first row found, */
const char *testxx;
while ((row = mysql_fetch_row(res_set)) != NULL){
testxx=row[0];
return *testxx;
}
mysql_close(connect); /* Close and shutdown */
return *testxx;
}