Open bib1963 opened 3 years ago
okay, surprising. do these alternaives work?
SELECT table_name FROM information_schema.tables;
SELECT table_name FROM information_schema.tables where table_schema='mysql';
see https://www.poftut.com/how-to-list-mysql-tables-with-show-tables-sql-query/
Yup, completely weird.
When I tried it earlier, I looked at the network dump from both my program & using the mysql client. Both seemed to make the call with exactly the same data. It's just that through Ada, it got rejected from the server.
So, I tried:
S1 : constant String := "SELECT table_name FROM information_schema.tables where table_schema='richman';";
Num_Rows : AdaBase.Affected_Rows;
[..]
Num_Rows := DR_Richman.execute (S1);
And it returned 0, even though there were 2 tables and therefore 2 rows, and it does not matter if I restrict it my schema or not.
When I look at the tcpdump, it actually comes back with an error stating "table 'richman.tables' doesn't exist and is confirmed by Last_Driver_Message call..
And yet, if I plug that request into the mysql client, it does return with a list of rows without error...
MariaDB [richman]> SELECT table_name FROM information_schema.tables where table_schema='richman';
+------------+
| table_name |
+------------+
| settings |
| settings_1 |
+------------+
2 rows in set (0.000 sec)
If I create a string with "SELECT * FROM settings" within richman, prepare & execute function normally and return the correct number of rows.
If I change that string to "SELECT table_name FROM information_schema.tables where table_schema='richman'", then it fails with: raised ADABASE.CONNECTION.BASE.MYSQL.INITIALIZE_FAIL : Failed to prepare SQL statement 'SELECT table_name FROM information_schema.tables where table_schema='richman''
I'm struggling...
I think this is a problem with the mysql/maria client library as it also seems to have been seen with the Java connector. Looking at the network trace for the mysql cli client, it does seem to do a number of requests on startup which AdaBase does not, perhaps that has something to do with it. I do think the mysql_list_tables() call should be implemented.
And some more info...
When the mysql cli client starts, it make the following requests, which AdaBase does not: select * from information_schema.schemata show tables
Then for each table: show fields from
Near perfect, but...
Making a query such as "SHOW TABLES" fails, but there is a C API call which is not implemented, mysql_list_tables(). We can seem to list columns just fine.
Perhaps, it can be updated, it's only been 5 years with ne'er a problem until now.