本文整理汇总了Java中java.sql.ResultSetMetaData.getColumnDisplaySize方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSetMetaData.getColumnDisplaySize方法的具体用法?Java ResultSetMetaData.getColumnDisplaySize怎么用?Java ResultSetMetaData.getColumnDisplaySize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.ResultSetMetaData
的用法示例。
在下文中一共展示了ResultSetMetaData.getColumnDisplaySize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isEqualsTo
import java.sql.ResultSetMetaData; //导入方法依赖的package包/类
boolean isEqualsTo(ResultSetMetaData metadata, int colNum) throws SQLException {
return
metadata.getCatalogName(colNum).equals(InfoSchemaConstants.IS_CATALOG_NAME) &&
metadata.getSchemaName(colNum).isEmpty() &&
metadata.getTableName(colNum).isEmpty() &&
metadata.getColumnName(colNum).equals(columnName) &&
metadata.getColumnLabel(colNum).equals(columnName) &&
metadata.getColumnType(colNum) == type &&
metadata.isNullable(colNum) == nullable &&
// There is an existing bug where query results doesn't contain the precision for VARCHAR field.
//metadata.getPrecision(colNum) == precision &&
metadata.getScale(colNum) == scale &&
metadata.isSigned(colNum) == signed &&
metadata.getColumnDisplaySize(colNum) == displaySize &&
metadata.getColumnClassName(colNum).equals(className) &&
metadata.isSearchable(colNum) &&
metadata.isAutoIncrement(colNum) == false &&
metadata.isCaseSensitive(colNum) == false &&
metadata.isReadOnly(colNum) &&
metadata.isWritable(colNum) == false &&
metadata.isDefinitelyWritable(colNum) == false &&
metadata.isCurrency(colNum) == false;
}
示例2: resultSetToFieldPacket
import java.sql.ResultSetMetaData; //导入方法依赖的package包/类
public static void resultSetToFieldPacket(String charset,
List<FieldPacket> fieldPks, ResultSet rs,
boolean isSpark) throws SQLException {
ResultSetMetaData metaData = rs.getMetaData();
int colunmCount = metaData.getColumnCount();
if (colunmCount > 0) {
//String values="";
for (int i = 0; i < colunmCount; i++) {
int j = i + 1;
FieldPacket fieldPacket = new FieldPacket();
fieldPacket.orgName = StringUtil.encode(metaData.getColumnName(j),charset);
fieldPacket.name = StringUtil.encode(metaData.getColumnLabel(j), charset);
if (! isSpark){
fieldPacket.orgTable = StringUtil.encode(metaData.getTableName(j), charset);
fieldPacket.table = StringUtil.encode(metaData.getTableName(j), charset);
fieldPacket.db = StringUtil.encode(metaData.getSchemaName(j),charset);
fieldPacket.flags = toFlag(metaData, j);
}
fieldPacket.length = metaData.getColumnDisplaySize(j);
fieldPacket.decimals = (byte) metaData.getScale(j);
int javaType = MysqlDefs.javaTypeDetect(
metaData.getColumnType(j), fieldPacket.decimals);
fieldPacket.type = (byte) (MysqlDefs.javaTypeMysql(javaType) & 0xff);
if(MysqlDefs.isBianry((byte) fieldPacket.type)) {
// 63 represent binary character set
fieldPacket.charsetIndex = 63;
}
fieldPks.add(fieldPacket);
//values+=metaData.getColumnLabel(j)+"|"+metaData.getColumnName(j)+" ";
}
// System.out.println(values);
}
}
示例3: toString
import java.sql.ResultSetMetaData; //导入方法依赖的package包/类
private static String toString(ResultSetMetaData metadata, int colNum) throws SQLException {
return "ResultSetMetaData(" + colNum + ")[" +
"columnName='" + metadata.getColumnName(colNum) + '\'' +
", type='" + metadata.getColumnType(colNum) + '\'' +
", nullable=" + metadata.isNullable(colNum) +
", displaySize=" + metadata.getColumnDisplaySize(colNum) +
", precision=" + metadata.getPrecision(colNum) +
", scale=" + metadata.getScale(colNum) +
", signed=" + metadata.isSigned(colNum) +
", className='" + metadata.getColumnClassName(colNum) + '\'' +
']';
}