Java Code Examples for java.sql.ParameterMetaData#getParameterMode()

The following examples show how to use java.sql.ParameterMetaData#getParameterMode() . 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: JdbcParameterMeta.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param meta Param metadata.
 * @param order Param order.
 * @throws SQLException On errror.
 */
public JdbcParameterMeta(ParameterMetaData meta, int order) throws SQLException {
    isNullable = meta.isNullable(order);
    signed = meta.isSigned(order);
    precision = meta.getPrecision(order);
    scale = meta.getScale(order);
    type = meta.getParameterType(order);
    typeName = meta.getParameterTypeName(order);
    typeClass = meta.getParameterClassName(order);
    mode = meta.getParameterMode(order);
}
 
Example 2
Source File: DRDAStatement.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
private void setupCallableStatementParams(CallableStatement cs) throws SQLException
{
	ParameterMetaData pmeta = getParameterMetaData();
	int numElems = pmeta.getParameterCount();

	for ( int i = 0; i < numElems; i ++)
	{
		boolean outputFlag = false;
		
		int parameterMode = pmeta.getParameterMode(i + 1);
		int parameterType = pmeta.getParameterType(i + 1);
                       int parameterPrecision = pmeta.getPrecision(i + 1);
                       int parameterScale = pmeta.getScale(i + 1);

		switch (parameterMode) {
			case JDBC30Translation.PARAMETER_MODE_IN:
				break;
			case JDBC30Translation.PARAMETER_MODE_OUT:
			case JDBC30Translation.PARAMETER_MODE_IN_OUT:
				outputFlag = true;
				break;
			case JDBC30Translation.PARAMETER_MODE_UNKNOWN:
				// It's only unknown if array
				String objectType = pmeta.getParameterClassName(i+1);
				parameterType =
					getOutputParameterTypeFromClassName(objectType);
				if (parameterType  != NOT_OUTPUT_PARAM)
					outputFlag = true;
		}

		if (outputFlag)
		{
			if (outputTypes == null) //not initialized yet, since previously none output
			{
				outputTypes = new int[numElems];
				outputPrecision = new int [numElems];
				outputScale = new int [numElems];
				for (int j = 0; j < numElems; j++) {
					outputTypes[j] = NOT_OUTPUT_PARAM;  //default init value
					outputPrecision[j] = NOT_OUTPUT_PARAM;
					outputScale[j] = NOT_OUTPUT_PARAM;
				}
			}
			// save the output type so we can register when we parse
			// the SQLDTA
			outputTypes[i] = parameterType;
			outputPrecision[i] = parameterPrecision;
			outputScale[i] = parameterScale;                
		}
		
	}
}
 
Example 3
Source File: UnsupportedOperationParameterMetaTest.java    From shardingsphere with Apache License 2.0 4 votes vote down vote up
@Test(expected = SQLFeatureNotSupportedException.class)
public void assertGetParameterMode() throws SQLException {
    for (ParameterMetaData each : parameterMetaData) {
        each.getParameterMode(1);
    }
}
 
Example 4
Source File: DRDAStatement.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
private void setupCallableStatementParams(CallableStatement cs) throws SQLException
{
	ParameterMetaData pmeta = getParameterMetaData();
	int numElems = pmeta.getParameterCount();

	for ( int i = 0; i < numElems; i ++)
	{
		boolean outputFlag = false;
		
		int parameterMode = pmeta.getParameterMode(i + 1);
		int parameterType = pmeta.getParameterType(i + 1);
                       int parameterPrecision = pmeta.getPrecision(i + 1);
                       int parameterScale = pmeta.getScale(i + 1);

		switch (parameterMode) {
			case JDBC30Translation.PARAMETER_MODE_IN:
				break;
			case JDBC30Translation.PARAMETER_MODE_OUT:
			case JDBC30Translation.PARAMETER_MODE_IN_OUT:
				outputFlag = true;
				break;
			case JDBC30Translation.PARAMETER_MODE_UNKNOWN:
				// It's only unknown if array
				String objectType = pmeta.getParameterClassName(i+1);
				parameterType =
					getOutputParameterTypeFromClassName(objectType);
				if (parameterType  != NOT_OUTPUT_PARAM)
					outputFlag = true;
		}

		if (outputFlag)
		{
			if (outputTypes == null) //not initialized yet, since previously none output
			{
				outputTypes = new int[numElems];
				outputPrecision = new int [numElems];
				outputScale = new int [numElems];
				for (int j = 0; j < numElems; j++) {
					outputTypes[j] = NOT_OUTPUT_PARAM;  //default init value
					outputPrecision[j] = NOT_OUTPUT_PARAM;
					outputScale[j] = NOT_OUTPUT_PARAM;
				}
			}
			// save the output type so we can register when we parse
			// the SQLDTA
			outputTypes[i] = parameterType;
			outputPrecision[i] = parameterPrecision;
			outputScale[i] = parameterScale;                
		}
		
	}
}
 
Example 5
Source File: DRDAStatement.java    From spliceengine with GNU Affero General Public License v3.0 4 votes vote down vote up
private void setupCallableStatementParams(CallableStatement cs) throws SQLException
{
	ParameterMetaData pmeta = getParameterMetaData();
	int numElems = pmeta.getParameterCount();

	for ( int i = 0; i < numElems; i ++)
	{
		boolean outputFlag = false;
		
		int parameterMode = pmeta.getParameterMode(i + 1);
		int parameterType = pmeta.getParameterType(i + 1);
                       int parameterPrecision = pmeta.getPrecision(i + 1);
                       int parameterScale = pmeta.getScale(i + 1);

		switch (parameterMode) {
			case JDBC30Translation.PARAMETER_MODE_IN:
				break;
			case JDBC30Translation.PARAMETER_MODE_OUT:
			case JDBC30Translation.PARAMETER_MODE_IN_OUT:
				outputFlag = true;
				break;
			case JDBC30Translation.PARAMETER_MODE_UNKNOWN:
				// It's only unknown if array
				String objectType = pmeta.getParameterClassName(i+1);
				parameterType =
					getOutputParameterTypeFromClassName(objectType);
				if (parameterType  != NOT_OUTPUT_PARAM)
					outputFlag = true;
		}

		if (outputFlag)
		{
			if (outputTypes == null) //not initialized yet, since previously none output
			{
				outputTypes = new int[numElems];
				outputPrecision = new int [numElems];
				outputScale = new int [numElems];
				for (int j = 0; j < numElems; j++) {
					outputTypes[j] = NOT_OUTPUT_PARAM;  //default init value
					outputPrecision[j] = NOT_OUTPUT_PARAM;
					outputScale[j] = NOT_OUTPUT_PARAM;
				}
			}
			// save the output type so we can register when we parse
			// the SQLDTA
			outputTypes[i] = parameterType;
			outputPrecision[i] = parameterPrecision;
			outputScale[i] = parameterScale;                
		}
		
	}
}