You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by st...@apache.org on 2002/10/21 13:39:27 UTC
cvs commit: jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model TypeMap.java
stevencaswell 2002/10/21 04:39:27
Modified: sql/src/java/org/apache/commons/sql/model TypeMap.java
Log:
added method getSQLTypeString(Integer typeCode) to provide the reverse of getSQLTypeCode(String typeName)
Revision Changes Path
1.2 +12 -0 jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/TypeMap.java
Index: TypeMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/model/TypeMap.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TypeMap.java 16 Sep 2002 14:51:08 -0000 1.1
+++ TypeMap.java 21 Oct 2002 11:39:27 -0000 1.2
@@ -143,6 +143,7 @@
};
private static Hashtable sqlTypeNameToTypeID = new Hashtable();
+ private static Hashtable sqlTypeIDToTypeName = new Hashtable();
@@ -188,6 +189,16 @@
return Types.OTHER;
}
+ public static String getSQLTypeString(Integer typeCode)
+ {
+ String answer = (String) sqlTypeIDToTypeName.get(typeCode);
+ if ( answer != null )
+ {
+ return answer;
+ }
+ return "UNKNOWN";
+ }
+
/**
* Returns true if values for the type need to be quoted.
*
@@ -214,6 +225,7 @@
protected static void registerSqlTypeID(Integer sqlTypeID, String name)
{
sqlTypeNameToTypeID.put(name, sqlTypeID);
+ sqlTypeIDToTypeName.put(sqlTypeID, name);
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>