docs: private static ResultSet getImportedKeys(String tableDef, String tableName, String catalog,
        MariaDbConnection connection) throws ParseException {
      String[] columnNames = {
          "PKTABLE_CAT", "PKTABLE_SCHEM", "PKTABLE_NAME",
          "PKCOLUMN_NAME", "FKTABLE_CAT", "FKTABLE_SCHEM",
          "FKTABLE_NAME", "FKCOLUMN_NAME", "KEY_SEQ",
          "UPDATE_RULE", "DELETE_RULE", "FK_NAME",
          "PK_NAME", "DEFERRABILITY"
      };
      ColumnType[] columnTypes = {
          ColumnType.VARCHAR, ColumnType.NULL, ColumnType.VARCHAR,
          ColumnType.VARCHAR, ColumnType.VARCHAR, ColumnType.NULL,
          ColumnType.VARCHAR, ColumnType.VARCHAR, ColumnType.SMALLINT,
          ColumnType.SMALLINT, ColumnType.SMALLINT, ColumnType.VARCHAR,
          ColumnType.NULL, ColumnType.SMALLINT};
  
      String[] parts = tableDef.split("\n");
  
      List<String[]> data = new ArrayList<>();
  
      for (String part : parts) {
        part = part.trim();
        if (!part.startsWith("CONSTRAINT") && !part.contains("FOREIGN KEY")) {
          continue;
        }
        char[] partChar = part.toCharArray();
  
        Identifier constraintName = new Identifier();
  
        int pos = skipKeyword(partChar, 0, "CONSTRAINT");
        pos = parseIdentifier(partChar, pos, constraintName);
        pos = skipKeyword(partChar, pos, "FOREIGN KEY");
        List<Identifier> foreignKeyCols = new ArrayList<>();
        pos = parseIdentifierList(partChar, pos, foreignKeyCols);
        pos = skipKeyword(partChar, pos, "REFERENCES");
        Identifier pkTable = new Identifier();
        pos = parseIdentifier(partChar, pos, pkTable);
        List<Identifier> primaryKeyCols = new ArrayList<>();
        parseIdentifierList(partChar, pos, primaryKeyCols);
        if (primaryKeyCols.size() != foreignKeyCols.size()) {
          throw new ParseException(tableDef, 0);
        }
        int onUpdateReferenceAction = DatabaseMetaData.importedKeyRestrict;
        int onDeleteReferenceAction = DatabaseMetaData.importedKeyRestrict;
  
        for (String referenceAction : new String[]{"RESTRICT", "CASCADE", "SET NULL", "NO ACTION"}) {
          if (part.contains("ON UPDATE " + referenceAction)) {
            onUpdateReferenceAction = getImportedKeyAction(referenceAction);
          }
          if (part.contains("ON DELETE " + referenceAction)) {
            onDeleteReferenceAction = getImportedKeyAction(referenceAction);
          }
        }
  
        for (int i = 0; i < primaryKeyCols.size(); i++) {
  
          String[] row = new String[columnNames.length];
          row[0] = pkTable.schema;
          if (row[0] == null) {
            row[0] = catalog;
          }
          row[1] = null;
          row[2] = pkTable.name;
          row[3] = primaryKeyCols.get(i).name;
          row[4] = catalog;
          row[5] = null;
          row[6] = tableName;
          row[7] = foreignKeyCols.get(i).name;
          row[8] = Integer.toString(i + 1);
          row[9] = Integer.toString(onUpdateReferenceAction);
          row[10] = Integer.toString(onDeleteReferenceAction);
          row[11] = constraintName.name;
          row[12] = null;
          row[13] = Integer.toString(DatabaseMetaData.importedKeyNotDeferrable);
          data.add(row);
        }
      }
      String[][] arr = data.toArray(new String[0][]);
  
      /* Sort array by PKTABLE_CAT, PKTABLE_NAME, and KEY_SEQ.*/
      Arrays.sort(arr, (row1, row2) -> {
        int result = row1[0].compareTo(row2[0]);   //PKTABLE_CAT
        if (result == 0) {
          result = row1[2].compareTo(row2[2]);   //PKTABLE_NAME
          if (result == 0) {
            result = row1[8].length() - row2[8].length();  // KEY_SEQ
            if (result == 0) {
              result = row1[8].compareTo(row2[8]);
            }
          }
        }
        return result;
      });
      return SelectResultSet.createResultSet(columnNames, columnTypes, arr, connection.getProtocol());
    }