本文整理汇总了Java中java.sql.DatabaseMetaData.storesLowerCaseIdentifiers方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseMetaData.storesLowerCaseIdentifiers方法的具体用法?Java DatabaseMetaData.storesLowerCaseIdentifiers怎么用?Java DatabaseMetaData.storesLowerCaseIdentifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.DatabaseMetaData
的用法示例。
在下文中一共展示了DatabaseMetaData.storesLowerCaseIdentifiers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCaseRule
import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
private static int getCaseRule(DatabaseMetaData dbmd) {
int rule = UC_RULE;
try {
if ( dbmd.storesUpperCaseIdentifiers() ) {
rule = UC_RULE;
} else if ( dbmd.storesLowerCaseIdentifiers() ) {
rule = LC_RULE;
} else if ( dbmd.storesMixedCaseIdentifiers() ) {
rule = MC_RULE;
} else {
rule = UC_RULE;
}
} catch ( SQLException sqle ) {
LOGGER.log(Level.WARNING, "Exception trying to find out how " +
"the database stores unquoted identifiers, assuming " +
"upper case: " + sqle.getMessage());
LOGGER.log(Level.FINE, null, sqle);
}
return rule;
}
示例2: testBug31187
import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
public void testBug31187() throws Exception {
createTable("testBug31187", "(field1 int)");
Connection nullCatConn = getConnectionWithProps("nullCatalogMeansCurrent=false");
DatabaseMetaData dbmd = nullCatConn.getMetaData();
ResultSet dbTblCols = dbmd.getColumns(null, null, "testBug31187", "%");
boolean found = false;
while (dbTblCols.next()) {
String catalog = dbTblCols.getString("TABLE_CAT");
String table = dbTblCols.getString("TABLE_NAME");
boolean useLowerCaseTableNames = dbmd.storesLowerCaseIdentifiers();
if (catalog.equals(nullCatConn.getCatalog())
&& (((useLowerCaseTableNames && "testBug31187".equalsIgnoreCase(table)) || "testBug31187".equals(table)))) {
found = true;
}
}
assertTrue("Didn't find any columns for table named 'testBug31187' in database " + this.conn.getCatalog(), found);
}