DOCUMENT ME!

@param name     DOCUMENT ME!
@param criteria DOCUMENT ME!
@param result   DOCUMENT ME!
@param conn     DOCUMENT ME!
@return DOCUMENT ME!
@throws CpoException DOCUMENT ME!
428582
protected <T, C> T processExecuteGroup(String name, C criteria, T result, Connection conn) throws CpoException {
    CallableStatement cstmt = null;
    CpoClass criteriaClass;
    T returnObject = null;
    Logger localLogger = criteria == null ? logger : LoggerFactory.getLogger(criteria.getClass());

    JdbcCallableStatementFactory jcsf = null;

    if (criteria == null || result == null) {
      throw new CpoException("NULL Object passed into executeObject");
    }

    try {
      criteriaClass = metaDescriptor.getMetaClass(criteria);
      List<CpoFunction> functions = criteriaClass.getFunctionGroup(JdbcCpoAdapter.EXECUTE_GROUP, name).getFunctions();
      localLogger.info("===================processExecuteGroup (" + name + ") Count<" + functions.size() + ">=========================");

      try {
        returnObject = (T) result.getClass().newInstance();
      } catch (IllegalAccessException iae) {
        throw new CpoException("Unable to access the constructor of the Return Object", iae);
      } catch (InstantiationException iae) {
        throw new CpoException("Unable to instantiate Return Object", iae);
      }

      // Loop through the queries and process each one
      for (CpoFunction function : functions) {

        localLogger.debug("Executing Call:" + criteriaClass.getName() + ":" + name);

        jcsf = new JdbcCallableStatementFactory(conn, this, function, criteria);
        cstmt = jcsf.getCallableStatement();
        cstmt.execute();
        jcsf.release();

        localLogger.debug("Processing Call:" + criteriaClass.getName() + ":" + name);

        // Add Code here to go through the arguments, find record sets,
        // and process them
        // Process the non-record set out params and make it the first
        // object in the collection

        // Loop through the OUT Parameters and set them in the result
        // object
        int j = 1;
        for (CpoArgument cpoArgument : jcsf.getOutArguments()) {
          JdbcCpoArgument jdbcArgument = (JdbcCpoArgument) cpoArgument;
          if (jdbcArgument.isOutParameter()) {
            JdbcCpoAttribute jdbcAttribute = jdbcArgument.getAttribute();
            jdbcAttribute.invokeSetter(returnObject, new CallableStatementCpoData(cstmt, jdbcAttribute, j));
          }
          j++;
        }

        cstmt.close();
      }
    } catch (Throwable t) {
      String msg = "ProcessExecuteGroup(String name, Object criteria, Object result, Connection conn) failed. SQL=";
      localLogger.error(msg, t);
      throw new CpoException(msg, t);
    } finally {
      statementClose(cstmt);
      if (jcsf != null) {
        jcsf.release();
      }
    }

    return returnObject;
  }
887913
public org.grails.datastore.mapping.query.api.Criteria eq(String propertyName, Object propertyValue) {
        return eq(propertyName, propertyValue, Collections.emptyMap());
    }
907854
public List<T> getResults(Connection conn, DataObject object) throws Exception {
        return executeSelect(conn, object, new ResultSetMapper<ArrayListCollector<T>>(new ArrayListCollector<T>()));
    }
705717
private function createCriteriaQueryBuilder(Criteria $criteria, $prefix)
    {
        $qb = $this->createQueryBuilder($prefix);

        if ($criteria->count()) {
            $composite = $this->applyCriteriaToQueryBuilder($criteria, $qb, $prefix);

            if ($composite->count()) {
                $qb->where($composite);
            }
        }

        return $qb;
    }
1155282
@Override
    public Object getValue(String paramName) throws IllegalArgumentException {
        if (!hasValue(paramName)) {
            throw new IllegalArgumentException("Can't find criteria with name " + paramName);
        }
        if (LIMIT_NAME.equals(paramName)) {
            return limit;
        }
        if (OFFSET_NAME.equals(paramName)) {
            return offset;
        }
        return criterias.get(paramName).getValue();
    }
1182502
protected function processFilter(string $name, array $values, Criteria $criteria, Context $context): void
    {
        foreach ($values as $operator => $value)
        {
            if (is_integer($operator)) {
                throw new InvalidQueryException('Operator must be defined by a string.');
            }

            $value = is_array($value) ? array_map('trim', $value) : trim($value);

            $expression = $this->createExpression($name, trim($operator), $value, $context);
            $criteria->andWhere($expression);
        }
    }
