Example usage for java.sql DatabaseMetaData getFunctionColumns

List of usage examples for java.sql DatabaseMetaData getFunctionColumns

Introduction

In this page you can find the example usage for java.sql DatabaseMetaData getFunctionColumns.

Prototype

ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern,
        String columnNamePattern) throws SQLException;

Source Link

Document

Retrieves a description of the given catalog's system or user function parameters and return type.

Usage

From source file:org.wso2.carbon.dataservices.core.description.query.SQLQuery.java

private Object[] getStoredProcFuncProps(String name) throws DataServiceFault, SQLException {
    Connection conn = this.getConfig().createConnection();
    DatabaseMetaData md = conn.getMetaData();
    ResultSet rs = null;/*from  w  w  w .  j  a  v  a  2  s .  c  o m*/
    boolean error = true;
    try {
        rs = md.getProcedureColumns(null, null, name, "%");
        Object[] resultMap = new Object[2];
        if (!rs.next()) {
            rs.close();
            rs = md.getFunctionColumns(null, null, name, "%");
        } else {
            rs.close();
            rs = md.getProcedureColumns(null, null, name, "%");
        }
        resultMap[0] = conn;
        resultMap[1] = rs;
        error = false;
        return resultMap;
    } finally {
        if (error) {
            this.releaseResources(rs, null);
        }
    }
}