本文整理了Java中java.sql.SQLXML.getString()
方法的一些代码示例,展示了SQLXML.getString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SQLXML.getString()
方法的具体详情如下:
包路径:java.sql.SQLXML
类名称:SQLXML
方法名:getString
[英]Returns this object's data as an XML string.
[中]以XML字符串的形式返回此对象的数据。
代码示例来源:origin: spring-projects/spring-framework
@Override
@Nullable
public String getXmlAsString(ResultSet rs, String columnName) throws SQLException {
SQLXML xmlObject = rs.getSQLXML(columnName);
return (xmlObject != null ? xmlObject.getString() : null);
}
代码示例来源:origin: spring-projects/spring-framework
@Override
@Nullable
public String getXmlAsString(ResultSet rs, int columnIndex) throws SQLException {
SQLXML xmlObject = rs.getSQLXML(columnIndex);
return (xmlObject != null ? xmlObject.getString() : null);
}
代码示例来源:origin: postgresql/postgresql
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
{
checkClosed();
if (xmlObject == null || xmlObject.getString() == null)
setNull(parameterIndex, Types.SQLXML);
else
setString(parameterIndex, xmlObject.getString(), Oid.XML);
}
代码示例来源:origin: org.postgresql/postgresql
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
checkClosed();
String stringValue = xmlObject == null ? null : xmlObject.getString();
if (stringValue == null) {
setNull(parameterIndex, Types.SQLXML);
} else {
setString(parameterIndex, stringValue, Oid.XML);
}
}
代码示例来源:origin: debezium/debezium
/**
* Converts a value object for an expected JDBC type of {@link Types#CHAR}, {@link Types#VARCHAR},
* {@link Types#LONGVARCHAR}, {@link Types#CLOB}, {@link Types#NCHAR}, {@link Types#NVARCHAR}, {@link Types#LONGNVARCHAR},
* {@link Types#NCLOB}, {@link Types#DATALINK}, and {@link Types#SQLXML}.
*
* @param column the column definition describing the {@code data} value; never null
* @param fieldDefn the field definition; never null
* @param data the data object to be converted into a {@link Date Kafka Connect date} type; never null
* @return the converted value, or null if the conversion could not be made and the column allows nulls
* @throws IllegalArgumentException if the value could not be converted but the column does not allow nulls
*/
protected Object convertString(Column column, Field fieldDefn, Object data) {
return convertValue(column, fieldDefn, data, "", (r) -> {
if (data instanceof SQLXML) {
try {
r.deliver(((SQLXML)data).getString());
} catch (SQLException e) {
throw new RuntimeException("Error processing data from " + column.jdbcType() + " and column " + column +
": class=" + data.getClass(), e);
}
}
else {
r.deliver(data.toString());
}
});
}
代码示例来源:origin: apache/nifi
case SQLXML:
if (value != null) {
rowValues.add(StringEscapeUtils.escapeCsv(((java.sql.SQLXML) value).getString()));
} else {
rowValues.add("");
代码示例来源:origin: apache/nifi
case SQLXML:
if (value != null) {
rowValues.add(StringEscapeUtils.escapeCsv(((java.sql.SQLXML) value).getString()));
} else {
rowValues.add("");
代码示例来源:origin: apache/nifi
rec.put(i - 1, value);
} else if (value instanceof java.sql.SQLXML) {
rec.put(i - 1, ((java.sql.SQLXML) value).getString());
} else {
代码示例来源:origin: apache/nifi
rec.put(i - 1, value);
} else if (value instanceof java.sql.SQLXML) {
rec.put(i - 1, ((java.sql.SQLXML) value).getString());
} else {
代码示例来源:origin: apache/nifi
rec.put(i - 1, ((SQLXML) value).getString());
} else {
代码示例来源:origin: org.mybatis/mybatis
protected String sqlxmlToString(SQLXML sqlxml) throws SQLException {
if (sqlxml == null) {
return null;
}
try {
return sqlxml.getString();
} finally {
sqlxml.free();
}
}
代码示例来源:origin: co.paralleluniverse/comsat-jdbc
@Override
public String call() throws SQLException {
return sqlXML.getString();
}
});
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL:
* Casts the passed object to SQLXML and calls getString and free methods
*/
public static String getStringAndFreeSQLXML(Object sqlXml) throws SQLException {
String str = ((SQLXML)sqlXml).getString();
((SQLXML)sqlXml).free();
return str;
}
代码示例来源:origin: com.querydsl/querydsl-sql
@Override
public String getValue(ResultSet rs, int startIndex) throws SQLException {
SQLXML value = rs.getSQLXML(startIndex);
return value != null ? value.getString() : null;
}
代码示例来源:origin: com.mysema.querydsl/querydsl-sql
@Override
public String getValue(ResultSet rs, int startIndex) throws SQLException {
SQLXML value = rs.getSQLXML(startIndex);
return value != null ? value.getString() : null;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* Casts the passed object to SQLXML and calls getString and free methods
*/
public String getStringAndFreeSQLXML(Object sqlXml) throws SQLException {
String str = ((SQLXML)sqlXml).getString();
((SQLXML)sqlXml).free();
return str;
}
}
代码示例来源:origin: org.ancoron.postgresql/org.postgresql
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
{
checkClosed();
if (xmlObject == null || xmlObject.getString() == null)
setNull(parameterIndex, Types.SQLXML);
else
setString(parameterIndex, xmlObject.getString(), Oid.XML);
}
代码示例来源:origin: org.ancoron.postgresql/org.postgresql.osgi
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
{
checkClosed();
if (xmlObject == null || xmlObject.getString() == null)
setNull(parameterIndex, Types.SQLXML);
else
setString(parameterIndex, xmlObject.getString(), Oid.XML);
}
代码示例来源:origin: teiid/teiid
@Test public void testGoodXML() throws Exception {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><customer>\n" + //$NON-NLS-1$
"<name>ABC</name>" + //$NON-NLS-1$
"<age>32</age>" + //$NON-NLS-1$
"</customer>"; //$NON-NLS-1$
StringToSQLXMLTransform transform = new StringToSQLXMLTransform();
SQLXML xmlValue = (SQLXML)transform.transformDirect(xml);
assertEquals(xml.replaceAll("[\r]", ""), xmlValue.getString().replaceAll("[\r]", ""));
}
代码示例来源:origin: teiid/teiid
private void helpTestJson(String json, String rootName, String expected)
throws SQLException, TeiidComponentException,
TeiidProcessingException, SerialException, IOException {
CommandContext cc = new CommandContext();
cc.setBufferManager(BufferManagerFactory.getStandaloneBufferManager());
SQLXML xml = XMLSystemFunctions.jsonToXml(cc, rootName, new SerialClob(json.toCharArray()));
assertEquals(expected, xml.getString());
xml = XMLSystemFunctions.jsonToXml(cc, rootName, new SerialBlob(json.getBytes(Charset.forName("UTF-8"))));
assertEquals(expected, xml.getString());
xml = XMLSystemFunctions.jsonToXml(cc, rootName, new SerialBlob(json.getBytes(Charset.forName("UTF-32BE"))));
assertEquals(expected, xml.getString());
}
内容来源于网络,如有侵权,请联系作者删除!