1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
MYSQL *sock;
sock = mysql_init(0);
//CONNECTION//
if (mysql_real_connect(sock, host, user, pass, db, 0, NULL, 0))
cout << "MySQL is Connected\n" << endl;
else {
cout << "Connection Failed: " << mysql_error(sock) << endl;
}
//Get Range Of Database//
int E_min, E_Max, E1_max, E2_max, E3_max, E1_min, E2_min, E3_min;
E_min = mysql_query (sock, "SELECT * FROM `mdbase` ORDER BY `mdbase`.`E3` ASC LIMIT 0 , 1");
MYSQL_RES *resultEmin ;
MYSQL_RES *resultEmax ;
MYSQL_ROW row_Emin;
MYSQL_ROW row_Emax;
resultEmin= mysql_use_result(sock);
row_Emin = mysql_fetch_row (resultEmin);
E1_min = atoi (row_Emin [7]);
E2_min = atoi (row_Emin [8]);
E3_min = atoi (row_Emin [9]);
E_Max = mysql_query (sock, "SELECT * FROM `mdbase` WHERE (E1 = (SELECT MAX(E1) FROM `mdbase`)) AND (E2 = (SELECT MAX(E2) FROM `mdbase`)) AND (E3 = (SELECT MAX(E3) FROM `mdbase`));");
resultEmax = mysql_use_result(sock);
row_Emax = mysql_fetch_row (resultEmax);
E1_max = atoi (row_Emax [7]);
E2_max = atoi (row_Emax [8]);
E3_max = atoi (row_Emax [9]);
|