Ejemplo n.º 1
0
 /**
  * INTERNAL: The results are *not* in a cursor, build the collection. Cache the results in
  * temporaryCachedQueryResults.
  */
 protected Object executeNonCursor() throws DatabaseException {
   Vector rows = getQueryMechanism().executeSelect();
   Object results = null;
   if (this.resultType == MAP) {
     results = getContainerPolicy().buildContainerFromVector(rows, this.session);
   } else if (this.resultType == VALUE) {
     if (!rows.isEmpty()) {
       AbstractRecord record = (AbstractRecord) rows.get(0);
       // Use get with field for XML records.
       results = record.get(record.getFields().get(0));
       if (getValueConverter() != null) {
         results = getValueConverter().convertDataValueToObjectValue(results, this.session);
       }
     }
   } else {
     int size = rows.size();
     ContainerPolicy containerPolicy = getContainerPolicy();
     results = containerPolicy.containerInstance(size);
     if (containerPolicy.shouldAddAll()) {
       if (size > 0) {
         List values = new ArrayList(size);
         for (int index = 0; index < size; index++) {
           AbstractRecord row = (AbstractRecord) rows.get(index);
           Object value = buildObject(row);
           values.add(value);
         }
         containerPolicy.addAll(values, results, this.session, rows, this);
       }
     } else {
       for (int index = 0; index < size; index++) {
         AbstractRecord row = (AbstractRecord) rows.get(index);
         Object value = buildObject(row);
         containerPolicy.addInto(value, results, this.session, row, this);
       }
     }
   }
   // Bug 6135563 - cache DataReadQuery results verbatim, as ObjectBuilder is not invoked
   cacheResult(results);
   return results;
 }
Ejemplo n.º 2
0
 /** INTERNAL: Return true is this query has batching */
 public boolean hasBatchReadAttributes() {
   return (batchReadAttributeExpressions != null) && (!batchReadAttributeExpressions.isEmpty());
 }