本文整理汇总了Java中com.healthmarketscience.jackcess.Column.getPrecision方法的典型用法代码示例。如果您正苦于以下问题:Java Column.getPrecision方法的具体用法?Java Column.getPrecision怎么用?Java Column.getPrecision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.healthmarketscience.jackcess.Column
的用法示例。
在下文中一共展示了Column.getPrecision方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: floatValue
import com.healthmarketscience.jackcess.Column; //导入方法依赖的package包/类
public static double floatValue(Object value, Column column) {
Byte precission = column.getPrecision();
if(precission == 0) precission = 2;
Double number = Double.valueOf(value.toString());
BigDecimal bigDecimal = new BigDecimal(number);
BigDecimal roundedWithScale = bigDecimal.setScale(precission, BigDecimal.ROUND_HALF_UP);
return Double.valueOf(roundedWithScale.toString());
}
示例2: fillSQLType
import com.healthmarketscience.jackcess.Column; //导入方法依赖的package包/类
private void fillSQLType( ColumnDefinition myCol, Column col )
throws SQLException
{
String name = col.getType().name();
int type = col.getSQLType();
switch( type )
{
case Types.DOUBLE:
{
if( col.getPrecision() == 0 )
{
String lowerName = col.getName().toLowerCase();
if( lowerName.endsWith( "_id" ) || lowerName.endsWith( "_lnk" ) )
{
type = Types.INTEGER;
name = "integer";
}
}
// System.out.println( "double col: " + table.getName() + "." + myCol.name
// + " sqlType: " + col.getSQLType() + " precision: " + col.getPrecision()
// + " scale: " + col.getScale() + " varLen: " + col.isVariableLength() + " idx:" + col.getColumnIndex() );
}
break;
case Types.VARCHAR:
name = "varchar";
break;
case Types.TIMESTAMP:
name = "timestamp";
break;
case Types.INTEGER:
if( col.isAutoNumber() )
{
name = "serial";
}
break;
case Types.LONGVARCHAR:
name = "longvarchar";
break;
}
/* if( "memo".equals( name.toLowerCase() ) )
{
System.out.println( "memo TYPE: " + type );
name = "text";
}*/
myCol.sqlType = type;
myCol.sqlTypeName = name;
}