本文整理匯總了Java中java.sql.SQLXML類的典型用法代碼示例。如果您正苦於以下問題:Java SQLXML類的具體用法?Java SQLXML怎麽用?Java SQLXML使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SQLXML類屬於java.sql包,在下文中一共展示了SQLXML類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: newSqlXmlValue
import java.sql.SQLXML; //導入依賴的package包/類
@Override
public SqlXmlValue newSqlXmlValue(final XmlCharacterStreamProvider provider) {
return new AbstractJdbc4SqlXmlValue() {
@Override
protected void provideXml(SQLXML xmlObject) throws SQLException, IOException {
provider.provideXml(xmlObject.setCharacterStream());
}
};
}
示例2: getSQLXML
import java.sql.SQLXML; //導入依賴的package包/類
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;
}
示例3: createSQLXML
import java.sql.SQLXML; //導入依賴的package包/類
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
}
示例4: setSQLXML
import java.sql.SQLXML; //導入依賴的package包/類
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());
}
}
示例5: setSQLXML
import java.sql.SQLXML; //導入依賴的package包/類
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);
}
}
示例6: getSQLXML
import java.sql.SQLXML; //導入依賴的package包/類
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;
}
示例7: setSQLXML
import java.sql.SQLXML; //導入依賴的package包/類
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);
}
}
示例8: getSQLXML
import java.sql.SQLXML; //導入依賴的package包/類
@Override
public SQLXML getSQLXML(String columnLabel) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}
示例9: getSQLXML
import java.sql.SQLXML; //導入依賴的package包/類
public SQLXML getSQLXML(String columnLabel) throws SQLException {
return getSQLXML(findColumn(columnLabel));
}
示例10: updateSQLXML
import java.sql.SQLXML; //導入依賴的package包/類
@Override
default void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
}
示例11: updateSQLXML
import java.sql.SQLXML; //導入依賴的package包/類
@Override
public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException
{
throw new SQLFeatureNotSupportedException();
}
示例12: setSQLXML
import java.sql.SQLXML; //導入依賴的package包/類
@Override
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
{
parameters.setParameter(parameterIndex, xmlObject);
}
示例13: validateShard
import java.sql.SQLXML; //導入依賴的package包/類
/**
* 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);
}
}
示例14: testClosedResultSet_updateSQLXML2_throws
import java.sql.SQLXML; //導入依賴的package包/類
@Test( expected = AlreadyClosedSqlException.class )
public void testClosedResultSet_updateSQLXML2_throws() throws SQLException {
closedResultSet.updateSQLXML( "columnLabel", (SQLXML) null );
}
示例15: createSQLXML
import java.sql.SQLXML; //導入依賴的package包/類
public SQLXML createSQLXML() throws SQLException {
return this.getJDBC4Connection().createSQLXML();
}