459777
public List findByRelation(String colName, Object colValue, Class entityClazz)
    {
        EntityMetadata m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClazz);
        String tableName = m.getTableName();

        // Suffixing the UNDERSCORE instead of prefix as Oracle 11g complains
        // about invalid characters error while executing the request.
        StringBuilder queryBuilder = new StringBuilder("Select ");

        queryBuilder.append("* ");
        queryBuilder.append("From ");
        queryBuilder.append(getFromClause(m.getSchema(), tableName));
        queryBuilder.append(" ");

        queryBuilder.append(" Where ");
        queryBuilder.append(colName);
        queryBuilder.append(" = ");
        queryBuilder.append("'");
        queryBuilder.append(colValue);
        queryBuilder.append("'");
        s = getStatelessSession();

        List results = find(queryBuilder.toString(), m.getRelationNames(), m);
        return populateEnhanceEntities(m, m.getRelationNames(), results);
    }
1255819
@Override
    public <T> TypedQuery<T> createQuery(CriteriaQuery<T> paramCriteriaQuery)
    {
        checkClosed();

        return this.createQuery(CriteriaQueryTranslator.translate(paramCriteriaQuery),
                paramCriteriaQuery.getResultType());
    }
575608
@Override
    @SuppressWarnings("unchecked")
    public Criteria[] parseValue(String value) {
        EnumCriteria result = new EnumCriteria(this.name, this.columnName, this.enumClass);
        result.value = Enum.valueOf(enumClass, value);
        return new Criteria[] {result};
    }
1269700
public Collector<T> getResults(Connection conn, DataObject object, Collector<T> collector) throws Exception {
        return executeSelect(conn, object, new ResultSetMapper<Collector<T>>(collector));
    }
1116252
@Override
    public <T> TypedQuery<T> createQuery(CriteriaQuery<T> arg0) {
        try
        {
            return ivEm.createQuery(arg0);
        } finally
        {
            if (!inJTATransaction())
            {
                ivEm.clear();
            }
        }
    }
1087396
@WithBridgeMethods(value = OracleQuery.class, castRequired = true)
    public C connectBy(Predicate cond) {
        return addFlag(Position.BEFORE_ORDER, CONNECT_BY, cond);
    }
