本文整理匯總了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) + '\'' +
']';
}