Examples of SQLXML


Examples of java.sql.SQLXML

    }
    return result;
  }

  public SQLXML createSQLXML() throws SQLException {
    SQLXML result = null;
    checkClosed();
    try {
      result = this.connection.createSQLXML();
    } catch (SQLException e) {
      throw markPossiblyBroken(e);
View Full Code Here

Examples of java.sql.SQLXML

     * @throws SQLException upon any failure that occurs in the
     *         call to the method.
     */
    public void testSetSQLXML() throws SQLException{
        try {
            SQLXML sqlxml = null;
            ps.setSQLXML(0,sqlxml);
            fail("setNClob should not be implemented");
        }
        catch(SQLFeatureNotSupportedException sqlfne) {
            //Do Nothing, This happens as expected
View Full Code Here

Examples of java.sql.SQLXML

//#ifdef JAVA6
    public SQLXML getSQLXML(int columnIndex) throws SQLException {

        checkColumn(columnIndex);

        SQLXML sqlxml;
        int    type = resultMetaData.columnTypes[columnIndex - 1].typeCode;

        switch (type) {

            case Types.SQL_XML : {
View Full Code Here

Examples of java.sql.SQLXML

  }

  public SQLXML getSQLXML(int parameterIndex) throws SQLException {
    ResultSetInternalMethods rs = getOutputParameters(parameterIndex);

    SQLXML retValue = ((com.mysql.jdbc.JDBC4ResultSet) rs)
        .getSQLXML(mapOutputParameterIndexToRsIndex(parameterIndex));

    this.outputParamWasNull = rs.wasNull();

    return retValue;
View Full Code Here

Examples of java.sql.SQLXML

    ResultSetInternalMethods rs = getOutputParameters(0); // definitely
                                // not going to
                                // be
    // from ?=

    SQLXML retValue = ((com.mysql.jdbc.JDBC4ResultSet) rs)
        .getSQLXML(fixParameterName(parameterName));

    this.outputParamWasNull = rs.wasNull();

    return retValue;
View Full Code Here

Examples of java.sql.SQLXML

                            //get the content
                            if(rsmd.getColumnType(i+1) == Types.SQLXML) {
                                //parse sqlxml value
                                try {
                                    final SQLXML sqlXml = rs.getSQLXML(i+1);
                                   
                                    if(rs.wasNull()) {
                                        // Add a null indicator attribute if the value was SQL Null
                                        builder.addAttribute( new QName( "null", SQLModule.NAMESPACE_URI, SQLModule.PREFIX ), "true" );
                                    } else {

                                        SAXParserFactory factory = SAXParserFactory.newInstance();
                                        factory.setNamespaceAware(true);
                                        InputSource src = new InputSource(sqlXml.getCharacterStream());
                                        SAXParser parser = factory.newSAXParser();
                                        XMLReader xr = parser.getXMLReader();

                                        SAXAdapter adapter = new AppendingSAXAdapter(builder);
                                        xr.setContentHandler(adapter);
View Full Code Here

Examples of java.sql.SQLXML

        {
            paramValue = resultSetHandler.processResultSet(connection, (ResultSet) paramValue);
        }
        else if (paramValue instanceof SQLXML)
        {
            SQLXML sqlxml = (SQLXML) paramValue;

            paramValue = sqlxml.getString();
        }

        return new OutputParamResult(outputSqlParam.getName(), paramValue);
    }
View Full Code Here

Examples of java.sql.SQLXML

  @Test
  public void testDOMParse() throws SQLException {
    ResultSet rs = getRS();

    assertTrue(rs.next());
    SQLXML xml = rs.getSQLXML(1);
    DOMSource source = xml.getSource(DOMSource.class);
    Node doc = source.getNode();
    Node root = doc.getFirstChild();
    assertEquals("a", root.getNodeName());
    Node first = root.getFirstChild();
    assertEquals("b", first.getNodeName());
    assertEquals("1", first.getTextContent());
    Node last = root.getLastChild();
    assertEquals("b", last.getNodeName());
    assertEquals("2", last.getTextContent());

    assertTrue(rs.next());
    try {
      xml = rs.getSQLXML(1);
      source = xml.getSource(DOMSource.class);
      fail("Can't retrieve a fragment.");
    }
    catch (SQLException sqle) {
      // Ok
    }
View Full Code Here

Examples of java.sql.SQLXML

  private <T extends Source> void testRead(Class<T> sourceClass) throws Exception {
    ResultSet rs = getRS();

    assertTrue(rs.next());
    SQLXML xml = rs.getSQLXML(1);
    Source source = xml.getSource(sourceClass);
    transform(source);

    assertTrue(rs.next());
    xml = rs.getSQLXML(1);
    try {
      source = xml.getSource(sourceClass);
      transform(source);
      fail("Can't transform a fragment.");
    }
    catch (Exception sqle) {
      // Ok
View Full Code Here

Examples of java.sql.SQLXML

    Statement stmt = _conn.createStatement();
    stmt.execute("DELETE FROM xmltest");
    stmt.close();

    PreparedStatement ps = _conn.prepareStatement("INSERT INTO xmltest VALUES (?,?)");
    SQLXML xml = _conn.createSQLXML();
    Result result = xml.setResult(resultClass);

    Source source = new StreamSource(new StringReader(_xmlDocument));
    _identityTransformer.transform(source, result);

    ps.setInt(1, 1);
    ps.setSQLXML(2, xml);
    ps.executeUpdate();
    ps.close();

    ResultSet rs = getRS();
    assertTrue(rs.next());

    // DOMResults tack on the additional <?xml ...?> header.
    //
    String header = "";
    if (DOMResult.class.equals(resultClass)) {
      header = "<?xml version=\"1.0\" standalone=\"no\"?>";
    }

    assertEquals(header + _xmlDocument, rs.getString(1));
    xml = rs.getSQLXML(1);
    assertEquals(header + _xmlDocument, xml.getString());

    assertTrue(!rs.next());
  }
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.