Java Code Examples for java.sql.DatabaseMetaData#procedureColumnIn()

The following examples show how to use java.sql.DatabaseMetaData#procedureColumnIn() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LangProcedureTest.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
static String PARAMTYPE(short type) {
    switch (type) {
    case DatabaseMetaData.procedureColumnUnknown:
        return "procedureColumnUnknown";
    case DatabaseMetaData.procedureColumnIn:
        return "procedureColumnIn";
    case DatabaseMetaData.procedureColumnInOut:
        return "procedureColumnInOut";
    case DatabaseMetaData.procedureColumnOut:
        return "procedureColumnOut";
    case DatabaseMetaData.procedureColumnReturn:
        return "procedureColumnReturn";
    case DatabaseMetaData.procedureColumnResult:
        return "procedureColumnResult";
    default:
        return "???";
    }
}
 
Example 2
Source File: GetProcedureColumns.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
private int translate(int val) {
if (!isFunction) { return val; }
switch (val) {
case DatabaseMetaData.procedureColumnUnknown:
	return JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN;	
case DatabaseMetaData.procedureColumnIn:
	return JDBC40Translation.FUNCTION_PARAMETER_IN;
case DatabaseMetaData.procedureColumnInOut:
	return JDBC40Translation.FUNCTION_PARAMETER_INOUT;	
case DatabaseMetaData.procedureColumnOut:
	return JDBC40Translation.FUNCTION_PARAMETER_OUT;
case DatabaseMetaData.procedureColumnReturn:
	return JDBC40Translation.FUNCTION_RETURN;
default:
	return JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN;	
}
  }
 
Example 3
Source File: LangProcedureTest.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
static String PARAMTYPE(short type) {
    switch (type) {
    case DatabaseMetaData.procedureColumnUnknown:
        return "procedureColumnUnknown";
    case DatabaseMetaData.procedureColumnIn:
        return "procedureColumnIn";
    case DatabaseMetaData.procedureColumnInOut:
        return "procedureColumnInOut";
    case DatabaseMetaData.procedureColumnOut:
        return "procedureColumnOut";
    case DatabaseMetaData.procedureColumnReturn:
        return "procedureColumnReturn";
    case DatabaseMetaData.procedureColumnResult:
        return "procedureColumnResult";
    default:
        return "???";
    }
}
 
Example 4
Source File: GetProcedureColumns.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
private int translate(int val) {
if (!isFunction) { return val; }
switch (val) {
case DatabaseMetaData.procedureColumnUnknown:
	return JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN;	
case DatabaseMetaData.procedureColumnIn:
	return JDBC40Translation.FUNCTION_PARAMETER_IN;
case DatabaseMetaData.procedureColumnInOut:
	return JDBC40Translation.FUNCTION_PARAMETER_INOUT;	
case DatabaseMetaData.procedureColumnOut:
	return JDBC40Translation.FUNCTION_PARAMETER_OUT;
case DatabaseMetaData.procedureColumnReturn:
	return JDBC40Translation.FUNCTION_RETURN;
default:
	return JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN;	
}
  }
 
Example 5
Source File: GetProcedureColumns.java    From spliceengine with GNU Affero General Public License v3.0 6 votes vote down vote up
private int translate(int val) {
if (!isFunction) { return val; }
switch (val) {
case DatabaseMetaData.procedureColumnUnknown:
	return JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN;	
case DatabaseMetaData.procedureColumnIn:
	return JDBC40Translation.FUNCTION_PARAMETER_IN;
case DatabaseMetaData.procedureColumnInOut:
	return JDBC40Translation.FUNCTION_PARAMETER_INOUT;	
case DatabaseMetaData.procedureColumnOut:
	return JDBC40Translation.FUNCTION_PARAMETER_OUT;
case DatabaseMetaData.procedureColumnReturn:
	return JDBC40Translation.FUNCTION_RETURN;
default:
	return JDBC40Translation.FUNCTION_PARAMETER_UNKNOWN;	
}
  }
 
Example 6
Source File: LangProcedureTest.java    From spliceengine with GNU Affero General Public License v3.0 6 votes vote down vote up
static String PARAMTYPE(short type) {
    switch (type) {
    case DatabaseMetaData.procedureColumnUnknown:
        return "procedureColumnUnknown";
    case DatabaseMetaData.procedureColumnIn:
        return "procedureColumnIn";
    case DatabaseMetaData.procedureColumnInOut:
        return "procedureColumnInOut";
    case DatabaseMetaData.procedureColumnOut:
        return "procedureColumnOut";
    case DatabaseMetaData.procedureColumnReturn:
        return "procedureColumnReturn";
    case DatabaseMetaData.procedureColumnResult:
        return "procedureColumnResult";
    default:
        return "???";
    }
}
 
Example 7
Source File: JDBCUtils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static Direction getProcedureDirection(short sqlDirection) {
    switch (sqlDirection) {
        case DatabaseMetaData.procedureColumnOut:
            return Direction.OUT;
        case DatabaseMetaData.procedureColumnInOut:
            return Direction.INOUT;
        case DatabaseMetaData.procedureColumnIn:
            return Direction.IN;
        default:
            LOGGER.log(Level.INFO, "Unknown direction value from DatabaseMetadata.getProcedureColumns(): " + sqlDirection);
            return Direction.IN;
    }
}
 
