本文整理汇总了Java中org.mybatis.generator.config.TableConfiguration.getTableName方法的典型用法代码示例。如果您正苦于以下问题:Java TableConfiguration.getTableName方法的具体用法?Java TableConfiguration.getTableName怎么用?Java TableConfiguration.getTableName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mybatis.generator.config.TableConfiguration
的用法示例。
在下文中一共展示了TableConfiguration.getTableName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: introspectNativeSQLTypes
import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
private void introspectNativeSQLTypes() {
Connection conn = null;
try {
conn = getConnection();
DatabaseMetaData dbmd = conn.getMetaData();
for (TableConfiguration tc : context.getTableConfigurations()) {
String tableName = tc.getTableName();
Map<String, ColumnInfo> map = new HashMap<String, ColumnInfo>();
columnInfo.put(tableName, map);
TableName tn = new TableName(tc, dbmd);
ResultSet rset = dbmd.getColumns(tn.catalog, tn.schema, tn.table, null);
while (rset.next()) {
ColumnInfo info = new ColumnInfo();
map.put(rset.getString("COLUMN_NAME"), info);
info.nativeTypeName = rset.getString("TYPE_NAME");
}
rset.close();
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
closeConnection(conn);
}
}
示例2: TableName
import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
public TableName(TableConfiguration tc, DatabaseMetaData dbmd) throws SQLException {
String localCatalog = tc.getCatalog();
String localSchema = tc.getSchema();
String localTableName = tc.getTableName();
try {
boolean delimitIdentifiers = tc.isDelimitIdentifiers() || Str.containsSpaces(localCatalog, localSchema, localTableName);
if (!delimitIdentifiers && dbmd.storesLowerCaseIdentifiers()) {
localCatalog = Str.lower(localCatalog);
localSchema = Str.lower(localSchema);
localTableName = Str.lower(localTableName);
} else if (!delimitIdentifiers && dbmd.storesUpperCaseIdentifiers()) {
localCatalog = Str.upper(localCatalog);
localSchema = Str.upper(localSchema);
localTableName = Str.upper(localTableName);
}
if (tc.isWildcardEscapingEnabled()) {
String searchStringEscape = dbmd.getSearchStringEscape();
localSchema = escape(localSchema, searchStringEscape);
localTableName = escape(localTableName, searchStringEscape);
}
} finally {
catalog = localCatalog;
schema = localSchema;
table = localTableName;
}
}
示例3: validate
import org.mybatis.generator.config.TableConfiguration; //导入方法依赖的package包/类
@Override
public boolean validate(List<String> strings) {
String TABLES = "tables";
String EXCLUDE_TABLES = "excludeTables";
Pattern include = Pattern.compile(Objects.nvl(Str.trim(properties.getProperty(TABLES)), ".+"));
Pattern exclude = Pattern.compile(Objects.nvl(Str.trim(properties.getProperty(EXCLUDE_TABLES)), "^-$"));
for (TableConfiguration tc : context.getTableConfigurations()) {
String tableName = tc.getTableName();
if (!include.matcher(tableName).matches() || exclude.matcher(tableName).matches())
continue;
Set<String> set = modified.get(tableName);
if (set == null)
modified.put(tableName, set = new HashSet<String>());
Properties p = tc.getProperties();
for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements(); ) {
String name = (String)e.nextElement();
if (TABLES.equals(name) || EXCLUDE_TABLES.equals(name)) continue;
String value = properties.getProperty(name);
if ("alias".equals(name)) {
if (Str.trim(tc.getAlias()) == null) {
tc.setAlias(value);
set.add(name);
}
}
else if (!p.containsKey(name)) {
p.setProperty(name, value);
set.add(name);
}
}
}
return true;
}