Examples of JenaConnection


Examples of org.apache.jena.jdbc.connections.JenaConnection

     * @throws SQLException
     * @throws MalformedURLException
     */
    @Test
    public void prepared_statement_setters_77() throws SQLException, MalformedURLException {
        JenaConnection conn = this.getConnection();
        JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");

        stmt.setObject(1, new URL("http://example"), Types.JAVA_OBJECT);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains("<http://example>"));

        stmt.close();
        conn.close();
    }
View Full Code Here

Examples of org.apache.jena.jdbc.connections.JenaConnection

     * @throws MalformedURLException
     * @throws URISyntaxException
     */
    @Test
    public void prepared_statement_setters_78() throws SQLException, MalformedURLException, URISyntaxException {
        JenaConnection conn = this.getConnection();
        JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");

        stmt.setObject(1, new URI("http://example"), Types.JAVA_OBJECT);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains("<http://example>"));

        stmt.close();
        conn.close();
    }
View Full Code Here

Examples of org.apache.jena.jdbc.connections.JenaConnection

     * @throws SQLException
     * @throws MalformedURLException
     */
    @Test
    public void prepared_statement_setters_79() throws SQLException, MalformedURLException {
        JenaConnection conn = this.getConnection();
        JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");

        Calendar c = Calendar.getInstance();
        stmt.setObject(1, c, Types.JAVA_OBJECT);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains(Integer.toString(c.get(Calendar.YEAR))));
        Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDdateTime.getURI()));

        stmt.close();
        conn.close();
    }
View Full Code Here

Examples of org.apache.jena.jdbc.connections.JenaConnection

     * @throws SQLException
     * @throws MalformedURLException
     */
    @Test
    public void prepared_statement_setters_80() throws SQLException, MalformedURLException {
        JenaConnection conn = this.getConnection();
        JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");

        Calendar c = Calendar.getInstance();
        Date dt = new Date(c.getTimeInMillis());
        stmt.setObject(1, dt, Types.JAVA_OBJECT);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains(Integer.toString(c.get(Calendar.YEAR))));
        Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDdateTime.getURI()));

        stmt.close();
        conn.close();
    }
View Full Code Here

Examples of org.apache.jena.jdbc.connections.JenaConnection

     * @throws SQLException
     * @throws MalformedURLException
     */
    @Test
    public void prepared_statement_setters_81() throws SQLException, MalformedURLException {
        JenaConnection conn = this.getConnection();
        JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");

        Calendar c = Calendar.getInstance();
        Time t = new Time(c.getTimeInMillis());
        stmt.setObject(1, t, Types.JAVA_OBJECT);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains(Integer.toString(c.get(Calendar.HOUR_OF_DAY))));
        Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDtime.getURI()));

        stmt.close();
        conn.close();
    }
View Full Code Here

Examples of org.apache.jena.jdbc.connections.JenaConnection

     *
     * @throws SQLException
     */
    @Test
    public void prepared_statement_setters_82() throws SQLException {
        JenaConnection conn = this.getConnection();
        JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }");

        stmt.setObject(1, new Object(), Types.JAVA_OBJECT);

        stmt.close();
        conn.close();
    }
View Full Code Here

Examples of org.apache.jena.jdbc.connections.JenaConnection

     *
     * @throws SQLException
     */
    @Test(expected = SQLException.class)
    public void statement_bad_execute_09() throws SQLException {
        JenaConnection conn = this.getConnection();
        Statement stmt = conn.createStatement();

        try {
            stmt.executeUpdate("SELECT * WHERE {", new String[0]);
        } finally {
            stmt.close();
            conn.close();
        }
    }
View Full Code Here

Examples of org.apache.jena.jdbc.connections.JenaConnection

     *
     * @throws SQLException
     */
    @Test(expected = SQLException.class)
    public void statememt_readonly_execute_update_01() throws SQLException {
        JenaConnection conn = this.getConnection();
        Statement stmt = conn.createStatement();
        conn.setReadOnly(true);

        try {
            stmt.executeUpdate("DELETE WHERE { ?s ?p ?o }");
        } finally {
            stmt.close();
            conn.close();
        }
    }
View Full Code Here

Examples of org.apache.jena.jdbc.connections.JenaConnection

     *
     * @throws SQLException
     */
    @Test(expected = SQLException.class)
    public void statememt_readonly_execute_update_02() throws SQLException {
        JenaConnection conn = this.getConnection();
        Statement stmt = conn.createStatement();
        conn.setReadOnly(true);

        try {
            stmt.executeUpdate("DELETE WHERE { ?s ?p ?o }", 0);
        } finally {
            stmt.close();
            conn.close();
        }
    }
View Full Code Here

Examples of org.apache.jena.jdbc.connections.JenaConnection

     *
     * @throws SQLException
     */
    @Test(expected = SQLException.class)
    public void statememt_readonly_execute_update_03() throws SQLException {
        JenaConnection conn = this.getConnection();
        Statement stmt = conn.createStatement();
        conn.setReadOnly(true);

        try {
            stmt.executeUpdate("DELETE WHERE { ?s ?p ?o }", new int[0]);
        } finally {
            stmt.close();
            conn.close();
        }
    }
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.