Java Code Examples for java.sql.SQLXML

The following are top voted examples for showing how to use java.sql.SQLXML. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: lams   File: Jdbc4SqlXmlHandler.java   Source Code and License 5 votes vote down vote up
@Override
public SqlXmlValue newSqlXmlValue(final XmlCharacterStreamProvider provider) {
	return new AbstractJdbc4SqlXmlValue() {
		@Override
		protected void provideXml(SQLXML xmlObject) throws SQLException, IOException {
			provider.provideXml(xmlObject.setCharacterStream());
		}
	};
}
 
Example 2
Project: ProyectoPacientes   File: JDBC4CallableStatementWrapper.java   Source Code and License 5 votes vote down vote up
public SQLXML getSQLXML(int parameterIndex) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getSQLXML(parameterIndex);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return null;

}
 
Example 3
Project: BibliotecaPS   File: JDBC4ConnectionWrapper.java   Source Code and License 5 votes vote down vote up
public SQLXML createSQLXML() throws SQLException {
    checkClosed();

    try {
        return ((java.sql.Connection) this.mc).createSQLXML();
    } catch (SQLException sqlException) {
        checkAndFireConnectionError(sqlException);
    }

    return null; // never reached, but compiler can't tell
}
 
Example 4
Project: ProyectoPacientes   File: JDBC4PreparedStatementHelper.java   Source Code and License 5 votes vote down vote up
static void setSQLXML(PreparedStatement pstmt, int parameterIndex, SQLXML xmlObject) throws SQLException {
    if (xmlObject == null) {
        pstmt.setNull(parameterIndex, Types.SQLXML);
    } else {
        // FIXME: Won't work for Non-MYSQL SQLXMLs
        pstmt.setCharacterStream(parameterIndex, ((JDBC4MysqlSQLXML) xmlObject).serializeAsCharacterStream());
    }
}
 
Example 5
Project: lams   File: Jdbc4SqlXmlHandler.java   Source Code and License 5 votes vote down vote up
@Override
public SqlXmlValue newSqlXmlValue(final Document document) {
	return new AbstractJdbc4SqlXmlValue() {
		@Override
		protected void provideXml(SQLXML xmlObject) throws SQLException, IOException {
			xmlObject.setResult(DOMResult.class).setNode(document);
		}
	};
}
 
Example 6
Project: the-vigilantes   File: JDBC4CallableStatementWrapper.java   Source Code and License 5 votes vote down vote up
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((PreparedStatement) this.wrappedStmt).setSQLXML(parameterIndex, xmlObject);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 7
Project: the-vigilantes   File: JDBC4CallableStatementWrapper.java   Source Code and License 5 votes vote down vote up
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setSQLXML(parameterName, xmlObject);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 8
Project: the-vigilantes   File: JDBC4CallableStatementWrapper.java   Source Code and License 5 votes vote down vote up
public SQLXML getSQLXML(String parameterName) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            return ((CallableStatement) this.wrappedStmt).getSQLXML(parameterName);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }

    return null;
}
 
Example 9
Project: ProyectoPacientes   File: JDBC4CallableStatementWrapper.java   Source Code and License 5 votes vote down vote up
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setSQLXML(parameterName, xmlObject);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 10
Project: BibliotecaPS   File: JDBC4CallableStatementWrapper.java   Source Code and License 5 votes vote down vote up
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException {
    try {
        if (this.wrappedStmt != null) {
            ((CallableStatement) this.wrappedStmt).setSQLXML(parameterName, xmlObject);
        } else {
            throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
        }
    } catch (SQLException sqlEx) {
        checkAndFireConnectionError(sqlEx);
    }
}
 
Example 11
Project: jdk8u-jdk   File: StubJdbcRowSetImpl.java   Source Code and License 4 votes vote down vote up
@Override
public SQLXML getSQLXML(String columnLabel) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example 12
Project: BibliotecaPS   File: JDBC4UpdatableResultSet.java   Source Code and License 4 votes vote down vote up
public SQLXML getSQLXML(String columnLabel) throws SQLException {
    return getSQLXML(findColumn(columnLabel));
}
 
Example 13
Project: agroal   File: MockResultSet.java   Source Code and License 4 votes vote down vote up
@Override
default void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
}
 
Example 14
Project: spanner-jdbc   File: AbstractCloudSpannerResultSet.java   Source Code and License 4 votes vote down vote up
@Override
public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException
{
	throw new SQLFeatureNotSupportedException();
}
 
