Commit 0b584f0 1 parent e46fae7 commit 0b584f0 Copy full SHA for 0b584f0
File tree 1 file changed +7
-4
lines changed
src/test/java/com/microsoft/sqlserver/jdbc/databasemetadata
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 24
24
import java .sql .ResultSetMetaData ;
25
25
import java .sql .SQLException ;
26
26
import java .sql .Statement ;
27
+ import java .sql .Types ;
27
28
import java .text .MessageFormat ;
28
29
import java .util .HashMap ;
29
30
import java .util .LinkedHashMap ;
@@ -700,11 +701,13 @@ public void testGetColumns() throws SQLException {
700
701
String columnName = rsmd .getColumnName (i );
701
702
Object value = resultSet .getObject (columnName );
702
703
if (0 == rowCount ) {
703
- Object expectedValue = firstRow .get (columnName );
704
- if (expectedValue instanceof String ) {
704
+ int expectedType = rsmd .getColumnType (i );
705
+ if (null != firstRow .get (columnName )
706
+ && (Types .VARCHAR == expectedType || Types .NVARCHAR == expectedType )) {
705
707
assertEquals (firstRow .get (columnName ).toString ().toLowerCase (),
706
- (String ) resultSet .getString (columnName ).toLowerCase ());
707
- } else if (expectedValue instanceof Number ) {
708
+ resultSet .getString (columnName ).toLowerCase ());
709
+ } else if (null != firstRow .get (columnName ) && (Types .TINYINT == expectedType
710
+ || Types .SMALLINT == expectedType || Types .INTEGER == expectedType )) {
708
711
assertEquals (firstRow .get (columnName ), resultSet .getInt (columnName ));
709
712
} else {
710
713
assertEquals (firstRow .get (columnName ), value );
You can’t perform that action at this time.
0 commit comments