public class SFieldBigDecimal extends SFieldScalar
What is the best way to represent money ammounts exactly? Scaled longs are no good for direct end user queries on the database. Doubles tend to loose precission due to Java truncating instead of rounding -- things will not balance. And BigDecimals are inefficient and a real pain to use. Your choice.
sqlDataTypeOverride, theGenerator
quoteName
Constructor and Description |
---|
SFieldBigDecimal(SRecordMeta meta,
java.lang.String columnName,
int precission,
int scale,
SFieldFlags... pvals)
Note that precission and scale parameters only affect how the tables are
created.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
convertToDataSetFieldType(java.lang.Object raw)
Converts the parameter from the raw type parameter to the correct internal Object
type that is stored in the data set.
|
java.lang.String |
defaultSqlDataType()
This is basically SQL 2, and fairly database
independent, we hope.
|
int |
getPrecision() |
int |
getScale() |
boolean |
isFKeyCompatible(SFieldScalar field)
Check if two fields can be used on both sides of a foreign key
relation (same type, length, ...)
|
int |
javaSqlType() |
java.lang.Object |
queryFieldValue(java.sql.ResultSet rs,
int sqlIndex)
Issues a JDBC get*() on the result set for the field and converts the
database type to the appropriate internal type, eg, Double for a double
field.
|
getColumnName, getGeneratorMode, getGeneratorParameter, getMaxSize, getReferences, getTheGenerator, isForeignKey, isGenerated, isMandatory, isNotOptimisticLocked, isPrimary, overrideSqlDataType, setGeneratorMode, setMaxSize, setTheGenerator, toLongerString
addFlag, addValidator, doValidate, equals, getFieldName, getFlags, getRecordMeta, getUserProperties, getUserProperty, getValidators, hashCode, isDescriptive, isUnqueried, nextGeneratedValue, putUserProperty, readResolve, setQuoted, toString, writeFieldValue, writeFieldValue
public SFieldBigDecimal(SRecordMeta meta, java.lang.String columnName, int precission, int scale, SFieldFlags... pvals)
public int getPrecision()
public int getScale()
public java.lang.Object queryFieldValue(java.sql.ResultSet rs, int sqlIndex) throws java.lang.Exception
SFieldMeta
queryFieldValue
in class SFieldMeta
java.lang.Exception
protected java.lang.Object convertToDataSetFieldType(java.lang.Object raw) throws java.lang.Exception
SFieldMeta
SRecordInstance.setObject
etc., Not getObject.convertToDataSetFieldType
in class SFieldMeta
java.lang.Exception
public java.lang.String defaultSqlDataType()
defaultSqlDataType
in class SFieldScalar
public boolean isFKeyCompatible(SFieldScalar field)
SFieldScalar
public int javaSqlType()
javaSqlType
in class SFieldScalar