java/src/main/java/com/genexus/db/driver/CursorFactory.java
/**
	 * Agrega un nuevo cursor en el pool.
	 */
Agrega un nuevo cursor en el pool.
Agrega un nuevo cursor en el pool .
private PreparedStatement addElement(int handle, String cursorId, String sqlSentence, boolean currentOf, boolean callable) throws SQLException
	{
		int i;
		PreparedStatement statement = null;
		if	(maxSize == 0)
		{
			if	(callable)
				return jdbcConnection.prepareCall(sqlSentence);
			else
				return jdbcConnection.prepareStatement(sqlSentence, handle, cursorId);
		}
		for(i = 0; i < maxSize && arrayIds[i] != null; ++i);
		if	(i == maxSize)
		{
			i = dropOlderCursor();
		}
		if	(callable)
			statement     = jdbcConnection.prepareCall(sqlSentence);
		else
			statement     = jdbcConnection.prepareStatement(sqlSentence, handle, cursorId);
		arrayIds[i]   = cursorId;
		timeStamps[i] = System.currentTimeMillis();
		data[i]       = new SQLCursorData(sqlSentence, statement);
		preparedStatements.put(statement, data[i]);
		if	(DEBUG)
			jdbcConnection.log(GXDBDebug.LOG_MED, "GX: Preparing new cursor " + cursorId + " - " + sqlSentence);
		if	(currentOf && jdbcConnection.getDBMS() instanceof GXDBMSas400)
                {
                  try
                  {
                    statement.setCursorName(cursorId);
                  }
                  catch(SQLException e)
                  {
                    data[i]       = null;
                    arrayIds[i]   = null;
                    timeStamps[i] = 0;
                    preparedStatements.remove(statement);
                    throw e;
                  }
                }
        usedCursors++;
		((GXPreparedStatement) statement).setHandle(handle);
		return statement;
	}
private PreparedStatement addElement ( int handle , String cursorId , String sqlSentence , boolean currentOf , boolean callable ) throws SQLException { int i ; PreparedStatement statement = null ; if ( maxSize == 0 ) { if ( callable ) return jdbcConnection . prepareCall ( sqlSentence ) ; else return jdbcConnection . prepareStatement ( sqlSentence , handle , cursorId ) ; } for ( i = 0 ; i < maxSize && arrayIds [ i ] != null ; ++ i ) ; if ( i == maxSize ) { i = dropOlderCursor ( ) ; } if ( callable ) statement = jdbcConnection . prepareCall ( sqlSentence ) ; else statement = jdbcConnection . prepareStatement ( sqlSentence , handle , cursorId ) ; arrayIds [ i ] = cursorId ; timeStamps [ i ] = System . currentTimeMillis ( ) ; data [ i ] = new SQLCursorData ( sqlSentence , statement ) ; preparedStatements . put ( statement , data [ i ] ) ; if ( DEBUG ) jdbcConnection . log ( GXDBDebug . LOG_MED , "GX: Preparing new cursor " + cursorId + " - " + sqlSentence ) ; if ( currentOf && jdbcConnection . getDBMS ( ) instanceof GXDBMSas400 ) { try { statement . setCursorName ( cursorId ) ; } catch ( SQLException e ) { data [ i ] = null ; arrayIds [ i ] = null ; timeStamps [ i ] = 0 ; preparedStatements . remove ( statement ) ; throw e ; } } usedCursors ++ ; ( ( GXPreparedStatement ) statement ) . setHandle ( handle ) ; return statement ; }
Agrega un nuevo cursor en el pool.
Agrega un nuevo cursor en el pool .
// Obtengo el siguiente valor con clave = 0. // Si no hay ninguno, hago drop del cursor mas viejo y me quedo con su �ndice.