public void buildQueryTimeOutQuery(DescriptorQueryManager queryManager) {
   DataReadQuery namedQuery = new DataReadQuery();
   namedQuery.setSQLString(
       "SELECT SUM(e.EMP_ID) from EMPLOYEE e , EMPLOYEE b, EMPLOYEE c, EMPLOYEE d, EMPLOYEE f, EMPLOYEE g, EMPLOYEE h");
   namedQuery.setQueryTimeout(1);
   queryManager.addQuery("queryTimeOutQuery", namedQuery);
 }
  public void testStackContainerPolicy() {
    DataReadQuery query = this.buildNewQuery();
    query.useCollectionClass(Stack.class);

    stack = (Stack) getSession().executeQuery(query);
    // if we get here, we must not have generated a ClassCastException
    Record row = (Record) stack.peek();
    if (row.get("CUSTNAME") == null) {
      throw new TestErrorException("missing data");
    }
  }
  /** assume the stack has already been populated by the previous test */
  public void testCursoredStreamPolicy() {
    ValueReadQuery sizeQuery = new ValueReadQuery("select count(*) from ORD");

    DataReadQuery query = this.buildNewQuery();
    query.useCursoredStream(5, 5, sizeQuery);

    CursoredStream stream = (CursoredStream) getSession().executeQuery(query);

    // if we get here, we must not have generated a ClassCastException
    int count = 0;
    while (stream.hasMoreElements()) {
      count++;
      Record row = (Record) stream.nextElement();
      if (row.get("CUSTNAME") == null) {
        throw new TestErrorException("missing data");
      }
    }
    if (count != stack.size()) {
      throw new TestErrorException(
          "stream does not match stack - " + "expected: " + stack.size() + " actual: " + count);
    }
  }
Пример #4
0
 /** INTERNAL: Clone the query. */
 public Object clone() {
   DataReadQuery cloneQuery = (DataReadQuery) super.clone();
   cloneQuery.setContainerPolicy(getContainerPolicy().clone(cloneQuery));
   return cloneQuery;
 }