db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r510264 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java
Date Wed, 21 Feb 2007 22:09:21 GMT
Author: kmarsden
Date: Wed Feb 21 14:09:20 2007
New Revision: 510264

URL: http://svn.apache.org/viewvc?view=rev&rev=510264
Log:
DERBY-2333 partial checking paramterMapping conversion


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java?view=diff&rev=510264&r1=510263&r2=510264
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java Wed Feb 21 14:09:20
2007
@@ -27,6 +27,8 @@
 import java.util.List;
 import java.util.ListIterator;
 
+import org.apache.derby.iapi.reference.JDBC30Translation;
+
 import junit.framework.Assert;
 
 /**
@@ -830,5 +832,47 @@
 	{
 		return "\"" + schema + "\".\"" + name + "\"";
 	}
+         
+        /**
+         * Return Type name from jdbc type
+         * 
+         * @param jdbcType  jdbc type to translate
+         * @return
+         */
+        public static String sqlNameFromJdbc(int jdbcType) {
+                switch (jdbcType) {
+                        case Types.BIT          :  return "Types.BIT";
+                        case JDBC30Translation.SQL_TYPES_BOOLEAN  : return "Types.BOOLEAN";
+                        case Types.TINYINT      :  return "Types.TINYINT";
+                        case Types.SMALLINT     :  return "SMALLINT";
+                        case Types.INTEGER      :  return "INTEGER";
+                        case Types.BIGINT       :  return "BIGINT";
+
+                        case Types.FLOAT        :  return "Types.FLOAT";
+                        case Types.REAL         :  return "REAL";
+                        case Types.DOUBLE       :  return "DOUBLE";
+
+                        case Types.NUMERIC      :  return "Types.NUMERIC";
+                        case Types.DECIMAL      :  return "DECIMAL";
+
+                        case Types.CHAR         :  return "CHAR";
+                        case Types.VARCHAR      :  return "VARCHAR";
+                        case Types.LONGVARCHAR  :  return "LONG VARCHAR";
+         case Types.CLOB     :  return "CLOB";
+
+                        case Types.DATE                 :  return "DATE";
+                        case Types.TIME                 :  return "TIME";
+                        case Types.TIMESTAMP    :  return "TIMESTAMP";
+
+                        case Types.BINARY                       :  return "CHAR () FOR BIT
DATA";
+                        case Types.VARBINARY            :  return "VARCHAR () FOR BIT DATA";
+                        case Types.LONGVARBINARY        :  return "LONG VARCHAR FOR BIT DATA";
+         case Types.BLOB             :  return "BLOB";
+
+                        case Types.OTHER                :  return "Types.OTHER";
+                        case Types.NULL         :  return "Types.NULL";
+                        default : return String.valueOf(jdbcType);
+                }
+        }
 
 }



Mime
View raw message