Package org.odmg

Examples of org.odmg.QueryInvalidException


         * End Index cannot be set before start index.
         * End Index cannot equal StartAtIndex
         */
        if ((endAtIndex != Query.NO_END_AT_INDEX) && (endAtIndex < startAtIndex))
        {
            throw new QueryInvalidException("endAtIndex must be greater than startAtIndex");
        }
        if (((endAtIndex != Query.NO_END_AT_INDEX) && (startAtIndex != Query.NO_START_AT_INDEX))
                && (endAtIndex == startAtIndex))
        {
            throw new QueryInvalidException("endAtIndex cannot be set equal to startAtIndex");
        }

        try
        {
//      Query query = QueryPool.getQuery(queryString);
            // Use the OQL parser to transform a query string to a valid org.apache.ojb.broker.query object
            Query _query;
            StringReader reader = new StringReader(queryString);
            OQLLexer lexer = new OQLLexer(reader);
            OQLParser parser = new OQLParser(lexer);
            _query = parser.buildQuery();
            setBindIterator(flatten(_query.getCriteria(), new Vector()).listIterator());
            _query.setStartAtIndex(startAtIndex);
            _query.setEndAtIndex(endAtIndex);
            setQuery(_query);
        }
        catch (RecognitionException e)
        {
            throw new QueryInvalidException(e.getMessage());
        }
        catch (TokenStreamException e)
        {
            throw new QueryInvalidException(e.getMessage());
        }
    }
View Full Code Here


    public DCollection query(String predicate) throws QueryInvalidException
    {
        // 1.build complete OQL statement
        String oql = "select all from java.lang.Object where " + predicate;
        TransactionImpl tx = getTransaction();
        if (tx == null) throw new QueryInvalidException("Need running transaction to do query");

        OQLQuery predicateQuery = tx.getImplementation().newOQLQuery();
        predicateQuery.create(oql);
        Query pQ = ((OQLQueryImpl) predicateQuery).getQuery();
        Criteria pCrit = pQ.getCriteria();
View Full Code Here

         * End Index cannot be set before start index.
         * End Index cannot equal StartAtIndex
         */
        if ((endAtIndex != Query.NO_END_AT_INDEX) && (endAtIndex < startAtIndex))
        {
            throw new QueryInvalidException("endAtIndex must be greater than startAtIndex");
        }
        if (((endAtIndex != Query.NO_END_AT_INDEX) && (startAtIndex != Query.NO_START_AT_INDEX))
                && (endAtIndex == startAtIndex))
        {
            throw new QueryInvalidException("endAtIndex cannot be set equal to startAtIndex");
        }

        try
        {
//      Query query = QueryPool.getQuery(queryString);
            // Use the OQL parser to transform a query string to a valid org.apache.ojb.broker.query object
            Query _query;
            StringReader reader = new StringReader(queryString);
            OQLLexer lexer = new OQLLexer(reader);
            OQLParser parser = new OQLParser(lexer);
            _query = parser.buildQuery();
            setBindIterator(flatten(_query.getCriteria(), new Vector()).listIterator());
            _query.setStartAtIndex(startAtIndex);
            _query.setEndAtIndex(endAtIndex);
            setQuery(_query);
        }
        catch (RecognitionException e)
        {
            throw new QueryInvalidException(e.getMessage());
        }
        catch (TokenStreamException e)
        {
            throw new QueryInvalidException(e.getMessage());
        }
    }