418250
protected <T> CompletableFuture<ResultSet> executeQuery(final EntityInfo<T> info, final AsyncConnection conn, final String sql) {
        final byte[] bytes = conn.getAttribute(CONN_ATTR_BYTESBAME);
        final ByteBufferWriter writer = ByteBufferWriter.create(bufferPool);
        {
            writer.put((byte) 'Q');
            int start = writer.position();
            writer.putInt(0);
            writeUTF8String(writer, sql);
            writer.putInt(start, writer.position() - start);
        }
        final ByteBuffer[] buffers = writer.toBuffers();
        final CompletableFuture<ResultSet> future = new CompletableFuture();
        conn.write(buffers, buffers, new CompletionHandler<Integer, ByteBuffer[]>() {
            @Override
            public void completed(Integer result, ByteBuffer[] attachment1) {
                if (result < 0) {
                    failed(new SQLException("Write Buffer Error"), attachment1);
                    return;
                }
                int index = -1;
                for (int i = 0; i < attachment1.length; i++) {
                    if (attachment1[i].hasRemaining()) {
                        index = i;
                        break;
                    }
                    bufferPool.accept(attachment1[i]);
                }
                if (index == 0) {
                    conn.write(attachment1, attachment1, this);
                    return;
                } else if (index > 0) {
                    ByteBuffer[] newattachs = new ByteBuffer[attachment1.length - index];
                    System.arraycopy(attachment1, index, newattachs, 0, newattachs.length);
                    conn.write(newattachs, newattachs, this);
                    return;
                }
                final PgResultSet resultSet = new PgResultSet();
                final List<ByteBuffer> readBuffs = new ArrayList<>();
                conn.read(new CompletionHandler<Integer, ByteBuffer>() {
                    @Override
                    public void completed(Integer result, ByteBuffer attachment2) {
                        if (result < 0) {
                            failed(new SQLException("Read Buffer Error"), attachment2);
                            return;
                        }
                        if (result == 8192 || !attachment2.hasRemaining()) { //postgresql数据包上限为8192 还有数据
                            attachment2.flip();
                            readBuffs.add(attachment2);
                            conn.read(this);
                            return;
                        }
                        attachment2.flip();
                        readBuffs.add(attachment2);
                        final ByteBufferReader buffer = ByteBufferReader.create(readBuffs);
                        boolean endok = false;
                        boolean futureover = false;
                        while (buffer.hasRemaining()) {
                            final char cmd = (char) buffer.get();
                            int length = buffer.getInt();
                            switch (cmd) {
                                case 'E':
                                    byte[] field = new byte[255];
                                    String level = null,
                                     code = null,
                                     message = null;
                                    for (byte type = buffer.get(); type != 0; type = buffer.get()) {
                                        String value = readUTF8String(buffer, field);
                                        if (type == (byte) 'S') {
                                            level = value;
                                        } else if (type == 'C') {
                                            code = value;
                                        } else if (type == 'M') {
                                            message = value;
                                        }
                                    }
                                    future.completeExceptionally(new SQLException(message, code, 0));
                                    futureover = true;
                                    break;
                                case 'T':
                                    RowDesc rowDesc = new RespRowDescDecoder().read(buffer, length, bytes);
                                    resultSet.setRowDesc(rowDesc);
                                    break;
                                case 'D':
                                    RowData rowData = new RespRowDataDecoder().read(buffer, length, bytes);
                                    resultSet.addRowData(rowData);
                                    futureover = true;
                                    break;
                                case 'Z':
                                    //buffer.position(buffer.position() + length - 4);
                                    buffer.skip(length - 4);
                                    endok = true;
                                    break;
                                default:
                                    //buffer.position(buffer.position() + length - 4);
                                    buffer.skip(length - 4);
                                    break;
                            }
                        }
                        for (ByteBuffer buf : readBuffs) {
                            bufferPool.accept(buf);
                        }
                        if (!futureover) future.completeExceptionally(new SQLException("SQL(" + sql + ") executeQuery error"));
                        if (endok) {
                            readPool.offerConnection(conn);
                            future.complete(resultSet);
                        } else {
                            conn.dispose();
                        }
                    }

                    @Override
                    public void failed(Throwable exc, ByteBuffer attachment2) {
                        //不用bufferPool.accept
                        future.completeExceptionally(exc);
                        conn.dispose();
                    }
                });
            }

            @Override
            public void failed(Throwable exc, ByteBuffer[] attachment1) {
                for (ByteBuffer attach : attachment1) {
                    bufferPool.accept(attach);
                }
                future.completeExceptionally(exc);
            }
        });
        return future;
    }
278978
public org.grails.datastore.mapping.query.api.Criteria le(String propertyName, Object propertyValue) {
        if (!validateSimpleExpression()) {
            throwRuntimeException(new IllegalArgumentException("Call to [le] with propertyName [" +
                    propertyName + "] and value [" + propertyValue + "] not allowed here."));
        }

        propertyName = calculatePropertyName(propertyName);
        propertyValue = calculatePropertyValue(propertyValue);
        Criterion le;
        if (propertyValue instanceof org.hibernate.criterion.DetachedCriteria) {
            le = Property.forName(propertyName).le((org.hibernate.criterion.DetachedCriteria) propertyValue);
        }
        else {
            le = Restrictions.le(propertyName, propertyValue);
        }
        addToCriteria(le);
        return this;
    }
446048
public function setCriteriaHidden($query_name, $criteria_hidden)
    {
        //$this->check_column_name("set_criteria_lhidden", $query_name);
        if (($cl = ReporticoUtility::getQueryColumn($query_name, $this->lookup_queries))) {
            $cl->setCriteriaHidden($criteria_hidden);
        }
    }
1230883
public static ReportQueryByCriteria newReportQuery(Class classToSearchFrom, Criteria criteria, boolean distinct)
    {
        criteria = addCriteriaForOjbConcreteClasses(getRepository().getDescriptorFor(classToSearchFrom), criteria);
        return newReportQuery(classToSearchFrom, null, criteria, distinct);
    }
1163053
public PageResult<Entity> page(Connection conn, Entity where, Page page) throws SQLException {
		return this.page(conn, null, where, page);
	}