Example 15
Project: spanner-jdbc   File: AbstractCloudSpannerPreparedStatement.java   Source Code and License 4 votes vote down vote up
@Override
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
{
	parameters.setParameter(parameterIndex, xmlObject);
}
 
Example 16
Project: elastic-db-tools-for-java   File: ValidationUtils.java   Source Code and License 4 votes vote down vote up
/**
 * Performs validation that the local representation is as up-to-date as the representation on the backing data store.
 *
 * @param conn
 *            Connection used for validation.
 * @param shardMapManager
 *            ShardMapManager reference.
 * @param shardMap
 *            Shard map for the shard.
 * @param shard
 *            Shard to validate.
 */
public static void validateShard(Connection conn,
        ShardMapManager shardMapManager,
        StoreShardMap shardMap,
        StoreShard shard) {
    Stopwatch stopwatch = Stopwatch.createStarted();

    StoreResults lsmResult = new StoreResults();

    JAXBElement jaxbElement = StoreOperationRequestBuilder.validateShardLocal(shardMap.getId(), shard.getId(), shard.getVersion());

    try (CallableStatement cstmt = conn.prepareCall(String.format("{call %s(?,?)}", StoreOperationRequestBuilder.SP_VALIDATE_SHARD_LOCAL))) {
        SQLXML sqlxml = conn.createSQLXML();

        JAXBContext context = JAXBContext.newInstance(StoreOperationInput.class, StoreShard.class, StoreShardMap.class);
        // Set the result value from SAX events.
        SAXResult sxResult = sqlxml.setResult(SAXResult.class);
        context.createMarshaller().marshal(jaxbElement, sxResult);
        /*
         * log.info("Xml:{}\n{}", "ValidateShardLocal", SqlStoreTransactionScope.asString(context, jaxbElement));//
         */

        cstmt.setSQLXML("input", sqlxml);
        cstmt.registerOutParameter("result", Types.INTEGER);
        Boolean hasResults = cstmt.execute();
        StoreResults storeResults = SqlResults.newInstance(cstmt);
        // After iterating resultSet's, get result integer.
        int result = cstmt.getInt("result");
        lsmResult.setResult(StoreResult.forValue(result));

        stopwatch.stop();

        log.info("Shard ValidateShard", "Complete; Shard: {}; Connection: {}; Result: {}; Duration: {}", shard.getLocation(),
                conn.getMetaData().getURL(), lsmResult.getResult(), stopwatch.elapsed(TimeUnit.MILLISECONDS));
    }
    catch (SQLException | JAXBException e) {
        e.printStackTrace();
    }

    if (lsmResult.getResult() != StoreResult.Success) {
        if (lsmResult.getResult() == StoreResult.ShardMapDoesNotExist) {
            shardMapManager.getCache().deleteShardMap(shardMap);
        }

        // Possible errors are:
        // StoreResult.ShardMapDoesNotExist
        // StoreResult.ShardDoesNotExist
        // StoreResult.ShardVersionMismatch
        // StoreResult.StoreVersionMismatch
        // StoreResult.MissingParametersForStoredProcedure
        throw StoreOperationErrorHandler.onValidationErrorLocal(lsmResult, shardMap, shard.getLocation(), "ValidateShard",
                StoreOperationRequestBuilder.SP_VALIDATE_SHARD_LOCAL);
    }
}
 
Example 17
Project: QDrill   File: Drill2489CallsAfterCloseThrowExceptionsTest.java   Source Code and License 4 votes vote down vote up
@Test( expected = AlreadyClosedSqlException.class )
public void testClosedResultSet_updateSQLXML2_throws() throws SQLException {
  closedResultSet.updateSQLXML( "columnLabel", (SQLXML) null );
}
 
Example 18
Project: BibliotecaPS   File: JDBC4MultiHostMySQLConnection.java   Source Code and License 4 votes vote down vote up
public SQLXML createSQLXML() throws SQLException {
    return this.getJDBC4Connection().createSQLXML();
}
 
Example 19
Project: incubator-netbeans   File: SQLStatement.java   Source Code and License 4 votes vote down vote up
void setSQLXML(int parameterIndex, SQLXML xmlObject) {
    parameters.ensureCapacity(parameterIndex+1);
}
 
Example 20
Project: jdk8u-jdk   File: StubCachedRowSetImpl.java   Source Code and License 4 votes vote down vote up
@Override
public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example 21
Project: openjdk-jdk10   File: StubCallableStatement.java   Source Code and License 4 votes vote down vote up
@Override
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example 22
Project: lams   File: JDBC4MultiHostMySQLConnection.java   Source Code and License 4 votes vote down vote up
public SQLXML createSQLXML() throws SQLException {
    return this.getJDBC4Connection().createSQLXML();
}
 
