Package java.sql

Examples of java.sql.SQLXML


  @Test
  public void testFree() throws SQLException {
    ResultSet rs = getRS();
    assertTrue(rs.next());
    SQLXML xml = rs.getSQLXML(1);
    xml.free();
    xml.free();
    try {
      xml.getString();
      fail("Not freed.");
    }
    catch (SQLException sqle) {
      // Ok
    }
View Full Code Here


  @Test
  public void testGetObject() throws SQLException {
    ResultSet rs = getRS();
    assertTrue(rs.next());
    @SuppressWarnings("unused")
    SQLXML xml = (SQLXML) rs.getObject(1);
  }
View Full Code Here

    ps.setNull(2, Types.SQLXML);
    ps.executeUpdate();
    ps.setInt(1, 2);
    ps.setObject(2, null, Types.SQLXML);
    ps.executeUpdate();
    SQLXML xml = _conn.createSQLXML();
    xml.setString(null);
    ps.setInt(1, 3);
    ps.setObject(2, xml);
    ps.executeUpdate();
    ps.close();
View Full Code Here

    assertTrue(!rs.next());
  }

  @Test
  public void testEmpty() throws SQLException, IOException {
    SQLXML xml = _conn.createSQLXML();

    try {
      xml.getString();
      fail("Cannot retrieve data from an uninitialized object.");
    }
    catch (SQLException sqle) {
      // Ok
    }

    try {
      xml.getSource(null);
      fail("Cannot retrieve data from an uninitialized object.");
    }
    catch (SQLException sqle) {
      // Ok
    }
View Full Code Here

    }
  }

  @Test
  public void testDoubleSet() throws SQLException {
    SQLXML xml = _conn.createSQLXML();

    xml.setString("");

    try {
      xml.setString("");
      fail("Can't set a value after its been initialized.");
    }
    catch (SQLException sqle) {
      // Ok
    }

    ResultSet rs = getRS();
    assertTrue(rs.next());
    xml = rs.getSQLXML(1);
    try {
      xml.setString("");
      fail("Can't set a value after its been initialized.");
    }
    catch (SQLException sqle) {
      // Ok
    }
View Full Code Here

      {"xml", new Maker() {

        @Override
        public Object make(PGConnectionImpl conn) {
          try {
            SQLXML sqlXML = conn.createSQLXML();
            sqlXML.setString("<xml></xml>");
            return sqlXML;
          }
          catch (SQLException e) {
            throw new RuntimeException(e);
          }
View Full Code Here

//#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

     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readSQLXML()}
     *
     * @since 1.6
     */
    public void testReadSQLXML() throws SQLException {
        SQLXML sqlXML = new MockSQLXML();
        Object[] attributes = new Object[] { null, sqlXML };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        try {
            impl.readSQLXML();
View Full Code Here

        }
    }

    public void testSetSQLXML() throws SQLException {
        BaseRowSetImpl brs = new BaseRowSetImpl();
        SQLXML sqlxml = new MockSQLXML() {

            public byte[] getBytes() {
                return null;
            }
        };
View Full Code Here

    return rs.getSQLXML(columnIndex).getCharacterStream();
  }

  @Override
  public Source getXmlAsSource(ResultSet rs, String columnName, Class<? extends Source> sourceClass) throws SQLException {
    SQLXML xmlObject = rs.getSQLXML(columnName);
    return (sourceClass != null ? xmlObject.getSource(sourceClass) : xmlObject.getSource(DOMSource.class));
  }
View Full Code Here

TOP

Related Classes of java.sql.SQLXML

Copyright © 2018 www.massapicom. 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.