当前位置: 首页>>代码示例>>Java>>正文


Java DatabaseMetaData.procedureColumnIn方法代码示例

本文整理汇总了Java中java.sql.DatabaseMetaData.procedureColumnIn方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseMetaData.procedureColumnIn方法的具体用法?Java DatabaseMetaData.procedureColumnIn怎么用?Java DatabaseMetaData.procedureColumnIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.sql.DatabaseMetaData的用法示例。


在下文中一共展示了DatabaseMetaData.procedureColumnIn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toString

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
public String toString()
{
	ListCoupleRender lst = ListCoupleRender.set("Column description: ");
	if(m_sColType == DatabaseMetaData.procedureColumnOut)
		lst.set("Way", "Out");
	if(m_sColType == DatabaseMetaData.procedureColumnIn)
		lst.set("Way", "In");
	if(m_sColType == DatabaseMetaData.procedureColumnInOut)
		lst.set("Way", "InOut");
	
	lst.set("Name", m_colDescriptionInfo.m_csColName);
	lst.set("Type", m_colDescriptionInfo.m_nTypeId);
	lst.set("Precision", m_colDescriptionInfo.m_nPrecision);
	lst.set("Length", m_nLength);
	lst.set("Scale", m_sScale);
	lst.set("Radix", m_sRadix);
	lst.set("Nullable", m_sNullable);
	lst.set("Remarks", m_csRemarks);
	
	return lst.toString();
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:22,代码来源:StoredProcParamDescBase.java

示例2: getProcedureDirection

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:JDBCUtils.java

示例3: prepareParameters

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
private void prepareParameters(PreparedStatement preparedStatement, SqlQueryInfos sqlQueryInfos) throws SQLException{ 
	Map<String, String> values = sqlQueryInfos.getParametersMap();
	List<Map<String, Object>> parameterList = getProcedureParameters(connection, sqlQueryInfos);
	int i = 1;
	for (Map<String, Object> parameterMap : parameterList) {
		boolean isIn = false, isOut = false;
		String param_name = (String) parameterMap.get("COLUMN_NAME");
		int param_mode = (Integer) parameterMap.get("COLUMN_TYPE");
		int param_type = (Integer) parameterMap.get("DATA_TYPE");
           switch (param_mode) {
  	    	case DatabaseMetaData.procedureColumnIn :
  	    		isIn = true;
 	        	break; 
  	    	case DatabaseMetaData.procedureColumnInOut :
  	    		isIn = true; isOut = true;
 	        	break; 
  	    	case DatabaseMetaData.procedureColumnOut :
  	    	case DatabaseMetaData.procedureColumnReturn :
  	    	case DatabaseMetaData.procedureColumnResult :
  	    		isOut = true;
 	        	break; 
  	    	case DatabaseMetaData.procedureColumnUnknown : 
  	    	default :
  	    		break;  
           }
           
           if (isOut) {
           	Engine.logBeans.trace("[SqlConnector] Registering OUT parameter at index "+i);
           	((CallableStatement)preparedStatement).registerOutParameter(i, param_type);
           }
           
           if (isIn) {
           	Engine.logBeans.trace("[SqlConnector] Setting IN parameter at index "+i);
           	Object java_value = null;
			try {
            	String param_in = StringUtils.normalize(param_name);
				java_value = getParameterJavaValue(param_type, values.get(param_in));
				if (java_value == null) {// param name differs from variable name
					List<String> params = sqlQueryInfos.getOrderedParametersList();
					int j = parameterList.size() - values.size();
					java_value = getParameterJavaValue(param_type, values.get(params.get(i-j-1)));
				}
				preparedStatement.setObject(i , java_value);
			} catch (Exception e) {
				Engine.logBeans.warn("[SqlConnector] Error generating value for parameter at index "+i, e);
				preparedStatement.setNull(i, Types.OTHER);
			}
           }
           i++;
	}
	
	Engine.logBeans.trace("[SqlConnector] Preparing statement done");
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:54,代码来源:SqlConnector.java

示例4: createSqlTransaction

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
public static SqlTransaction createSqlTransaction(SqlConnector sqlConnector, String callableName, String specific_name) throws EngineException, ClassNotFoundException, SQLException {
	SqlTransaction sqlTransaction = null;
	if (sqlConnector != null && !callableName.isEmpty()) {
		// get a connection
		sqlConnector.open();
		
		// Create transaction
		sqlTransaction = sqlConnector.newTransaction();
		sqlTransaction.setName("Call_"+StringUtils.normalize(callableName));
		sqlTransaction.hasChanged = true;
		sqlTransaction.bNew = true;
		
		// Build sqlQuery and retrieve parameters
		boolean isFunction = false;
		String sqlQuery = "CALL "+ callableName +"(";
		Connection connection = sqlConnector.connection;
		List<Map<String, Object>> parameterList = getProcedureParameters(connection, callableName);
		for (Map<String, Object> parameterMap : parameterList) {
			String proc_specific_name = (String) parameterMap.get("SPECIFIC_NAME");
			if (specific_name.equals(proc_specific_name)) {
				String param_name = (String) parameterMap.get("COLUMN_NAME");
				int param_mode = (Integer) parameterMap.get("COLUMN_TYPE");
				//int param_type = (Integer) parameterMap.get("DATA_TYPE");
	            switch(param_mode) {
		  	    	case DatabaseMetaData.procedureColumnReturn :
		  	    	case DatabaseMetaData.procedureColumnResult :
		  	    		isFunction = true;
		  	    		break;
	  	    		case DatabaseMetaData.procedureColumnIn :
		  	    	case DatabaseMetaData.procedureColumnInOut :
		  	    		// update query and create input variable
		  	    		if (param_name != null && !param_name.isEmpty()) {
		  	    			RequestableVariable variable = new RequestableVariable();
		  	    			variable.setName(StringUtils.normalize(param_name));
		  	    			variable.hasChanged = true;
		  	    			variable.bNew = true;
		  	    			
			  	    		sqlQuery += sqlQuery.endsWith("(") ? "":",";
			  	    		sqlQuery += "{"+ variable.getName()+"}";
		  	    			
		  	    			sqlTransaction.addVariable(variable);
		  	    		}
		  	    		else {
			  	    		sqlQuery += sqlQuery.endsWith("(") ? "?":",?";
		  	    		}
		  	    		break;
		  	    	case DatabaseMetaData.procedureColumnOut :
		  	    		sqlQuery += sqlQuery.endsWith("(") ? "?":",?";
		  	    		break;
		  	    	case DatabaseMetaData.procedureColumnUnknown : 
		  	    	default :
		  	    		break;  
	            }
			}
		}
		sqlQuery += ")";
		if (isFunction) {
			sqlQuery = "? = "+ sqlQuery;
		}
		sqlQuery = "{"+sqlQuery+"}";
		sqlTransaction.setSqlQuery(sqlQuery);
		
		// close connection
		sqlConnector.close();
	}
	return sqlTransaction;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:68,代码来源:SqlConnector.java

示例5: isColIn

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
public boolean isColIn()
{
	if(m_sColType == DatabaseMetaData.procedureColumnIn)
		return true;
	return false;
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:7,代码来源:StoredProcParamDescBase.java


注:本文中的java.sql.DatabaseMetaData.procedureColumnIn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。