Example 8
Source File: CsharpSpParamResultSetExtractor.java    From dal with Apache License 2.0 5 votes vote down vote up
@Override
public List<AbstractParameterHost> extract(ResultSet rs) throws SQLException {
    List<AbstractParameterHost> parameters = new ArrayList<>();
    while (rs.next()) {
        int paramMode = rs.getShort("COLUMN_TYPE");

        if (!DbUtils.validMode.contains(paramMode)) {
            continue;
        }

        CSharpParameterHost host = new CSharpParameterHost();
        DbType dbType = DbUtils.getDotNetDbType(rs.getString("TYPE_NAME"), rs.getInt("DATA_TYPE"),
                rs.getInt("LENGTH"), false, null);
        host.setDbType(dbType);
        host.setNullable(rs.getShort("NULLABLE") == DatabaseMetaData.columnNullable);

        if (paramMode == DatabaseMetaData.procedureColumnIn) {
            host.setDirection(ParameterDirection.Input);
        } else if (paramMode == DatabaseMetaData.procedureColumnInOut) {
            host.setDirection(ParameterDirection.InputOutput);
        } else {
            host.setDirection(ParameterDirection.Output);
        }

        host.setName(rs.getString("COLUMN_NAME"));
        host.setType(DbType.getCSharpType(host.getDbType()));
        host.setNullable(rs.getShort("NULLABLE") == DatabaseMetaData.columnNullable);

        if (host.getType() == null) {
            host.setType("string");
            host.setDbType(DbType.AnsiString);
        }
        parameters.add(host);
    }
    return parameters;
}
 
Example 9
Source File: JavaSpParamResultSetExtractor.java    From das with Apache License 2.0 4 votes vote down vote up
@Override
public List<AbstractParameterHost> extract(ResultSet rs) throws SQLException {
    List<AbstractParameterHost> parameters = new ArrayList<>();
    try {
        while (rs.next()) {
            int paramMode = rs.getShort("COLUMN_TYPE");
            if (!DbUtils.validMode.contains(paramMode)) {
                continue;
            }

            JavaParameterHost host = new JavaParameterHost();
            host.setSqlType(rs.getInt("DATA_TYPE"));

            if (paramMode == DatabaseMetaData.procedureColumnIn) {
                host.setDirection(ParameterDirection.Input);
            } else if (paramMode == DatabaseMetaData.procedureColumnInOut) {
                host.setDirection(ParameterDirection.InputOutput);
            } else {
                host.setDirection(ParameterDirection.Output);
            }

            host.setName(rs.getString("COLUMN_NAME").replace("@", ""));
            Class<?> javaClass = CodeGenConsts.jdbcSqlTypeToJavaClass.get(host.getSqlType());
            if (null == javaClass) {
                if (-153 == host.getSqlType()) {
                    /*
                     * log.error(String.format("The Table-Valued Parameters is not support for JDBC. [%s, %s]",
                     * allInOneName, spName));
                     */
                } else {
                    /*
                     * log.fatal(String.format("The java type cant be mapped.[%s, %s, %s, %s, %s]", host.getName(),
                     * allInOneName, spName, host.getSqlType(), javaClass));
                     */
                }
                return null;
            }
            host.setJavaClass(javaClass);
            parameters.add(host);
        }
    } catch (Throwable e) {
        throw e;
    }
    return parameters;
}
 
Example 10
Source File: JavaSpParamResultSetExtractor.java    From dal with Apache License 2.0 4 votes vote down vote up
@Override
public List<AbstractParameterHost> extract(ResultSet rs) throws SQLException {
    List<AbstractParameterHost> parameters = new ArrayList<>();
    try {
        while (rs.next()) {
            int paramMode = rs.getShort("COLUMN_TYPE");
            if (!DbUtils.validMode.contains(paramMode)) {
                continue;
            }

            JavaParameterHost host = new JavaParameterHost();
            host.setSqlType(rs.getInt("DATA_TYPE"));

            if (paramMode == DatabaseMetaData.procedureColumnIn) {
                host.setDirection(ParameterDirection.Input);
            } else if (paramMode == DatabaseMetaData.procedureColumnInOut) {
                host.setDirection(ParameterDirection.InputOutput);
            } else {
                host.setDirection(ParameterDirection.Output);
            }

            host.setName(rs.getString("COLUMN_NAME").replace("@", ""));
            Class<?> javaClass = Consts.jdbcSqlTypeToJavaClass.get(host.getSqlType());
            if (null == javaClass) {
                if (-153 == host.getSqlType()) {
                    /*
                     * log.error(String.format("The Table-Valued Parameters is not support for JDBC. [%s, %s]",
                     * allInOneName, spName));
                     */
                } else {
                    /*
                     * log.fatal(String.format("The java type cant be mapped.[%s, %s, %s, %s, %s]", host.getName(),
                     * allInOneName, spName, host.getSqlType(), javaClass));
                     */
                }
                return null;
            }
            host.setJavaClass(javaClass);
            parameters.add(host);
        }
    } catch (Throwable e) {
        throw e;
    }
    return parameters;
}