View Full Code Here

        predicateQuery.create(oql);
        Query pQ = ((OQLQueryImpl) predicateQuery).getQuery();
        Criteria pCrit = pQ.getCriteria();

        Transaction tx = TxManagerFactory.instance().getTransaction();
        if (tx == null) throw new QueryInvalidException("Need running transaction to do query");
        PBCapsule handle = new PBCapsule(pbKey, tx);
        DList result;
        try
        {
            PersistenceBroker broker = handle.getBroker();
View Full Code Here

         * End Index cannot be set before start index.
         * End Index cannot equal StartAtIndex
         */
        if ((endAtIndex != Query.NO_END_AT_INDEX) && (endAtIndex < startAtIndex))
        {
            throw new QueryInvalidException("endAtIndex must be greater than startAtIndex");
        }
        if (((endAtIndex != Query.NO_END_AT_INDEX) && (startAtIndex != Query.NO_START_AT_INDEX))
                && (endAtIndex == startAtIndex))
        {
            throw new QueryInvalidException("endAtIndex cannot be set equal to startAtIndex");
        }

        try
        {
//      Query query = QueryPool.getQuery(queryString);
            // Use the OQL parser to transform a query string to a valid org.apache.ojb.broker.query object
            Query _query;
            StringReader reader = new StringReader(queryString);
            OQLLexer lexer = new OQLLexer(reader);
            OQLParser parser = new OQLParser(lexer);
            _query = parser.buildQuery();
            setBindIterator(flatten(_query.getCriteria(), new Vector()).listIterator());
            _query.setStartAtIndex(startAtIndex);
            _query.setEndAtIndex(endAtIndex);
            setQuery(_query);
        }
        catch (RecognitionException e)
        {
            throw new QueryInvalidException(e.getMessage());
        }
        catch (TokenStreamException e)
        {
            throw new QueryInvalidException(e.getMessage());
        }
    }
View Full Code Here

        predicateQuery.create(oql);
        Query pQ = ((OQLQueryImpl) predicateQuery).getQuery();
        Criteria pCrit = pQ.getCriteria();

        Transaction tx = TxManagerFactory.instance().getTransaction();
        if (tx == null) throw new QueryInvalidException("Need running transaction to do query");
        PBCapsule handle = new PBCapsule(pbKey, tx);
        DList result;
        try
        {
            PersistenceBroker broker = handle.getBroker();
View Full Code Here

         * End Index cannot be set before start index.
         * End Index cannot equal StartAtIndex
         */
        if ((endAtIndex != Query.NO_END_AT_INDEX) && (endAtIndex < startAtIndex))
        {
            throw new QueryInvalidException("endAtIndex must be greater than startAtIndex");
        }
        if (((endAtIndex != Query.NO_END_AT_INDEX) && (startAtIndex != Query.NO_START_AT_INDEX))
                && (endAtIndex == startAtIndex))
        {
            throw new QueryInvalidException("endAtIndex cannot be set equal to startAtIndex");
        }

        try
        {
//      Query query = QueryPool.getQuery(queryString);
            // Use the OQL parser to transform a query string to a valid org.apache.ojb.broker.query object
            Query _query;
            StringReader reader = new StringReader(queryString);
            OQLLexer lexer = new OQLLexer(reader);
            OQLParser parser = new OQLParser(lexer);
            _query = parser.buildQuery();
            setBindIterator(flatten(_query.getCriteria(), new Vector()).listIterator());
            _query.setStartAtIndex(startAtIndex);
            _query.setEndAtIndex(endAtIndex);
            setQuery(_query);
        }
        catch (RecognitionException e)
        {
            throw new QueryInvalidException(e.getMessage());
        }
        catch (TokenStreamException e)
        {
            throw new QueryInvalidException(e.getMessage());
        }
    }
View Full Code Here

    public DCollection query(String predicate) throws QueryInvalidException
    {
        // 1.build complete OQL statement
        String oql = "select all from java.lang.Object where " + predicate;
        TransactionImpl tx = getTransaction();
        if (tx == null) throw new QueryInvalidException("Need running transaction to do query");

        OQLQuery predicateQuery = tx.getImplementation().newOQLQuery();
        predicateQuery.create(oql);
        Query pQ = ((OQLQueryImpl) predicateQuery).getQuery();
        Criteria pCrit = pQ.getCriteria();
View Full Code Here

TOP

Related Classes of org.odmg.QueryInvalidException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.