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 TypeClob implements Type, Externalizable { 58 public static final TypeClob typeClob = new TypeClob(); 59 int max = -1; 60 61 public TypeClob() {} 62 63 public TypeClob(int max) { 64 this.max = max; 65 } 66 67 public String getTypeName() { 68 return "CLOB"; 69 } 70 71 public int getMax() { return max; } 72 73 public int getJDBCType() { 74 return Types.CLOB; 78 } 80 81 public String getJDBCClassName() { return "java.sql.Clob"; } 82 83 public int getPrecision() { return max; } 84 85 public int getScale() { return 0; } 86 87 public int getMaxPrecision() { return -1; } 88 89 public int getMinScale() { return -1; } 90 91 public int getMaxScale() { return -1; } 92 93 public boolean isCharType() { return false; } 94 95 public boolean isCaseSensitive() { return false; } 96 97 public boolean isCurrency() { return false; } 98 99 public boolean isSigned() { return false; } 100 101 public int getDisplayWidth() { return (max + 3) / 4; } 102 103 public String toString() { 104 StringBuffer sb = new StringBuffer (); 105 sb.append("CLOB"); 106 if (max > 0) { 107 sb.append('('); 108 sb.append(Integer.toString(max)); 109 sb.append(')'); 110 } 111 return sb.toString(); 112 } 113 114 118 public void readExternal(ObjectInput in) throws IOException { 119 max = in.readInt(); 120 } 121 122 public void writeExternal(ObjectOutput out) throws IOException { 123 out.writeInt(max); 124 } 125 126 public Value convert(Value v) throws ValueException { 127 return v.convert(this); 128 } 129 130 public String getCreateParams() { 131 return "length"; 132 } 133 } 134 | Popular Tags |