Package org.apache.jena.jdbc.connections

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


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

        try {
            // Invalid cast
            stmt.setObject(1, new Object(), Types.SMALLINT);
        } finally {
View Full Code Here


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

        try {
            // Invalid cast
            stmt.setObject(1, new Object(), Types.TINYINT);
        } finally {
View Full Code Here

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

        try {
            // Invalid cast
            stmt.setObject(1, new Object(), Types.TIME);
        } finally {
View Full Code Here

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

        stmt.setObject(1, "value");
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains("\"value\""));

View Full Code Here

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

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

View Full Code Here

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

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

View Full Code Here

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

        stmt.setObject(1, (byte) 123);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains("123"));
        Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDbyte.getURI()));
View Full Code Here

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

        stmt.setObject(1, BigDecimal.valueOf(1234, 1));
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains("123.4"));

View Full Code Here

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

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

View Full Code Here

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

        stmt.setObject(1, 12.3f);
        ParameterizedSparqlString pss = stmt.getParameterizedString();
        Assert.assertTrue(pss.toString().contains("12.3"));
        Assert.assertTrue(pss.toString().contains(XSDDatatype.XSDfloat.getURI()));
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.