本文整理汇总了Java中java.sql.JDBCType.equals方法的典型用法代码示例。如果您正苦于以下问题:Java JDBCType.equals方法的具体用法?Java JDBCType.equals怎么用?Java JDBCType.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.JDBCType
的用法示例。
在下文中一共展示了JDBCType.equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: column
import java.sql.JDBCType; //导入方法依赖的package包/类
public <T> QueryAssert column(int columnIndex, JDBCType type, ColumnValuesAssert<T> columnValuesAssert)
{
if (fromSqlIndex(columnIndex) > actual.getColumnsCount()) {
failWithMessage("Result contains only <%s> columns, extracting column <%s>",
actual.getColumnsCount(), columnIndex);
}
JDBCType actualColumnType = actual.getColumnType(columnIndex);
if (!type.equals(actualColumnType)) {
failWithMessage("Expected <%s> column, to be type: <%s>, but was: <%s>", columnIndex, type, actualColumnType);
}
List<T> columnValues = actual.column(columnIndex);
columnValuesAssert.assertColumnValues(Assertions.assertThat(columnValues));
return this;
}
示例2: hasColumns
import java.sql.JDBCType; //导入方法依赖的package包/类
public QueryAssert hasColumns(List<JDBCType> expectedTypes)
{
hasColumnsCount(expectedTypes.size());
for (int i = 0; i < expectedTypes.size(); i++) {
JDBCType expectedType = expectedTypes.get(i);
JDBCType actualType = actual.getColumnType(toSqlIndex(i));
if (!actualType.equals(expectedType)) {
failWithMessage("Expected <%s> column of type <%s>, but was <%s>, actual columns: %s", i, expectedType, actualType, actual.getColumnTypes());
}
}
return this;
}
示例3: getTypeDescription
import java.sql.JDBCType; //导入方法依赖的package包/类
/**
* Create a data type description for this column
*
* @param columnResultSet
* @return
* @throws SQLException
*/
protected String getTypeDescription(ResultSet columnResultSet)
throws SQLException {
StringBuffer buffer = new StringBuffer();
// initialize with a proper value, if type cannot be resolved
JDBCType type = JDBCType.OTHER;
String typeName = type.getName();
int typeValue = columnResultSet.getInt("DATA_TYPE");
try {
type = JDBCType.valueOf(typeValue);
} catch (IllegalArgumentException exception) {
LOGGER.warn(
"Integer constant '{}' does not seem to represent a known JDBCType.",
Integer.toString(typeValue));
}
int size = columnResultSet.getInt("COLUMN_SIZE");
if (type != null) {
buffer.append(type.name());
if (type.equals(JDBCType.CHAR) || type.equals(JDBCType.VARCHAR)
|| type.equals(JDBCType.LONGNVARCHAR)
|| type.equals(JDBCType.LONGVARCHAR)
|| type.equals(JDBCType.NCHAR)
|| type.equals(JDBCType.NVARCHAR)) {
buffer.append("(");
buffer.append(size);
buffer.append(")");
} else if (type.equals(JDBCType.DECIMAL)
|| type.equals(JDBCType.DOUBLE)
|| type.equals(JDBCType.FLOAT)
|| type.equals(JDBCType.REAL)
|| type.equals(JDBCType.NUMERIC)) {
buffer.append("(");
buffer.append(size);
if (columnResultSet.getObject("DECIMAL_DIGITS")!=null) {
int fractionalDigits =columnResultSet.getInt("DECIMAL_DIGITS");
buffer.append(',');
buffer.append(fractionalDigits);
}
buffer.append(")");
}
}
return buffer.toString();
}