docs: public String asSQLStatement(Criteria crit, ClassDescriptor cld)
      {
          Enumeration e = crit.getElements();
          StringBuffer statement = new StringBuffer();
          while (e.hasMoreElements())
          {
              Object o = e.nextElement();
              if (o instanceof Criteria)
              {
                  String addAtStart;
                  String addAtEnd;
                  Criteria pc = (Criteria) o;
                  // need to add parenthesises?
                  if (pc.isEmbraced())
                  {
                      addAtStart = " (";
                      addAtEnd = ") ";
                  }
                  else
                  {
                      addAtStart = "";
                      addAtEnd = "";
                  }
  
                  switch (pc.getType())
                  {
                      case (Criteria.OR) :
                          {
                              statement.append(" OR ").append(addAtStart);
                              statement.append(asSQLStatement(pc, cld));
                              statement.append(addAtEnd);
                              break;
                          }
                      case (Criteria.AND) :
                          {
                              statement.insert(0, "( ");
                              statement.append(") ");
                              statement.append(" AND ").append(addAtStart);
                              statement.append(asSQLStatement(pc, cld));
                              statement.append(addAtEnd);
                              break;
                          }
                  }
              }
              else
              {
                  SelectionCriteria c = (SelectionCriteria) o;
                  if (statement.length() == 0)
                  {
                      statement.append(asSQLClause(c, cld));
                  }
                  else
                  {
                      statement.insert(0, "(");
                      statement.append(") ");
                      statement.append(" AND ");
                      statement.append(asSQLClause(c, cld));
                  }
              }
          } // while
          if (statement.length() == 0)
          {
              return null;
          }
          return statement.toString();
      }