Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-765

Allow MariaDbDatabaseMetaData#getExportedKeys to return the exported keys for all tables

    XMLWordPrintable

Details

    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.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            ggrossetie Guillaume Grossetie
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.