Search in sources :

Example 1 with JavaColumnNameResultSetExtractor

use of com.ctrip.platform.dal.daogen.host.java.JavaColumnNameResultSetExtractor in project dal by ctripcorp.

the class GenTaskBySqlBuilderResource method getTableColumnSqlType.

/**
 * @param set_name
 * @param table_name
 * @return <column alias, sqltype>
 */
private Map<String, Integer> getTableColumnSqlType(String set_name, String table_name, String modeType) throws Exception {
    String dbName = AllInOneNameUtils.getAllInOneName(set_name, modeType);
    DatabaseCategory dbCategory = DbUtils.getDatabaseCategory(dbName);
    List<AbstractParameterHost> paramsHost = DbUtils.getAllColumnNames(dbName, table_name, new JavaColumnNameResultSetExtractor(dbName, table_name, dbCategory));
    Map<String, Integer> map = new HashMap<>();
    if (paramsHost != null) {
        for (int i = 0; i < paramsHost.size(); i++) {
            JavaParameterHost paramHost = (JavaParameterHost) paramsHost.get(i);
            map.put(paramHost.getAlias().toLowerCase(), paramHost.getSqlType());
        }
    }
    return map;
}
Also used : AbstractParameterHost(com.ctrip.platform.dal.daogen.host.AbstractParameterHost) DatabaseCategory(com.ctrip.platform.dal.daogen.enums.DatabaseCategory) JavaColumnNameResultSetExtractor(com.ctrip.platform.dal.daogen.host.java.JavaColumnNameResultSetExtractor) HashMap(java.util.HashMap) JavaParameterHost(com.ctrip.platform.dal.daogen.host.java.JavaParameterHost)

Aggregations

DatabaseCategory (com.ctrip.platform.dal.daogen.enums.DatabaseCategory)1 AbstractParameterHost (com.ctrip.platform.dal.daogen.host.AbstractParameterHost)1 JavaColumnNameResultSetExtractor (com.ctrip.platform.dal.daogen.host.java.JavaColumnNameResultSetExtractor)1 JavaParameterHost (com.ctrip.platform.dal.daogen.host.java.JavaParameterHost)1 HashMap (java.util.HashMap)1