1 package com.quadcap.sql.types; 2 3 40 41 import java.io.Externalizable ; 42 import java.io.IOException ; 43 import java.io.ObjectInput ; 44 import java.io.ObjectOutput ; 45 46 import java.sql.ResultSet ; 47 import java.sql.SQLException ; 48 import java.sql.Types ; 49 50 import com.quadcap.util.Debug; 51 52 57 public class TypeBoolean implements Type, Externalizable { 58 public static final TypeBoolean typeBoolean = new TypeBoolean(); 59 60 public TypeBoolean() {} 61 62 public String getTypeName() { 63 return "BOOLEAN"; 64 } 65 66 public int getJDBCType() { return Types.BIT; } 67 68 public String getJDBCClassName() { return "java.lang.Boolean"; } 69 70 public int getPrecision() { return 1; } 71 72 public int getScale() { return 0; } 73 74 public int getMaxPrecision() { return 1; } 75 76 public int getMinScale() { return 0; } 77 78 public int getMaxScale() { return 0; } 79 80 public boolean isCharType() { return false; } 81 82 public boolean isCaseSensitive() { return false; } 83 84 public boolean isCurrency() { return false; } 85 86 public boolean isSigned() { return false; } 87 88 public int getDisplayWidth() { return 1; } 89 90 public String toString() { 91 return "BOOLEAN"; 92 } 93 94 98 public void readExternal(ObjectInput in) { 99 } 100 101 public void writeExternal(ObjectOutput out) { 102 } 103 104 public Value convert(Value v) throws ValueException { 105 return v.convert(this); 106 } 107 108 public String getCreateParams() { 109 return null; 110 } 111 112 public static ValueBoolean convertNumber(long val) { 113 return val == 0 ? ValueBoolean.falseBoolean : ValueBoolean.trueBoolean; 114 } 115 } 116 | Popular Tags |