Package org.dspace.xoai.services.api.database

Examples of org.dspace.xoai.services.api.database.DatabaseQueryException


        String where = null;
        try {
            where = this.buildCondition(filters, parameters);
        } catch (ContextServiceException e) {
            throw new DatabaseQueryException(e);
        }
        countParameters.addAll(parameters);

        if (!where.equals("")) {
            query += " WHERE i.in_archive=true AND " + where;
            countQuery += " WHERE i.in_archive=true AND " + where;
        } else {
            query += " WHERE i.in_archive=true";
            countQuery += " WHERE i.in_archive=true";
        }

        query += " ORDER BY i.item_id";
        boolean postgres = ! DatabaseManager.isOracle();
        if (postgres)
        {
            query += " OFFSET ? LIMIT ?";
        }
        else
        {
            // Oracle
            query = "SELECT * FROM (" + query
                    + ") WHERE ROWNUM BETWEEN ? AND ?";
            length = length + offset;
        }
        parameters.add(offset);
        parameters.add(length);

        try {
            return new DatabaseQuery(contextService.getContext())
                    .withCountQuery(countQuery, countParameters)
                    .withQuery(query)
                    .withParameters(parameters);
        } catch (ContextServiceException e) {
            throw new DatabaseQueryException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.dspace.xoai.services.api.database.DatabaseQueryException

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.