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
|
void square_detect::recognition (const char* type_plaque)
{
mysql_init(&mysql);
mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, "option"); //Options de connexion
char c_show[200] = "SHOW TABLES FROM plaques LIKE ";
char* c_show_table = strcat(c_show, type_plaque);
bool trouve=false;
int t_exist=0;
// CONNEXION A LA BASE DE DONNEES (fonctionne)
MYSQL * connexion = mysql_real_connect(&mysql,"localhost","root","","plaques",0,NULL,0);
//Si la connexion réussie...
if(connexion)
{
MYSQL_RES *result0 = NULL;
MYSQL_ROW row0;
cout << c_show_table << "\n"; // AFFICHAGE: SHOW TABLES FROM plaques LIKE nom_de_ma_table_passee_en_parametres
t_exist = mysql_query(&mysql, c_show_table);
// NE MARCHE PAS CAR t_exist est toujours à 1 que la table existe ou pas
if(t_exist > 0)
{
trouve = true;
cout << "t_exist = " << t_exist << "\n";
}
else
{
trouve = false;
cout << "t_exist = " << t_exist << "\n";
}
}// if connexion
} |
Partager