private ArrayList<CollectionDescriptor> callListCollections(String startName,Integer limit,int offset) throws OracleException {
  OracleCallableStatement stmt=null;
  ResultSet rows=null;
  String sqltext="begin\n" + "  DBMS_SODA_ADMIN.LIST_COLLECTIONS(\n" + "                   P_START_NAME => ?,\n"+ "                   P_RESULTS    => ?);\n"+ "end;";
  boolean resultFull=false;
  ArrayList<CollectionDescriptor> results=new ArrayList<CollectionDescriptor>();
  try {
    int rowCount=0;
    metrics.startTiming();
    stmt=(OracleCallableStatement)conn.prepareCall(sqltext);
    if (startName == null)     stmt.setNull(1,Types.VARCHAR);
 else     stmt.setNString(1,startName);
    stmt.registerOutParameter(2,OracleTypes.CURSOR);
    stmt.execute();
    rows=stmt.getCursor(2);
    if (OracleLog.isLoggingEnabled())     log.fine("Loaded collections");
    while (rows.next()) {
      String uriName=rows.getNString(1);
      String jsonDescriptor=rows.getString(2);
      String createTime=rows.getString(3);
      CollectionDescriptor desc=getDescriptorFromCaches(uriName);
      if (desc == null) {
        Builder builder=CollectionDescriptor.jsonToBuilder(jsonDescriptor);
        desc=builder.buildDescriptor(uriName);
        desc=putDescriptorIntoCaches(desc);
      }
      if ((rowCount >= offset) && (!resultFull))       results.add(desc);
      ++rowCount;
      if (limit != null && limit > 0) {
        if (rowCount >= (offset + limit)) {
          if (rowCount > SODAConstants.BATCH_FETCH_SIZE)           break;
          resultFull=true;
        }
      }
    }
    rows.close();
    rows=null;
    stmt.close();
    stmt=null;
    metrics.recordCall();
  }
 catch (  SQLException e) {
    if (OracleLog.isLoggingEnabled())     log.severe(e.toString());
    throw SODAUtils.makeExceptionWithSQLText(e,sqltext);
  }
 finally {
    for (    String message : SODAUtils.closeCursor(stmt,rows)) {
      if (OracleLog.isLoggingEnabled())       log.severe(message);
    }
  }
  return (results);
}

private ArrayList < CollectionDescriptor > callListCollections ( String startName , Integer limit , int offset ) throws OracleException { OracleCallableStatement stmt = null ; ResultSet rows = null ; String sqltext = "begin\n" + "  DBMS_SODA_ADMIN.LIST_COLLECTIONS(\n" + "                   P_START_NAME => ?,\n" + "                   P_RESULTS    => ?);\n" + "end;" ; boolean resultFull = false ; ArrayList < CollectionDescriptor > results = new ArrayList < CollectionDescriptor > ( ) ; try { int rowCount = 0 ; metrics . startTiming ( ) ; stmt = ( OracleCallableStatement ) conn . prepareCall ( sqltext ) ; if ( startName == null ) stmt . setNull ( 1 , Types . VARCHAR ) ; else stmt . setNString ( 1 , startName ) ; stmt . registerOutParameter ( 2 , OracleTypes . CURSOR ) ; stmt . execute ( ) ; rows = stmt . getCursor ( 2 ) ; if ( OracleLog . isLoggingEnabled ( ) ) log . fine ( "Loaded collections" ) ; while ( rows . next ( ) ) { String uriName = rows . getNString ( 1 ) ; String jsonDescriptor = rows . getString ( 2 ) ; String createTime = rows . getString ( 3 ) ; CollectionDescriptor desc = getDescriptorFromCaches ( uriName ) ; if ( desc == null ) { Builder builder = CollectionDescriptor . jsonToBuilder ( jsonDescriptor ) ; desc = builder . buildDescriptor ( uriName ) ; desc = putDescriptorIntoCaches ( desc ) ; } if ( ( rowCount >= offset ) && ( ! resultFull ) ) results . add ( desc ) ; ++ rowCount ; if ( limit != null && limit > 0 ) { if ( rowCount >= ( offset + limit ) ) { if ( rowCount > SODAConstants . BATCH_FETCH_SIZE ) break ; resultFull = true ; } } } rows . close ( ) ; rows = null ; stmt . close ( ) ; stmt = null ; metrics . recordCall ( ) ; } catch ( SQLException e ) { if ( OracleLog . isLoggingEnabled ( ) ) log . severe ( e . toString ( ) ) ; throw SODAUtils . makeExceptionWithSQLText ( e , sqltext ) ; } finally { for ( String message : SODAUtils . closeCursor ( stmt , rows ) ) { if ( OracleLog . isLoggingEnabled ( ) ) log . severe ( message ) ; } } return ( results ) ; }
internal call to pl / sql metadata bulk load .
