1 package mobisnap.mobile_trx; 2 3 import java.math.*; 4 5 /*** 6 * Used to represent variables and constants internally 7 */ 8 public class MSQLTReal extends MSQLTVariable 9 { 10 int precision, scale; 11 12 public MSQLTReal( boolean constant, boolean notnull, int precision, int scale) { 13 super( constant, notnull); 14 this.precision = precision; 15 this.scale = scale; 16 } 17 18 /*** 19 * Sets the value of the given variable 20 */ 21 public void setValue( Object obj) throws Exception { 22 if( constant && value != null) 23 throw new mobisnap.MobisnapException( "Assigning value to constant"); 24 if( obj instanceof Integer) 25 value = new Double( ((Integer)obj).doubleValue()); 26 else if( obj instanceof Double) 27 value = obj; 28 else if( obj instanceof Float) 29 value = new Double( ((Float)obj).doubleValue()); 30 else if( obj instanceof BigDecimal) 31 value = new Double( ((BigDecimal)obj).doubleValue()); 32 else if( obj instanceof SQLNull && ! notnull) 33 value = obj; 34 else if( obj instanceof String) 35 value = new Integer( (String)obj); 36 else 37 throw new mobisnap.MobisnapException( "Invalid assgnment to real : " + obj.getClass().getName()); 38 } 39 }

This page was automatically generated by Maven