[CONJ-765] Allow MariaDbDatabaseMetaData#getExportedKeys to return the exported keys for all tables Created: 2020-03-02  Updated: 2020-03-18  Resolved: 2020-03-04

Status: Closed
Project: MariaDB Connector/J
Component/s: metadata
Affects Version/s: 2.5.4
Fix Version/s: 2.6.0

Type: Task Priority: Major
Reporter: Guillaume Grossetie Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: metadata


 Description   

Currently the table parameter is mandatory:

https://github.com/mariadb-corporation/mariadb-connector-j/blob/12d22ecc962e410d9c5f3bc2650fc43a7c8d1886/src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java#L916-L918

I think it would be useful to return the exported keys for all tables if the parameter is null. We could also allow a search pattern (using LIKE):

// get the exported keys for the table named crm_sales
dbmd.getExportedKeys("testj", null, "crm_sales");
 
// get the exported keys for all tables starting with "crm_"
dbmd.getExportedKeys("testj", null, "crm_%");
 
// get the exported keys for all tables
dbmd.getExportedKeys("testj", null, null);

As a workaround it's possible to send N queries to retrieve the exported keys for N tables but it's detrimental (performance wise).

We might need to do the same for MariaDbDatabaseMetaData#getImportedKeys to be consistent.

Interestingly, it's already possible to retrieve the primary keys for all tables using MariaDbDatabaseMetaData#getPrimaryKeys.



 Comments   
Comment by Diego Dupin [ 2020-03-04 ]

This restriction has no reason, particulary since other methods implements this possibility.
done with commit https://github.com/mariadb-corporation/mariadb-connector-j/commit/1063fc443368bf4d81c339a408ca9949fa0998ee

Generated at Thu Feb 08 03:18:09 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.