Search in sources :

Example 21 with DfJdbcFacade

use of org.dbflute.helper.jdbc.facade.DfJdbcFacade in project dbflute-core by dbflute.

the class DfSynonymExtractorOracle method judgeSynonymSelectable.

protected void judgeSynonymSelectable(DfSynonymMeta info) {
    final DfJdbcFacade facade = new DfJdbcFacade(_dataSource);
    final String synonymSqlName = info.buildSynonymSqlName();
    final String sql = "select * from " + synonymSqlName + " where 0 = 1";
    try {
        final List<String> columnList = new ArrayList<String>();
        columnList.add("dummy");
        facade.selectStringList(sql, columnList);
        info.setSelectable(true);
    } catch (RuntimeException ignored) {
        info.setSelectable(false);
    }
}
Also used : ArrayList(java.util.ArrayList) DfJdbcFacade(org.dbflute.helper.jdbc.facade.DfJdbcFacade)

Example 22 with DfJdbcFacade

use of org.dbflute.helper.jdbc.facade.DfJdbcFacade in project dbflute-core by dbflute.

the class DfArrayExtractorOracle method selectFirstArray.

protected List<Map<String, String>> selectFirstArray(UnifiedSchema unifiedSchema) {
    final DfJdbcFacade facade = new DfJdbcFacade(_dataSource);
    final List<String> columnList = new ArrayList<String>();
    columnList.add("TYPE_NAME");
    columnList.add("COLL_TYPE");
    columnList.add("ELEM_TYPE_OWNER");
    columnList.add("ELEM_TYPE_NAME");
    columnList.add("LENGTH");
    columnList.add("PRECISION");
    columnList.add("SCALE");
    final String sql = buildFirstArraySql(unifiedSchema);
    final List<Map<String, String>> resultList;
    try {
        log(sql);
        resultList = facade.selectStringList(sql, columnList);
    } catch (Exception continued) {
        // because it's basically assist info
        log("Failed to select first array info: " + continued.getMessage());
        return DfCollectionUtil.emptyList();
    }
    return resultList;
}
Also used : ArrayList(java.util.ArrayList) Map(java.util.Map) StringKeyMap(org.dbflute.helper.StringKeyMap) DfJdbcFacade(org.dbflute.helper.jdbc.facade.DfJdbcFacade)

Example 23 with DfJdbcFacade

use of org.dbflute.helper.jdbc.facade.DfJdbcFacade in project dbflute-core by dbflute.

the class DfStructExtractorOracle method selectStructAttribute.

protected List<Map<String, String>> selectStructAttribute(UnifiedSchema unifiedSchema) {
    final DfJdbcFacade facade = new DfJdbcFacade(_dataSource);
    final List<String> columnList = new ArrayList<String>();
    columnList.add("TYPE_NAME");
    columnList.add("ATTR_NAME");
    columnList.add("ATTR_TYPE_OWNER");
    columnList.add("ATTR_TYPE_NAME");
    columnList.add("LENGTH");
    columnList.add("PRECISION");
    columnList.add("SCALE");
    columnList.add("ATTR_NO");
    final String sql = buildStructAttributeSql(unifiedSchema);
    final List<Map<String, String>> resultList;
    try {
        log(sql);
        resultList = facade.selectStringList(sql, columnList);
    } catch (Exception continued) {
        // because of assist info
        log("Failed to select supplement info: " + continued.getMessage());
        return DfCollectionUtil.emptyList();
    }
    return resultList;
}
Also used : ArrayList(java.util.ArrayList) Map(java.util.Map) StringKeyMap(org.dbflute.helper.StringKeyMap) DfJdbcFacade(org.dbflute.helper.jdbc.facade.DfJdbcFacade)

Aggregations

DfJdbcFacade (org.dbflute.helper.jdbc.facade.DfJdbcFacade)23 Map (java.util.Map)13 ArrayList (java.util.ArrayList)12 StringKeyMap (org.dbflute.helper.StringKeyMap)5 DfJFadStringConverter (org.dbflute.helper.jdbc.facade.DfJFadStringConverter)4 ValueType (org.dbflute.jdbc.ValueType)4 LinkedHashMap (java.util.LinkedHashMap)2 DfJFadCursorCallback (org.dbflute.helper.jdbc.facade.DfJFadCursorCallback)2 SQLException (java.sql.SQLException)1 SQLFailureException (org.dbflute.exception.SQLFailureException)1 DfProcedureArgumentInfo (org.dbflute.logic.jdbc.metadata.info.DfProcedureArgumentInfo)1