Package org.apache.jena.jdbc.connections

Examples of org.apache.jena.jdbc.connections.JenaConnection.prepareStatement()


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

        stmt.setDouble(1, 12.3d);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains("12.3"));

View Full Code Here


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

        stmt.setInt(1, 123);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains("123"));

View Full Code Here

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

        stmt.setLong(1, 123l);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains("123"));

View Full Code Here

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

        Date dt = new Date(Calendar.getInstance().getTimeInMillis());
        stmt.setDate(1, dt);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains(Integer.toString(Calendar.getInstance().get(Calendar.YEAR))));
View Full Code Here

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

        stmt.setObject(1, NodeFactoryExtra.intToNode(123l), Types.BIGINT);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains("123"));

View Full Code Here

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

        stmt.setObject(1, "123", Types.BIGINT);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains("123"));

View Full Code Here

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

        stmt.setObject(1, true, Types.BOOLEAN);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains("true"));

View Full Code Here

     */
    @SuppressWarnings("deprecation")
    @Test(expected = SQLFeatureNotSupportedException.class)
    public void prepared_statement_unsupported_setters_34() throws SQLException {
        JenaConnection conn = this.getConnection();
        PreparedStatement stmt = conn.prepareStatement("SELECT * WHERE { ? ?p ?o }");

        try {
            stmt.setUnicodeStream(1, null, 0);
        } finally {
            stmt.close();
View Full Code Here

     * @throws SQLException
     */
    @Test(expected = SQLException.class)
    public void prepared_statement_bad_setters_01() throws SQLException {
        JenaConnection conn = this.getConnection();
        PreparedStatement stmt = conn.prepareStatement("SELECT * WHERE { ? ?p ?o }");

        try {
            // Should error since parameters use a one based index
            stmt.setBoolean(0, true);
        } finally {
View Full Code Here

     * @throws SQLException
     */
    @Test(expected = SQLException.class)
    public void prepared_statement_bad_setters_02() throws SQLException {
        JenaConnection conn = this.getConnection();
        PreparedStatement stmt = conn.prepareStatement("SELECT * WHERE { ? ?p ?o }");

        try {
            // Should error since parameters use a one based index
            stmt.setBoolean(2, true);
        } finally {
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.