• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ARRAY类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中oracle.sql.ARRAY的典型用法代码示例。如果您正苦于以下问题:Java ARRAY类的具体用法?Java ARRAY怎么用?Java ARRAY使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: debugStatement

import oracle.sql.ARRAY; //导入依赖的package包/类
/** write statement call to log
 *
 * @param userid
 * @param localId
 * @param roles
 * @param newArray
 */
private void debugStatement(String userid, final String localId, final Object[] roles, final ARRAY newArray) {
    StringBuffer buf = new StringBuffer("call jaffa_sec.set_userid(?,?,?) with arg1='")
    .append(userid)
    .append("', arg2='")
    .append(newArray)
    .append("'");
    if (roles != null) {
        buf.append(". Arg2 has the roles: ");
        for (int i = 0; i < roles.length; i++) {
            if (i > 0)
                buf.append(',');
            buf.append(roles[i]);
        }
    }
    buf.append(", arg3='");
    buf.append(localId);
    buf.append("'");

    log.debug(buf.toString());
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:28,代码来源:JDBCSecurityPlugin.java


示例2: createSQLArrayVarchar

import oracle.sql.ARRAY; //导入依赖的package包/类
/** 
* Essa funcao serve para converer um array em Um aray SQL
* @param array O array a ser convertido para o array de base de dados
* @param connect A conexao que sera usada
* @param arrayTypeDataBase nome do aray na base de dados que ira receber o aray
*       CASO for nulo sera mapeado para o TB_ARRAY_STRING
* @return 
*/
public static Array createSQLArrayVarchar (Object [] array, Connection connect, String arrayTypeDataBase)
{
    try 
    {
        arrayTypeDataBase = (arrayTypeDataBase == null)? "TB_ARRAY_STRING": arrayTypeDataBase;
        ArrayDescriptor arryDesc = ArrayDescriptor.createDescriptor(arrayTypeDataBase, connect);
        Array oracleArray = new ARRAY(arryDesc, connect, array);
        OracleConnection oc = (OracleConnection) connect;
        return  oracleArray;
    } catch (SQLException ex) {
        ex.printStackTrace();
        
    }
    return null;
}
 
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:24,代码来源:Call.java


示例3: treatReturn

import oracle.sql.ARRAY; //导入依赖的package包/类
/**
 * Tratar o retorno vido do java
 * @param result
 * @param returnType
 * @return 
 */
@SuppressWarnings("CallToPrintStackTrace")
private static Object treatReturn (Object result, int returnType)
{
    Object currectObject = result;
    try
    {
        if (returnType == ARRAY && result instanceof Array)
        {
            Array r = (Array) result;
            currectObject = new ArrayList<> (Arrays.asList((Object [])r.getArray()));
        }
        else if (Types.STRUCT == returnType)
        {
            System.out.println("dbdkj");
            currectObject = ((Struct) result).getAttributes();
        }
    }catch(Exception ex)
    {
        ex.printStackTrace();
    }
    if(currectObject != null)
        
        System.out.println("RETURN = class{"+currectObject.getClass().getName()+"} | toString = "+currectObject.toString()+"\n");
    return currectObject;
}
 
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:32,代码来源:Call.java


示例4: createArray

import oracle.sql.ARRAY; //导入依赖的package包/类
/**
 * delegated back to DBDriver to take care of driver related issues between
 * Oracle and standard SQL
 *
 * @param con
 * @param values
 * @param dbArrayType
 *            as defined in the RDBMS
 * @return object that is suitable to be assigned to an array parameter
 * @throws SQLException
 */
public static Array createArray(Connection con, Value[] values,
		String dbArrayType) throws SQLException {
	Object[] data = new Object[values.length];
	for (int i = 0; i < values.length; i++) {
		Value val = values[i];
		if (val != null) {
			data[i] = val.toObject();
		}
	}
	if (dbVendor == DbVendor.ORACLE) {
		OracleConnection ocon = toOracleConnection(con);
		ArrayDescriptor ad = ArrayDescriptor.createDescriptor(dbArrayType,
				ocon);
		return new ARRAY(ad, ocon, data);
	}
	return con.createArrayOf(dbArrayType, data);
}
 
开发者ID:raghu-bhandi,项目名称:simplity-kernel,代码行数:29,代码来源:DbDriver.java


示例5: setNonNullParameter

import oracle.sql.ARRAY; //导入依赖的package包/类
@Override
public void setNonNullParameter(PreparedStatement ps, int i, List<String> parameter, JdbcType jdbcType) throws SQLException {
	Connection c = ps.getConnection();
	if (c instanceof DelegatingConnection) {
		Connection pooledConnection = c;
		c = ((DelegatingConnection<?>)c).getInnermostDelegate();
		if (c == null) {
			throw new RuntimeException("Database resource pool configuration error: " + pooledConnection.getClass().getName());
		}
	}

	//drsteini - added to support junit testing
	if (c.isWrapperFor(oracle.jdbc.OracleConnection.class)) {
		c = c.unwrap(oracle.jdbc.OracleConnection.class);
	}

	ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("TYP_VCTBL", c);
	Array array = new ARRAY(descriptor, c, parameter.toArray());
	ps.setArray(i, array);
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:21,代码来源:WqpArrayTypeHandler.java


示例6: registerOutput

import oracle.sql.ARRAY; //导入依赖的package包/类
private void registerOutput(Connection conn, CallableStatement callStmt, CallArgument argument,
        List<Out> outputs) throws SQLException {
    if (argument == null) {
        return;
    }
    AdapterMapping outputAdapter = getOutputAdapter(argument, outputs);
    int argumentIndex = argument.getSequence();
    int argumentType = argument.getSqlType();
    String argumentTypeName = getArgumentTypeName(outputAdapter, argument.getTypeName());
    if (isStructType(argument)) {
        argumentType = Types.STRUCT;
        callStmt.registerOutParameter(argumentIndex, argumentType, argumentTypeName);
    } else if (isArrayOfStructType(argument)) {
        argumentType = Types.ARRAY;
        callStmt.registerOutParameter(argumentIndex, argumentType, argumentTypeName);
    } else {
        callStmt.registerOutParameter(argumentIndex, argumentType);
    }
}
 
开发者ID:qafedev,项目名称:qafe-platform,代码行数:20,代码来源:BaseCall.java


示例7: setUp

import oracle.sql.ARRAY; //导入依赖的package包/类
@Before
public void setUp() throws SQLException, IOException, MjdbcException {
    MockitoAnnotations.initMocks(this);

    when(stmt.getConnection()).thenReturn(conn);
    when(conn.createARRAY(any(String.class), any(Object[].class))).thenReturn(array);

    when(blob.setBinaryStream(1)).thenReturn(output);
    when(clob.setAsciiStream(1)).thenReturn(output);

    when(input.read(any(byte[].class))).thenReturn(-1);
    when(input.read(any(byte[].class), any(int.class), any(int.class))).thenReturn(-1);

    when(blob.getBinaryStream()).thenReturn(input);
    when(clob.getAsciiStream()).thenReturn(input);

    params = new QueryParameters();

    params.set("array_list", Arrays.asList("Superman"), MjdbcTypes.ARRAY);
    params.set("blob_byte", "Batman", MjdbcTypes.BLOB);
    params.set("clob_byte", "Wolverine", MjdbcTypes.CLOB);

    params.set("array", array, MjdbcTypes.ARRAY);
    params.set("blob", blob, MjdbcTypes.BLOB);
    params.set("clob", clob, MjdbcTypes.CLOB);
}
 
开发者ID:pryzach,项目名称:midao,代码行数:27,代码来源:OracleTypeHandlerTest.java


示例8: createAndEvaluateReport

import oracle.sql.ARRAY; //导入依赖的package包/类
public static void createAndEvaluateReport(final String statement, final String methodName, final BLOB template, final ARRAY arguments, final ARRAY[] result) throws SQLException, IOException {
	final Report report;
	boolean isStatementBased = statement != null && statement.trim().length() != 0;
	boolean isFunctionBased = methodName != null && methodName.trim().length() != 0;
	final InputStream $template = template == null ? null : template.getBinaryStream();
	if(isStatementBased && !isFunctionBased)
		report = reportEngine.createReportFromStatement(statement, $template);
	else if(isFunctionBased && !isStatementBased)
		report = reportEngine.createReport(methodName, $template, extractVargs(arguments));
	else {
		if($template != null)
			$template.close();
		throw new RuntimeException("A report must either be statement or function based!");
	}
	
	result[0] = convertListOfCellsToOracleArray(report.evaluateWorkbook());
}
 
开发者ID:michael-simons,项目名称:enerko-reports2,代码行数:18,代码来源:PckEnerkoReports2.java


示例9: readData

import oracle.sql.ARRAY; //导入依赖的package包/类
public List<O2MSyncEventLog> readData(Array oraArray) throws SQLException {
	List<O2MSyncEventLog> eventLogList = null;
	Object[] eventLogArr = (Object[]) oraArray.getArray();
	if (eventLogArr != null && eventLogArr.length > 0) {
		eventLogList = new ArrayList<O2MSyncEventLog>();
		O2MSyncEventLog eventLog = null;
		for (int i = 0; i < eventLogArr.length; i++) {
			eventLog = new O2MSyncEventLog();
			STRUCT attrArrStruct = (STRUCT) eventLogArr[i];
			Object [] attrArr = attrArrStruct.getAttributes();
			eventLog.setLogId(new ObjectId());
			eventLog.setEventId(String.valueOf(attrArr[0]).trim());
			eventLog.setOperation(String.valueOf(attrArr[1]));
			java.sql.Timestamp crOn = (java.sql.Timestamp) attrArr[2];
			if (crOn != null) {
				eventLog.setCrOn(new Date(crOn.getTime()));
			} else {
				eventLog.setCrOn(new Date());
			}
			ARRAY oraFilters = (ARRAY) attrArr[6];
			Object[] filterStructArr = (Object[]) oraFilters.getOracleArray();
			if (filterStructArr != null && filterStructArr.length > 0) {
				List<O2MSyncEventInfo> filterList = new ArrayList<O2MSyncEventInfo>();
				O2MSyncEventInfo filter = null;
				for (int j = 0 ; j < filterStructArr.length; j++) {
					STRUCT filterAttrArrStruct = (STRUCT) filterStructArr[j];
					Object[] filterAttrArr = filterAttrArrStruct.getAttributes();
					filter = new O2MSyncEventInfo();
					filter.setTableName(String.valueOf(filterAttrArr[0]).trim());
					filter.setColumnName(String.valueOf(filterAttrArr[1]).trim());
					filter.setColumnValue(String.valueOf(filterAttrArr[2]));
					filterList.add(filter);
				}
				eventLog.setEventFilters(filterList);
			}
			eventLogList.add(eventLog);
		}
	}
	return eventLogList;
}
 
开发者ID:gagoyal01,项目名称:mongodb-rdbms-sync,代码行数:41,代码来源:O2MSyncDataLoader.java


示例10: executeStoredProcedure

import oracle.sql.ARRAY; //导入依赖的package包/类
protected void executeStoredProcedure(final Connection pooledConnection, final String userid) throws java.sql.SQLException {
    CallableStatement cs = null;

    final String localId = (String) ContextManagerFactory.instance().getProperty(LOCAL_ID);
    Object[] roles = getUserRoles(userid).toArray();
    ARRAY newArray = null;

    Connection connection = null;
    try {
        // Extract the actual oracle connection
        connection = pooledConnection.unwrap(oracle.jdbc.OracleConnection.class);
        if (!(connection instanceof oracle.jdbc.OracleConnection)) {
        	throw new Exception(String.format("Not an Oracle Connection : %s",connection.getClass().getName()));
        }

        cs = connection.prepareCall(CALL_JAFFA_SEC_SET_USERID);
        cs.setString(1,userid);

        newArray = ((oracle.jdbc.OracleConnection)connection).createARRAY(ROLE,roles);
        cs.setArray(2,newArray);
        cs.setString(3,localId);

        if (log.isDebugEnabled()) {
            // Log the call to the stored procedure
            debugStatement(userid, localId, roles, newArray);
        }

        if(log.isDebugEnabled()) log.debug("Calling the Stored Procedure to Set the Context");
        cs.execute();
        connection.commit();
    }
    catch (Exception exception) {
    	final String message = String.format(String.format(SET_THE_CONTEXT_ERROR_MESSAGE,exception.getMessage()));
        log.error(message, exception);
        if (connection != null)
        	connection.rollback();
        throw new UOWSecurityException(message, exception);
    }
    finally {
        roles = null;
        if (newArray != null)
            newArray.free();
        if (cs != null) {
            cs.clearParameters();
            cs.close();
            cs = null;
        }
    }
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:50,代码来源:JDBCSecurityPlugin.java


示例11: callSampleFunction

import oracle.sql.ARRAY; //导入依赖的package包/类
/**
 * Funcao para   invocara as funcaoe simples da base de dado
 * Serve para invocar as funcoes que se deve usar o {? = call ...}
 * @param functionName O nome da funcao em base de dados que se quer chamar
 * @param returnType O que sera retornado por ela
 * @param parans Os parametros de entrada na funcao {Atencao que a ordem dos parametros deve ser igual a sua ordem na base de dados}
 * @return O retorno sera um objecto do tipo definido
 */
@SuppressWarnings("CallToPrintStackTrace")
public static Object callSampleFunction (String functionName, int returnType, Object ... parans)
{
    if(!EstadoConnexao.isValid) return null;
    try 
    {
        CallableStatement call;
        Object result;
        // Criar as interoganocoes necessaria para a invocacao da funcao ex (?, ?, ?, ...) || nada
        try (Connection con = new Conexao().getCon()) 
        {
            if(con==null)
            {
                return null;
            }
            // Criar as interoganocoes necessaria para a invocacao da funcao ex (?, ?, ?, ...) || nada
            String interogations = (parans != null && parans.length>0)? createInterogation(parans.length): "";
            //Associa ao call e o nome da funcao
            String sql = "{? = call "+functionName+interogations+"}";
            //Mapear e setar os parametros no call
            call = mapParamsType(con, sql, 2, parans);
            if (returnType == Call.ARRAY) call.registerOutParameter(1, ARRAY, "TB_ARRAY_STRING");
            else if(returnType == Types.STRUCT) 
                call.registerOutParameter(1,returnType, "TP_OBJECT");
            else 
                call.registerOutParameter(1, returnType);
            call.execute();
            result = Call.treatReturn(call.getObject(1), returnType);
            
        }call.close();
        return  result;
            
    } catch (Exception e) {
        e.printStackTrace();
    }
    return  null;
}
 
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:46,代码来源:Call.java


示例12: getTypeDescriptor

import oracle.sql.ARRAY; //导入依赖的package包/类
private TypeDescriptor getTypeDescriptor(Connection nativeConn, int dataType, String dataTypeName)
        throws SQLException {
    if (dataType == Types.STRUCT) {
        StructDescriptor structDescriptor = StructDescriptor.createDescriptor(dataTypeName, nativeConn);
        return structDescriptor;
    }
    if (dataType == Types.ARRAY) {
        ArrayDescriptor arrayDescriptor = ArrayDescriptor.createDescriptor(dataTypeName, nativeConn);
        return arrayDescriptor;
    }
    return null;
}
 
开发者ID:qafedev,项目名称:qafe-platform,代码行数:13,代码来源:BaseCall.java


示例13: setUp

import oracle.sql.ARRAY; //导入依赖的package包/类
@Before
public void setUp() throws SQLException, IOException, MjdbcException {
    MockitoAnnotations.initMocks(this);

    when(stmt.getConnection()).thenReturn(conn);
    when(conn.createARRAY(any(String.class), any(Object[].class))).thenReturn(array);
    when(MappingUtils.invokeFunction(conn, "createBlob", new Class[]{}, new Object[]{})).thenReturn(blob);
    when(MappingUtils.invokeFunction(conn, "createClob", new Class[]{}, new Object[]{})).thenReturn(clob);

    when(blob.setBinaryStream(1)).thenReturn(output);
    when(clob.setAsciiStream(1)).thenReturn(output);

    when(input.read(any(byte[].class))).thenReturn(-1);
    when(input.read(any(byte[].class), any(int.class), any(int.class))).thenReturn(-1);

    when(blob.getBinaryStream()).thenReturn(input);
    when(clob.getAsciiStream()).thenReturn(input);

    params = new QueryParameters();

    params.set("array_list", Arrays.asList("Superman"), MjdbcTypes.ARRAY);
    params.set("blob_byte", "Batman", MjdbcTypes.BLOB);
    params.set("clob_byte", "Wolverine", MjdbcTypes.CLOB);

    params.set("array", array, MjdbcTypes.ARRAY);
    params.set("blob", blob, MjdbcTypes.BLOB);
    params.set("clob", clob, MjdbcTypes.CLOB);
}
 
开发者ID:pryzach,项目名称:midao,代码行数:29,代码来源:OracleTypeHandlerTest.java


示例14: extractVargs

import oracle.sql.ARRAY; //导入依赖的package包/类
private static String[] extractVargs(final ARRAY arguments) throws SQLException {
	final String[] $arguments;
	if(arguments == null)
		$arguments = new String[0];
	else {
		$arguments = new String[arguments.length()];
		final ResultSet hlp = arguments.getResultSet();
		int i = 0;
		while(hlp.next()) {
			// The actual data resides at index 2
			$arguments[i++] = hlp.getString(2);
		}
	}
	return $arguments;
}
 
开发者ID:michael-simons,项目名称:enerko-reports2,代码行数:16,代码来源:PckEnerkoReports2.java


示例15: convertListOfCellsToOracleArray

import oracle.sql.ARRAY; //导入依赖的package包/类
private static ARRAY convertListOfCellsToOracleArray(final List<CellDefinition> cellDefinitions) throws SQLException {
	final StructDescriptor resultStruct = StructDescriptor.createDescriptor("T_ER_CELL_DEFINITION", connection);
	final ArrayDescriptor  arrayDesc = ArrayDescriptor.createDescriptor("TABLE_OF_ER_CELL_DEFINITIONS", connection);
	
	final STRUCT[] rv = new STRUCT[cellDefinitions.size()];						
	int i=0;
	for(CellDefinition cellDefinition : cellDefinitions)
		rv[i++] = new STRUCT(resultStruct, connection, cellDefinition.toSQLStructObject());		
	return new ARRAY(arrayDesc, connection, rv);
}
 
开发者ID:michael-simons,项目名称:enerko-reports2,代码行数:11,代码来源:PckEnerkoReports2.java


示例16: getARRAY

import oracle.sql.ARRAY; //导入依赖的package包/类
@Override
public ARRAY getARRAY(int paramInt) throws SQLException {
	return oracleRs.getARRAY(paramInt);
}
 
开发者ID:dd00f,项目名称:ibm-performance-monitor,代码行数:5,代码来源:WrappedOracleResultSet.java


示例17: updateARRAY

import oracle.sql.ARRAY; //导入依赖的package包/类
@Override
public void updateARRAY(int paramInt, ARRAY paramARRAY) throws SQLException {
	oracleRs.updateARRAY(paramInt, paramARRAY);

}
 
开发者ID:dd00f,项目名称:ibm-performance-monitor,代码行数:6,代码来源:WrappedOracleResultSet.java


示例18: setARRAY

import oracle.sql.ARRAY; //导入依赖的package包/类
@Override
public void setARRAY(int paramInt, ARRAY paramARRAY) throws SQLException {
	oraclePs.setARRAY(paramInt, paramARRAY);

}
 
开发者ID:dd00f,项目名称:ibm-performance-monitor,代码行数:6,代码来源:WrappedOracleCallableStatement.java


示例19: setARRAYAtName

import oracle.sql.ARRAY; //导入依赖的package包/类
@Override
public void setARRAYAtName(String paramString, ARRAY paramARRAY)
		throws SQLException {
	oraclePs.setARRAYAtName(paramString, paramARRAY);

}
 
开发者ID:dd00f,项目名称:ibm-performance-monitor,代码行数:7,代码来源:WrappedOracleCallableStatement.java


示例20: getARRAY

import oracle.sql.ARRAY; //导入依赖的package包/类
@Override
public ARRAY getARRAY(int paramInt) throws SQLException {
	return oraclePs.getARRAY(paramInt);
}
 
开发者ID:dd00f,项目名称:ibm-performance-monitor,代码行数:5,代码来源:WrappedOracleCallableStatement.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FormatConversionProvider类代码示例发布时间:2022-05-21
下一篇:
Java ErrorHandlers类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap