Java Code Examples for java.sql.DatabaseMetaData#supportsMixedCaseIdentifiers()

The following examples show how to use java.sql.DatabaseMetaData#supportsMixedCaseIdentifiers() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SqlDialectFactoryImpl.java    From Quicksql with MIT License 6 votes vote down vote up
private Casing getCasing(DatabaseMetaData databaseMetaData, boolean quoted) {
  try {
    if (quoted
        ? databaseMetaData.storesUpperCaseQuotedIdentifiers()
        : databaseMetaData.storesUpperCaseIdentifiers()) {
      return Casing.TO_UPPER;
    } else if (quoted
        ? databaseMetaData.storesLowerCaseQuotedIdentifiers()
        : databaseMetaData.storesLowerCaseIdentifiers()) {
      return Casing.TO_LOWER;
    } else if (quoted
        ? (databaseMetaData.storesMixedCaseQuotedIdentifiers()
            || databaseMetaData.supportsMixedCaseQuotedIdentifiers())
        : (databaseMetaData.storesMixedCaseIdentifiers()
            || databaseMetaData.supportsMixedCaseIdentifiers())) {
      return Casing.UNCHANGED;
    } else {
      return Casing.UNCHANGED;
    }
  } catch (SQLException e) {
    throw new IllegalArgumentException("cannot deduce casing", e);
  }
}
 
Example 2
Source File: SqlDialectFactoryImpl.java    From calcite with Apache License 2.0 6 votes vote down vote up
private Casing getCasing(DatabaseMetaData databaseMetaData, boolean quoted) {
  try {
    if (quoted
        ? databaseMetaData.storesUpperCaseQuotedIdentifiers()
        : databaseMetaData.storesUpperCaseIdentifiers()) {
      return Casing.TO_UPPER;
    } else if (quoted
        ? databaseMetaData.storesLowerCaseQuotedIdentifiers()
        : databaseMetaData.storesLowerCaseIdentifiers()) {
      return Casing.TO_LOWER;
    } else if (quoted
        ? (databaseMetaData.storesMixedCaseQuotedIdentifiers()
            || databaseMetaData.supportsMixedCaseQuotedIdentifiers())
        : (databaseMetaData.storesMixedCaseIdentifiers()
            || databaseMetaData.supportsMixedCaseIdentifiers())) {
      return Casing.UNCHANGED;
    } else {
      return Casing.UNCHANGED;
    }
  } catch (SQLException e) {
    throw new IllegalArgumentException("cannot deduce casing", e);
  }
}
 
Example 3
Source File: SqlDialectFactoryImpl.java    From Quicksql with MIT License 5 votes vote down vote up
private boolean isCaseSensitive(DatabaseMetaData databaseMetaData) {
  try {
    return databaseMetaData.supportsMixedCaseIdentifiers()
        || databaseMetaData.supportsMixedCaseQuotedIdentifiers();
  } catch (SQLException e) {
    throw new IllegalArgumentException("cannot deduce case-sensitivity", e);
  }
}
 
Example 4
Source File: DatabaseUtil.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
private boolean getIsCaseSensitive(Collection<String> messages) {
    boolean isCaseSensitive = false;
    try (Connection connection = getConnectionLogged(messages)) {
        DatabaseMetaData dbData = this.getDatabaseMetaData(connection, messages);
        if (dbData != null) {
            isCaseSensitive = dbData.supportsMixedCaseIdentifiers();
        }
    } catch (SQLException e) {
        Debug.logError(e, "Error getting db meta data about case sensitive", module);
    }
    return isCaseSensitive;
}
 
Example 5
Source File: SqlDialectFactoryImpl.java    From calcite with Apache License 2.0 5 votes vote down vote up
private boolean isCaseSensitive(DatabaseMetaData databaseMetaData) {
  try {
    return databaseMetaData.supportsMixedCaseIdentifiers()
        || databaseMetaData.supportsMixedCaseQuotedIdentifiers();
  } catch (SQLException e) {
    throw new IllegalArgumentException("cannot deduce case-sensitivity", e);
  }
}