Package javax.jcr.query

Examples of javax.jcr.query.Query.bindValue()


        // secure
        Query q = qm.createQuery(
                "select text from [nt:base] where password = $p",
                Query.JCR_SQL2 + "-noLiterals");
        q.bindValue("p", vf.createValue("x"));
        q.execute();
    }

    @SuppressWarnings("deprecation")
    @Test
View Full Code Here


        QueryManager qm = session.getWorkspace().getQueryManager();

        // SQL-2

        Query q = qm.createQuery("select text from [nt:base] where id = $id", Query.JCR_SQL2);
        q.bindValue("id", vf.createValue("1"));
        QueryResult r = q.execute();
        RowIterator it = r.getRows();
        assertTrue(it.hasNext());
        Row row = it.nextRow();
        assertEquals("hello_world", row.getValue("text").getString());
View Full Code Here

        hello2.setProperty("data""y");
        session.save();
        ValueFactory vf = session.getValueFactory();
        QueryManager qm = session.getWorkspace().getQueryManager();
        Query q = qm.createQuery("select id from [nt:base] where data >= $data order by id", Query.JCR_SQL2);
        q.bindValue("data", vf.createValue("x"));
        for (int i = -1; i < 5; i++) {
            QueryResult r = q.execute();
            RowIterator it = r.getRows();
            assertEquals(3, r.getRows().getSize());
            assertEquals(3, r.getNodes().getSize());
View Full Code Here

        hello2.setProperty("data""y");
        session.save();
        ValueFactory vf = session.getValueFactory();
        QueryManager qm = session.getWorkspace().getQueryManager();
        Query q = qm.createQuery("select id from [nt:base] where data >= $data order by id", Query.JCR_SQL2);
        q.bindValue("data", vf.createValue("x"));
        for (int limit = 0; limit < 5; limit++) {
            q.setLimit(limit);
            for (int offset = 0; offset < 3; offset++) {
                q.setOffset(offset);
                QueryResult r = q.execute();
View Full Code Here

        // secure
        Query q = qm.createQuery(
                "select text from [nt:base] where password = $p",
                Query.JCR_SQL2 + "-noLiterals");
        q.bindValue("p", vf.createValue("x"));
        q.execute();
    }

    @SuppressWarnings("deprecation")
    @Test
View Full Code Here

        NodeIterator ni;

        // verify we can see the visible node
        q = testSession.getWorkspace().getQueryManager().createQuery(
                "select * from [nt:base] where [jcr:path]=$path", Query.JCR_SQL2);
        q.bindValue("path", vf.createValue(visible.getPath()));
        r = q.execute();
        ni = r.getNodes();
        assertTrue(ni.hasNext());
        x = ni.nextNode();
        assertTrue(x.getSession() == testSession);
View Full Code Here

        assertTrue(x.getSession() == testSession);

        // verify we cannot see the invisible node
        q = testSession.getWorkspace().getQueryManager().createQuery(
                "select * from [nt:base] where [jcr:path]=$path", Query.JCR_SQL2);
        q.bindValue("path", vf.createValue(invisible.getPath()));
        r = q.execute();
        assertFalse(r.getNodes().hasNext());
       
        // the superuser should see both nodes
        q = superuser.getWorkspace().getQueryManager().createQuery(
View Full Code Here

        // the superuser should see both nodes
        q = superuser.getWorkspace().getQueryManager().createQuery(
                "select a.* from [nt:base] as a " +
                "inner join [nt:base] as b on isdescendantnode(b, a) " +
                "where a.[jcr:path]=$path", Query.JCR_SQL2);
        q.bindValue("path", vf.createValue(visible.getPath()));
        r = q.execute();
        assertTrue(r.getNodes().hasNext());

        // but the testSession must not:
        // verify we can not deduce existence of the invisible node
View Full Code Here

        // using a join
        q = testSession.getWorkspace().getQueryManager().createQuery(
                "select a.* from [nt:base] as a " +
                "inner join [nt:base] as b on isdescendantnode(b, a) " +
                "where a.[jcr:path]=$path", Query.JCR_SQL2);
        q.bindValue("path", vf.createValue(visible.getPath()));
        r = q.execute();
        assertFalse(r.getNodes().hasNext());

    }
   
View Full Code Here

        QueryManager qm = session.getWorkspace().getQueryManager();

        // SQL-2

        Query q = qm.createQuery("select text from [nt:base] where id = $id", Query.JCR_SQL2);
        q.bindValue("id", vf.createValue("1"));
        QueryResult r = q.execute();
        RowIterator it = r.getRows();
        assertTrue(it.hasNext());
        Row row = it.nextRow();
        assertEquals("hello_world", row.getValue("text").getString());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.