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, theGeneratorquoteName| 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, toLongerStringaddFlag, addValidator, doValidate, equals, getFieldName, getFlags, getRecordMeta, getUserProperties, getUserProperty, getValidators, hashCode, isDescriptive, isUnqueried, nextGeneratedValue, putUserProperty, readResolve, setQuoted, toString, writeFieldValue, writeFieldValuepublic 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
SFieldMetaqueryFieldValue in class SFieldMetajava.lang.Exceptionprotected java.lang.Object convertToDataSetFieldType(java.lang.Object raw)
throws java.lang.Exception
SFieldMetaSRecordInstance.setObject etc., Not getObject.convertToDataSetFieldType in class SFieldMetajava.lang.Exceptionpublic java.lang.String defaultSqlDataType()
defaultSqlDataType in class SFieldScalarpublic boolean isFKeyCompatible(SFieldScalar field)
SFieldScalarpublic int javaSqlType()
javaSqlType in class SFieldScalar