Hi,

When I run the following code, it prints a result size of 14, when I run the
sql query I get 14 elements, but the while loop only finds 1 result. Does
anyone know what could be happening here?



    protected List readObjects(Database db, String query, Object[]
parameters)
            throws Exception {
        OQLQuery oqlQuery;
        QueryResults results;
        ArrayList list;

        //construct a new query
        oqlQuery = db.getOQLQuery(query);

        //step through the parameters
        for (int i = 0; i < parameters.length; i++) {
            //bind the parameter
            oqlQuery.bind(parameters[i]);
        }
        //execute the query
        results = oqlQuery.execute();
        log.info("SQL: " + ((OQLQueryImpl)oqlQuery).getSQL());
        log.info("Results size: " + results.size());

          //create the list
        list = new ArrayList();

        //add the objects
        while (results.hasMore() == true) {
            Object next;

            //ge tthe next object
            next = results.next();
            //add next to list
            list.add(next);
            log.info("adding value");
        }

        //return the objects
        return list;
    }

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to