Package com.mobixess.jodb.core.query

Examples of com.mobixess.jodb.core.query.JODBQueryList


        }
       
        //System.err.println("_________________________________________________________");
        //sessionContainer.printFileMap();
       
        JODBQueryList list = sessionContainer.getAllObjects();
       
        int total = list.size();
        for (int i = 0; i < total; i++) {
            ObjectA nextObj = (ObjectA) list.get(i);
            nextObj.setVal2((short) i);
            sessionContainer.set(nextObj);
        }
       
        sessionContainer.commit();
View Full Code Here


            query.descend("_val2").orderAscending();
        }else{
            query.descend("_val2").orderDescending();
        }
       
        JODBQueryList list = (JODBQueryList) query.execute();
        if(list.size() != maxObjects){
            throw new RuntimeException();
        }
       
        ObjectA prev = null;
        for (int i = 0; i < list.size(); i++) {
            ObjectA current = (ObjectA) list.get(i);
            //System.err.println("Indexing Random test iter #="+i);
            if(prev!=null){
                if(ascending){
                    if( prev.getVal2() > current.getVal2() ){
                        throw new RuntimeException();
                    }
                }else if(prev.getVal2() < current.getVal2() ){
                    JODBIndexingAgent indexingAgent = sessionContainer.getIndexingAgent(ObjectA.class.getDeclaredField("_val2") );
                    long prevID = sessionContainer.getPersistenceStatistics(prev).getObjectID();
                    long currentID = sessionContainer.getPersistenceStatistics(current).getObjectID();
                    int prevPosition = indexingAgent.linearIdSearch(prevID);
                    int currentPosition = indexingAgent.linearIdSearch(currentID);
                    throw new RuntimeException(""+prevID+"  "+prevPosition+"  "+ currentID+"  "+currentPosition);
                }
            }
            prev = current;
        }
       
       
        //System.err.println("_________________________________________________________");
        //sessionContainer.printFileMap();
       
        list = sessionContainer.getAllObjects();
       
        int total = list.size();
        for (int i = 0; i < total; i++) {
            ObjectA nextObj = (ObjectA) list.get(i);
            nextObj.setVal2((short) i);
            sessionContainer.set(nextObj);
        }
       
        sessionContainer.commit();
       
        if(reopen){
            sessionContainer.close();
            sessionContainer = getContainerForFile(testFile);
        }
       
       
        query = sessionContainer.query();
        query.constrain(ObjectA.class);
        if(ascending){
            query.descend("_val2").orderAscending();
        }else{
            query.descend("_val2").orderDescending();
        }
       
        list = (JODBQueryList) query.execute();
        if(list.size() == 0){
            throw new RuntimeException();
        }
       
        prev = null;
        for (int i = 0; i < list.size(); i++) {
            //System.err.println("Indexing Random test iter1 #="+i);
            ObjectA current = (ObjectA) list.get(i);
            if(prev!=null){
                if(ascending){
                    if( prev.getVal2() > current.getVal2() ){
                        throw new RuntimeException();
                    }
View Full Code Here

        query.descend("_val2").constrain(0).smaller();
       
       
        long queryStart = System.currentTimeMillis();
        JODBQueryList list = (JODBQueryList) query.execute();
        long noneIndexQuery = System.currentTimeMillis() - queryStart;
        System.err.println("noneIndexQuery="+noneIndexQuery);
       
        if(list.size() != negatives){
            throw new RuntimeException();
        }
       
        sessionContainer.configureIndex(ObjectA.class, "_val2", true);
       
        if(reopen){
            sessionContainer.close();
            sessionContainer = getContainerForFile(testFile);
        }
       
       
        query = sessionContainer.query();
        query.constrain(ObjectA.class);

        query.descend("_val2").constrain(0).smaller();
       
        queryStart = System.currentTimeMillis();
        list = (JODBQueryList) query.execute();
        long queryWithIndex = System.currentTimeMillis() - queryStart;
        System.err.println("queryWithIndex="+queryWithIndex);
       
        if(list.size() != negatives){
            throw new RuntimeException();
        }
       
       
       
        sessionContainer.commit();
       
       
        for (int i = 0; i < list.size(); i++) {
            ObjectA current = (ObjectA) list.get(i);
            if(current.getVal2()>=0){
                throw new RuntimeException();
            }
        }
       
View Full Code Here

                remoteActiveObjects = new LongVector(localActiveObjects);
            }
            query.setSession(_sessionContainer.getSession());
            try {
                LongVector additionalRejected = new LongVector();
                JODBQueryList objectSet = (JODBQueryList) query.runQuery(remoteActiveObjects,additionalRejected);
               
                long[] result = objectSet.getAllObjectIds();
                long[] additionalRejectedObjects = null;
                if(additionalRejected.size() > 0){
                    additionalRejectedObjects = additionalRejected.getDataAsArray();
                }
                return new ServerQueryResult(additionalRejectedObjects,result);
View Full Code Here

                    comparator = (Comparator) comparatorClassDescriptor.newInstance();
                }
            } catch (Exception e) {
                throw new JodbIOException(e);
            }
            JODBQueryList objectSet =  (JODBQueryList) NQExecutor.getInstance().execute(_sessionContainer.getSession(), predicate, comparator);
            long[] result = objectSet.getAllObjectIds();
            return new ServerQueryResult(null,result);
        }
View Full Code Here

    {
       
    }
   
    public JODBQueryList executeQuery(QueryNode query) throws IOException, IllegalClassTypeException {
        JODBQueryList result = null;
        IServerQueryResult queryResult = _server.runQuery(query, null);
        if(query!=null){
            long[] resultingOffsets = queryResult.getSearchResult();
            if(resultingOffsets!=null){
                result = new SimpleArrayQueryList(resultingOffsets, query.getSession());
View Full Code Here

    {
//        QueryBytecode queryBytecode = NQExecutor.getInstance().getTransformationForQuery(session, predicate, comparator);
//        if(queryBytecode==null){
//            throw new JodbIOException("cannot run unoptimized query in server mode");
//        }
        JODBQueryList result = null;
        IServerQueryResult queryResult = _server.query(predicate.getClass().getName(), comparator==null?null:comparator.getClass().getName());

        long[] resultingOffsets = queryResult.getSearchResult();
        if(resultingOffsets!=null){
            result = new SimpleArrayQueryList(resultingOffsets, session);
View Full Code Here

TOP

Related Classes of com.mobixess.jodb.core.query.JODBQueryList

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.