Example 23
Project: BibliotecaPS   File: JDBC4ResultSet.java   Source Code and License 4 votes vote down vote up
public SQLXML getSQLXML(int columnIndex) throws SQLException {
    checkColumnBounds(columnIndex);

    return new JDBC4MysqlSQLXML(this, columnIndex, getExceptionInterceptor());
}
 
Example 24
Project: Saturn   File: SyncRS.java   Source Code and License 4 votes vote down vote up
@Override
public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
    // TODO Auto-generated method stub
    throw new UnsupportedOperationException();
}
 
Example 25
Project: agroal   File: ResultSetWrapper.java   Source Code and License 4 votes vote down vote up
@Override
public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
    wrappedResultSet.updateSQLXML( columnIndex, xmlObject );
}
 
Example 26
Project: BibliotecaPS   File: JDBC4Connection.java   Source Code and License 4 votes vote down vote up
public SQLXML createSQLXML() throws SQLException {
    return new JDBC4MysqlSQLXML(getExceptionInterceptor());
}
 
Example 27
Project: sstore-soft   File: JDBC4ResultSet.java   Source Code and License 4 votes vote down vote up
@Override
public void updateSQLXML(int columnIndex, SQLXML xmlObject)
        throws SQLException {
    throw SQLError.noSupport();
}
 
Example 28
Project: sstore-soft   File: JDBC4CallableStatement.java   Source Code and License 4 votes vote down vote up
@Override
public SQLXML getSQLXML(int parameterIndex) throws SQLException
{
    checkClosed();
    throw SQLError.noSupport();
}
 
Example 29
Project: openjdk-jdk10   File: StubCallableStatement.java   Source Code and License 4 votes vote down vote up
@Override
public SQLXML getSQLXML(String parameterName) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example 30
Project: sstore-soft   File: JDBC4CallableStatement.java   Source Code and License 4 votes vote down vote up
@Override
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException
{
    checkClosed();
    throw SQLError.noSupport();
}
 
Example 31
Project: openjdk-jdk10   File: StubJoinRowSetImpl.java   Source Code and License 4 votes vote down vote up
@Override
public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example 32
Project: jdk8u-jdk   File: StubJdbcRowSetImpl.java   Source Code and License 4 votes vote down vote up
@Override
public SQLXML getSQLXML(int columnIndex) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example 33
Project: QDrill   File: Drill2489CallsAfterCloseThrowExceptionsTest.java   Source Code and License 4 votes vote down vote up
@Test( expected = AlreadyClosedSqlException.class )
public void testClosedResultSet_updateSQLXML1_throws() throws SQLException {
  closedResultSet.updateSQLXML( 123, (SQLXML) null );
}
 
Example 34
Project: ProyectoPacientes   File: JDBC4UpdatableResultSet.java   Source Code and License 4 votes vote down vote up
public SQLXML getSQLXML(int columnIndex) throws SQLException {
    return new JDBC4MysqlSQLXML(this, columnIndex, getExceptionInterceptor());
}
 
Example 35
Project: blanco-sfdc-jdbc-driver   File: BlancoGenericJdbcResultSet.java   Source Code and License 4 votes vote down vote up
public SQLXML getSQLXML(String columnLabel) throws SQLException {
	return cacheResultSet.getSQLXML(columnLabel);
}
 
Example 36
Project: jdk8u-jdk   File: StubJoinRowSetImpl.java   Source Code and License 4 votes vote down vote up
@Override
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example 37
Project: nh-micro   File: MicroPooledConnection.java   Source Code and License 4 votes vote down vote up
@Override
public SQLXML createSQLXML() throws SQLException {
	return conn.createSQLXML();
}
 
Example 38
Project: lams   File: Jdbc4SqlXmlHandler.java   Source Code and License 4 votes vote down vote up
@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));
}
 
Example 39
Project: dremio-oss   File: SqlAccessorWrapper.java   Source Code and License 4 votes vote down vote up
@Override
public SQLXML getSQLXML() throws SQLException {
  throw new SQLFeatureNotSupportedException();
}
 
Example 40
Project: jdk8u-jdk   File: StubSyncResolver.java   Source Code and License 4 votes vote down vote up
@Override
public SQLXML getSQLXML(int columnIndex) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}