當前位置: 首頁>>代碼示例>>Java>>正文


Java ParameterMetaData.getParameterClassName方法代碼示例

本文整理匯總了Java中java.sql.ParameterMetaData.getParameterClassName方法的典型用法代碼示例。如果您正苦於以下問題:Java ParameterMetaData.getParameterClassName方法的具體用法?Java ParameterMetaData.getParameterClassName怎麽用?Java ParameterMetaData.getParameterClassName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.sql.ParameterMetaData的用法示例。


在下文中一共展示了ParameterMetaData.getParameterClassName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writeSQLUDTGRP

import java.sql.ParameterMetaData; //導入方法依賴的package包/類
/**
 * Write SQLUDTGRP (SQL Descriptor User-Defined Type Group Descriptor)
 * 
 * This is the format from the DRDA spec, Volume 1, section 5.6.4.10.
    * However, this format is not rich enough to carry the information needed
    * by JDBC. This format does not have a subtype code for JAVA_OBJECT and
    * this format does not convey the Java class name needed
    * by ResultSetMetaData.getColumnClassName().
 *
 *   SQLUDXTYPE; DRDA TYPE I4; ENVLID 0x02; Length Override 4
    *                        Constants which map to java.sql.Types constants DISTINCT, STRUCT, and REF.
    *                        But DRDA does not define a constant which maps to java.sql.Types.JAVA_OBJECT.
 *   SQLUDTRDB; DRDA TYPE VCS; ENVLID 0x32; Length Override 255
    *                       Database name.
 *   SQLUDTSCHEMA_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 255
 *   SQLUDTSCHEMA_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 255
    *                         Schema name. One of the above.
 *   SQLUDTNAME_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 255
 *   SQLUDTNAME_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 255
    *                         Unqualified UDT name. One of the above.
 *
 * Instead, we use the following format and only for communication between
    * Derby servers and Derby clients which are both at version 10.4 or higher.
    * For all other client/server combinations, we send null.
 *
 *   SQLUDTNAME_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override 255
 *   SQLUDTNAME_s; DRDA TYPE VCS; ENVLID 0x32; Length Override 255
    *                         Fully qualified UDT name. One of the above.
 *   SQLUDTCLASSNAME_m; DRDA TYPE VCM; ENVLID 0x3E; Length Override FdocaConstants.LONGVARCHAR_MAX_LEN
 *   SQLUDTCLASSNAME_s; DRDA TYPE VCS; ENVLID 0x32; Length Override FdocaConstants.LONGVARCHAR_MAX_LEN
    *                         Name of the Java class bound to the UDT. One of the above.
 *
 * @param rsmeta	resultset meta data
 * @param pmeta		parameter meta data
 * @param elemNum	column number we are returning (in case of result set), or,
 *					parameter number (in case of parameter)
 * @param rtnOutput	whether this is for a result set	
 *
 * @throws DRDAProtocolException
    * @throws SQLException
 */
private void writeSQLUDTGRP(ResultSetMetaData rsmeta,
							ParameterMetaData pmeta,
							int jdbcElemNum, boolean rtnOutput)
	throws DRDAProtocolException,SQLException
{
       int jdbcType = rtnOutput ?
           rsmeta.getColumnType( jdbcElemNum) : pmeta.getParameterType( jdbcElemNum );

       if ( !(jdbcType == Types.JAVA_OBJECT) || !appRequester.supportsUDTs() )
       {
           writer.writeByte(CodePoint.NULLDATA);
           return;
       }
       
	String typeName = rtnOutput ?
           rsmeta.getColumnTypeName( jdbcElemNum ) : pmeta.getParameterTypeName( jdbcElemNum );
       String className = rtnOutput ?
           rsmeta.getColumnClassName( jdbcElemNum ) : pmeta.getParameterClassName( jdbcElemNum );
       
	writeVCMorVCS( typeName );
	writeVCMorVCS( className );
}
 
開發者ID:gemxd,項目名稱:gemfirexd-oss,代碼行數:64,代碼來源:DRDAConnThread.java

示例2: setupCallableStatementParams

import java.sql.ParameterMetaData; //導入方法依賴的package包/類
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;                
		}
		
	}
}
 
開發者ID:gemxd,項目名稱:gemfirexd-oss,代碼行數:53,代碼來源:DRDAStatement.java


注:本文中的java.sql.ParameterMetaData.getParameterClassName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。