[Commits] Rev 401: CONJ-20 Ensure that getObject() returns byte array for CHAR BINARY. in file:///H:/bzr/mariadb-jdbc-push/

Vladislav Vaintroub wlad at montyprogram.com
Sun Feb 3 22:40:14 EET 2013


At file:///H:/bzr/mariadb-jdbc-push/

------------------------------------------------------------
revno: 401
revision-id: wlad at montyprogram.com-20130203203959-deg198021t1ovavj
parent: wlad at montyprogram.com-20130202233230-paskqiwhblvv5t1u
fixes bug: https://mariadb.atlassian.net/browse/CONJ-20
committer: Vladislav Vaintroub <wlad at montyprogram.com>
branch nick: mariadb-jdbc-push
timestamp: Sun 2013-02-03 21:39:59 +0100
message:
  CONJ-20 Ensure that getObject() returns byte array for CHAR BINARY. 
  
  Also  make sure that  getColumnType,getColumnClassName,getColumnTypeName return values indicating binary type for fixed binary type
-------------- next part --------------
=== modified file 'src/main/java/org/mariadb/jdbc/MySQLResultSetMetaData.java'
--- a/src/main/java/org/mariadb/jdbc/MySQLResultSetMetaData.java	2013-02-02 23:32:30 +0000
+++ b/src/main/java/org/mariadb/jdbc/MySQLResultSetMetaData.java	2013-02-03 20:39:59 +0000
@@ -293,7 +293,10 @@ public class MySQLResultSetMetaData impl
                 if (ci.getLength() < 0)
                     return Types.LONGVARCHAR;
                 return Types.VARCHAR;
-
+            case CHAR :
+                if (ci.isBinary())
+                    return Types.BINARY;
+                return Types.CHAR;
             default:
                 return ci.getType().getSqlType();
         }
@@ -336,6 +339,15 @@ public class MySQLResultSetMetaData impl
                 } else {
                     return "LONGBLOB";
                 }
+            case VARCHAR:
+                if (ci.isBinary())
+                    return "VARBINARY";
+                return "VARCHAR";
+            case CHAR :
+                if (ci.isBinary())
+                    return "BINARY";
+                return "CHAR";
+                
             default:
                 return ci.getType().getTypeName();
         }
@@ -439,6 +451,8 @@ public class MySQLResultSetMetaData impl
           case CLOB:
               return String.class.getName();
           case CHAR:
+              if (ci.isBinary())
+                  return byteArrayClassName;
               return String.class.getName();
           default:
               return byteArrayClassName;

=== modified file 'src/main/java/org/mariadb/jdbc/internal/mysql/MySQLValueObject.java'
--- a/src/main/java/org/mariadb/jdbc/internal/mysql/MySQLValueObject.java	2013-01-15 01:22:15 +0000
+++ b/src/main/java/org/mariadb/jdbc/internal/mysql/MySQLValueObject.java	2013-02-03 20:39:59 +0000
@@ -146,6 +146,8 @@ public class MySQLValueObject extends Ab
             case CLOB:
                 return getString();
             case CHAR:
+                if (columnInfo.isBinary())
+                    return getBytes();
                 return getString();
             case OLDDECIMAL:
                 return getString();

=== modified file 'src/test/java/org/mariadb/jdbc/DatatypeTest.java'
--- a/src/test/java/org/mariadb/jdbc/DatatypeTest.java	2012-12-09 16:40:13 +0000
+++ b/src/test/java/org/mariadb/jdbc/DatatypeTest.java	2013-02-03 20:39:59 +0000
@@ -112,7 +112,8 @@ public class DatatypeTest extends BaseTe
                 yearIsDateType? Types.DATE: Types.SMALLINT);
         checkClass("char0", String.class, "CHAR", Types.CHAR);
         checkClass("varchar0", String.class, "VARCHAR", Types.VARCHAR);
-        checkClass("varchar_binary",byteArrayClass, "VARCHAR", Types.VARBINARY);
+        checkClass("varchar_binary",byteArrayClass, "VARBINARY", Types.VARBINARY);
+        checkClass("binary0", byteArrayClass, "BINARY", Types.BINARY);
         checkClass("tinyblob0",byteArrayClass, "TINYBLOB", Types.VARBINARY);
         checkClass("tinytext0", String.class, "VARCHAR", Types.VARCHAR);
         checkClass("blob0", byteArrayClass, "BLOB",Types.VARBINARY);



More information about the commits mailing list