[Linux LEAP 15.1] MySQL client version 10.4.3

Alles, was MariaDB und MySQL betrifft, kann hier besprochen werden.

[Linux LEAP 15.1] MySQL client version 10.4.3

Postby hurukan » 20. October 2019 04:00

Greetings,

I'm completly lost :{
I did a demonstration for my students yeeeeaaaars ago and this one always worked untill I upgraded to LEAP 15.1 :{

The demonstration is about a C application (language that we learn at school) that connects to a mariadb database.

This is the part of the main() function
Code: Select all
   setlocale(LC_ALL,"fr_BE.UTF8");
   
  wprintf(L"MySQL client version: %s\n",mysql_get_client_info());
   wprintf(L"Tentative de connexion...");
   MYSQL *connexion = mysql_init(NULL);

  if (connexion == NULL)
  {
      fprintf(stderr, "%s\n", mysql_error(connexion));
      exit(1);
  }

   
   if (mysql_real_connect(connexion, "localhost", "testeur", "toor","CSSMPoste", 0, NULL, 0) == NULL)
  {
     wprintf(L"\t\x1b[31m[ko]\x1b[0m\nErreur à l'ouverture de connexion: %s !!\n",mysql_error(connexion));
     
       exit(1);
  }   
  wprintf(L"\t\x1b[32m[ok]\x1b[0m\n");
 
   if (mysql_query(connexion, "SELECT Nom,CodePostal FROM CodesPostaux,Localités WHERE idCodePostal=Ref_CodesPostaux ORDER BY CodePostal"))
  {
      wprintf(L"(%05d)Erreur lors de l'exécution d'une requête SQL: %s !!\n",mysql_error(connexion),mysql_error(connexion));
     
       exit(1);
  }


Image

The error happened when I try to execute a query with mysql_query() that always worked before, I got some documents showing it was working, I got just to retreive them.
Looking at the output it seems the string is broken as the '\n' is never printed to the terminal :{

What is wrong with mysql_query() that is still documented in the official documentation (refered to refman-5.7-en.a4.pdf) and https://dev.mysql.com/doc/refman/8.0/en/mysql-query.html

The description of the tables involved in the query is:

Image

I do not use binary datas but there is an error that never happened before.
hurukan
 
Posts: 2
Joined: 20. October 2019 03:40
Operating System: Linux LEAP 15.1

Re: [Linux LEAP 15.1] MySQL client version 10.4.3

Postby Nobbie » 21. October 2019 20:03

I think (not 100% sure about this), that MariaDB (not MySQL, Xampp does not install MySQL since many years) does not support mysql_xxxx functions anymore. These functions have been removed in PHP 7 and maybe (i really dont know) it also has been removed totally in the API for MariaDB. In case of PHP, it is recommended to upgrade to the mysqli_xxxx functions instead. I dont know if there is an equivalent C Api likely as for PHP. But it makes sense. In that case, mysql_xxx has been removed for C as well.

Its only a clue.
Nobbie
 
Posts: 11202
Joined: 09. March 2008 13:04

Re: [Linux LEAP 15.1] MySQL client version 10.4.3

Postby hurukan » 22. October 2019 13:36

Thank you... I'll try with first replacing those functions with equivalent from the code, and then get back with observations.
hurukan
 
Posts: 2
Joined: 20. October 2019 03:40
Operating System: Linux LEAP 15.1


Return to MariaDB - MySQL

Who is online

Users browsing this forum: No registered users and 3 guests