This is a general question, looking for the correct way to deal with it.
sqlunit-flat:
[sqlunit] *** Running SQLUnit file: test/ASA/testtypes.xml
[sqlunit] Getting connection(DEFAULT)
[sqlunit] Setting up test...
[sqlunit] Running test[1]: Testing all datatypes (0ms)
[sqlunit] Could not format java.lang.Integer to SMALLINT(5), unsupported datatype
[sqlunit] Tearing down test...
[sqlunit] SQLUnit Tests Failed: In file: test/ASA/testtypes.xml, tests: 1, failures: 1, errors = 0
[sqlunit] One or more SQLUnit Tests failed, see the console for details
Basically I am trying to test all available data types that are supported by ASA. So the test I wrote does this:
<test name="Testing all datatypes">
<call>
<stmt>
select CAST(1 AS BIT) as "bit"
, CAST(10 AS TINYINT) as "tinyint"
, CAST(100 AS SMALLINT) as "smallint"
--, CAST(1000 AS INTEGER) as "integer"
--, CAST(10000 AS UNSIGNED INTEGER) as "unsigned_integer"
--, CAST(100000 AS BIGINT) as "bigint"
--, CAST(1000000 AS UNSIGNED BIGINT) as "unsigned_bigint"
--, CAST('char' AS CHAR(4)) as "char"
--, CAST('varchar' AS VARCHAR(7)) as "varchar"
--, CAST('long varchar' AS LONG VARCHAR) as "long_varchar"
--, CAST('binary' AS BINARY(6)) as "binary"
--, CAST('varbinary' AS VARBINARY(9)) as "varbinary"
--, CAST('long binary' AS LONG BINARY) as "long_binary"
--, CAST('xml' AS XML) as "xml"
--, CAST('1900/1/1' AS DATE) as "date"
--, CAST('1900/1/1 13:02:55' AS DATETIME) as "datetime"
--, CAST('1901/1/1' AS TIMESTAMP) as "timestamp"
--, CAST('1902/1/1' AS SMALLDATETIME) as "smalldatetime"
--, CAST('300.12' AS NUMERIC(5,2)) as "numeric"
--, CAST('301.13' AS DECIMAL(5,2)) as "decimal"
--, CAST('402.14' AS FLOAT) as "float"
--, CAST('403.15' AS REAL) as "real"
--, CAST('404.15' AS DOUBLE) as "double"
from dummy
</stmt>
</call>
<result>
<resultset id="1">
<row id="1">
<col id="01" type="INTEGER">100</col>
<col id="02" type="BIT">1</col>
<col id="03" type="TINYINT">10</col>
<col id="04" type="SMALLINT">100</col>
<col id="05" type="INTEGER">1000</col>
<col id="06" type="UNSIGNED INTEGER">10000</col>
<col id="07" type="BIGINT">100000</col>
<col id="08" type="UNSIGNED BIGINT">1000000</col>
<col id="09" type="CHAR(4)">char</col>
<col id="10" type="CHAR(4)">char</col>
<col id="10" type="VARCHAR(7)">varchar</col>
<col id="11" type="LONG VARCHAR">long varchar</col>
<col id="12" type="BINARY(6)">binary</col>
<col id="13" type="VARBINARY(9)">varbinary</col>
<col id="14" type="LONG BINARY">long binary</col>
<col id="15" type="XML">xml</col>
<col id="16" type="DATE">1900/1/1</col>
<col id="17" type="DATETIME">1900/1/1 13:02:55</col>
<col id="18" type="TIMESTAMP">1901/1/1</col>
<col id="19" type="SMALLDATETIME">1902/1/1</col>
<col id="20" type="NUMERIC(5,2)">300.12</col>
<col id="21" type="DECIMAL(5,2)">301.13</col>
<col id="22" type="FLOAT">402.14</col>
<col id="23" type="REAL">403.15</col>
<col id="24" type="DOUBLE">404.15</col>
</row>
</resultset>
</result>
</test>
So I have begun working through the various types. I am assuming I will have to update this file when I run into certain cases:
src\net\sourceforge\sqlunit\types.properties
Looking at that file now, for SMALLINT I see:
SMALLINT.class = net.sourceforge.sqlunit.types.ShortType
SMALLINT.type = 5
Since I have not changed this specifically for ASA, that is the value it will use.
Here is the debug output. I stopped at smallint, since I wanted to understand the error sqlunit was reporting before continuing.
init:
compile:
def:
sqlunit-flat:
[sqlunit] DEBUG [main] (SQLUnit.java:216) - >> testWrapper()
[sqlunit] DEBUG [main] (SQLUnit.java:238) - >> processDoc()
[sqlunit] DEBUG [main] (TypeMapper.java:67) - instantiating TypeMapper
[sqlunit] DEBUG [main] (TypeMapper.java:189) - loading types from: net.sourceforge.sqlunit.types
[sqlunit] DEBUG [main] (TypeMapper.java:189) - loading types from: usertypes
[sqlunit] DEBUG [main] (TypeMapper.java:221) - loading non-mapped types
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -7
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -7
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BIT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -6
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -6
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TINYINT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 5
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 5
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: SMALLINT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 4
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 4
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: INTEGER
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -5
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -5
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BIGINT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 6
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 6
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: FLOAT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 7
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 7
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: REAL
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 8
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 8
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: DOUBLE
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: NUMERIC
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 3
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 3
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: DECIMAL
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 1
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 1
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: CHAR
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 12
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 12
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: VARCHAR
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -1
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -1
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: LONGVARCHAR
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 91
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 91
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: DATE
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 92
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 92
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TIME
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 93
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 93
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TIMESTAMP
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -2
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -2
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BINARY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -3
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -3
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: VARBINARY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -4
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -4
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: LONGVARBINARY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 0
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 0
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: NULL
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 1111
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 1111
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: OTHER
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2000
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2000
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: JAVA_OBJECT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2001
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2001
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: null
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2002
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2002
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: null
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2003
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2003
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: ARRAY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2004
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2004
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BLOB
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2005
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2005
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: CLOB
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2006
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2006
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: null
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 70
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 70
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: null
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 16
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 16
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BOOLEAN
[sqlunit] DEBUG [main] (SQLUnitResult.java:126) - >> setTestFile(test/ASA/testtypes.xml)
[sqlunit] *** Running SQLUnit file: test/ASA/testtypes.xml
[sqlunit] DEBUG [main] (ConnectionRegistry.java:55) - >> getConnectionById(null)
[sqlunit] Getting connection(DEFAULT)
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(connection)
[sqlunit] DEBUG [main] (ConnectionHandler.java:181) - >> process()
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element connection,connection-id)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element connection,extern)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element connection,transaction-support)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(on)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element connection,reconnect-on-failure)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(on)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element connection,server-name)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element driver)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(ianywhere.ml.jdbcodbc.IDriver)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element url)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(jdbc:odbc:driver=Adaptive Server Anywhere 9.0)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element user)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(DBA)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element password)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(SQL)
[sqlunit] DEBUG [main] (ConnectionRegistry.java:113) - >> setConnectionById(null)
[sqlunit] DEBUG [main] (ConnectionFactory.java:56) - >> getInstance(props)
[sqlunit] DEBUG [main] (ConnectionRegistry.java:55) - >> getConnectionById(null)
[sqlunit] Setting up test...
[sqlunit] DEBUG [main] (SQLUnitResult.java:63) - >> addRunCount()
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(test)
[sqlunit] DEBUG [main] (TestHandler.java:143) - >> process(elTest)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,java-object-support)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(off)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,java-object-support)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(off)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__JavaObjectSupport__},off)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,failure-message)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,name)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(Testing all datatypes)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,expected-duration-millis)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,percentage-tolerance)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,assert)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(call)
[sqlunit] DEBUG [main] (CallHandler.java:108) - >> process()
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element call,connection-id)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element stmt)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(
[sqlunit] select CAST(1 AS BIT) as "bit"
[sqlunit] , CAST(10 AS TINYINT) as "tinyint"
[sqlunit] , CAST(100 AS SMALLINT) as "smallint"
[sqlunit] --, CAST(1000 AS INTEGER) as "integer"
[sqlunit] --, CAST(10000 AS UNSIGNED INTEGER) as "unsigned_integer"
[sqlunit] --, CAST(100000 AS BIGINT) as "bigint"
[sqlunit] --, CAST(1000000 AS UNSIGNED BIGINT) as "unsigned_bigint"
[sqlunit] --, CAST('char' AS CHAR(4)) as "char"
[sqlunit] --, CAST('varchar' AS VARCHAR(7)) as "varchar"
[sqlunit] --, CAST('long varchar' AS LONG VARCHAR) as "long_varchar"
[sqlunit] --, CAST('binary' AS BINARY(6)) as "binary"
[sqlunit] --, CAST('varbinary' AS VARBINARY(9)) as "varbinary"
[sqlunit] --, CAST('long binary' AS LONG BINARY) as "long_binary"
[sqlunit] --, CAST('xml' AS XML) as "xml"
[sqlunit] --, CAST('1900/1/1' AS DATE) as "date"
[sqlunit] --, CAST('1900/1/1 13:02:55' AS DATETIME) as "datetime"
[sqlunit] --, CAST('1901/1/1' AS TIMESTAMP) as "timestamp"
[sqlunit] --, CAST('1902/1/1' AS SMALLDATETIME) as "smalldatetime"
[sqlunit] --, CAST('300.12' AS NUMERIC(5,2)) as "numeric"
[sqlunit] --, CAST('301.13' AS DECIMAL(5,2)) as "decimal"
[sqlunit] --, CAST('402.14' AS FLOAT) as "float"
[sqlunit] --, CAST('403.15' AS REAL) as "real"
[sqlunit] --, CAST('404.15' AS DOUBLE) as "double"
[sqlunit] from dummy
[sqlunit] )
[sqlunit] DEBUG [main] (SymbolTable.java:263) - >> replaceVariables(
[sqlunit] select CAST(1 AS BIT) as "bit"
[sqlunit] , CAST(10 AS TINYINT) as "tinyint"
[sqlunit] , CAST(100 AS SMALLINT) as "smallint"
[sqlunit] --, CAST(1000 AS INTEGER) as "integer"
[sqlunit] --, CAST(10000 AS UNSIGNED INTEGER) as "unsigned_integer"
[sqlunit] --, CAST(100000 AS BIGINT) as "bigint"
[sqlunit] --, CAST(1000000 AS UNSIGNED BIGINT) as "unsigned_bigint"
[sqlunit] --, CAST('char' AS CHAR(4)) as "char"
[sqlunit] --, CAST('varchar' AS VARCHAR(7)) as "varchar"
[sqlunit] --, CAST('long varchar' AS LONG VARCHAR) as "long_varchar"
[sqlunit] --, CAST('binary' AS BINARY(6)) as "binary"
[sqlunit] --, CAST('varbinary' AS VARBINARY(9)) as "varbinary"
[sqlunit] --, CAST('long binary' AS LONG BINARY) as "long_binary"
[sqlunit] --, CAST('xml' AS XML) as "xml"
[sqlunit] --, CAST('1900/1/1' AS DATE) as "date"
[sqlunit] --, CAST('1900/1/1 13:02:55' AS DATETIME) as "datetime"
[sqlunit] --, CAST('1901/1/1' AS TIMESTAMP) as "timestamp"
[sqlunit] --, CAST('1902/1/1' AS SMALLDATETIME) as "smalldatetime"
[sqlunit] --, CAST('300.12' AS NUMERIC(5,2)) as "numeric"
[sqlunit] --, CAST('301.13' AS DECIMAL(5,2)) as "decimal"
[sqlunit] --, CAST('402.14' AS FLOAT) as "float"
[sqlunit] --, CAST('403.15' AS REAL) as "real"
[sqlunit] --, CAST('404.15' AS DOUBLE) as "double"
[sqlunit] from dummy
[sqlunit] )
[sqlunit] DEBUG [main] (SymbolTable.java:129) - >> getSymbols()
[sqlunit] DEBUG [main] (SymbolTable.java:96) - >> getValue(${__JavaObjectSupport__})
[sqlunit] DEBUG [main] (SymbolTable.java:70) - >> getObject(${__JavaObjectSupport__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__JavaObjectSupport__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__JavaObjectSupport__})
[sqlunit] DEBUG [main] (SqlHandler.java:141) - executeSQL(null,
[sqlunit] select CAST(1 AS BIT) as "bit"
[sqlunit] , CAST(10 AS TINYINT) as "tinyint"
[sqlunit] , CAST(100 AS SMALLINT) as "smallint"
[sqlunit] --, CAST(1000 AS INTEGER) as "integer"
[sqlunit] --, CAST(10000 AS UNSIGNED INTEGER) as "unsigned_integer"
[sqlunit] --, CAST(100000 AS BIGINT) as "bigint"
[sqlunit] --, CAST(1000000 AS UNSIGNED BIGINT) as "unsigned_bigint"
[sqlunit] --, CAST('char' AS CHAR(4)) as "char"
[sqlunit] --, CAST('varchar' AS VARCHAR(7)) as "varchar"
[sqlunit] --, CAST('long varchar' AS LONG VARCHAR) as "long_varchar"
[sqlunit] --, CAST('binary' AS BINARY(6)) as "binary"
[sqlunit] --, CAST('varbinary' AS VARBINARY(9)) as "varbinary"
[sqlunit] --, CAST('long binary' AS LONG BINARY) as "long_binary"
[sqlunit] --, CAST('xml' AS XML) as "xml"
[sqlunit] --, CAST('1900/1/1' AS DATE) as "date"
[sqlunit] --, CAST('1900/1/1 13:02:55' AS DATETIME) as "datetime"
[sqlunit] --, CAST('1901/1/1' AS TIMESTAMP) as "timestamp"
[sqlunit] --, CAST('1902/1/1' AS SMALLDATETIME) as "smalldatetime"
[sqlunit] --, CAST('300.12' AS NUMERIC(5,2)) as "numeric"
[sqlunit] --, CAST('301.13' AS DECIMAL(5,2)) as "decimal"
[sqlunit] --, CAST('402.14' AS FLOAT) as "float"
[sqlunit] --, CAST('403.15' AS REAL) as "real"
[sqlunit] --, CAST('404.15' AS DOUBLE) as "double"
[sqlunit] from dummy
[sqlunit] ,params)
[sqlunit] DEBUG [main] (ConnectionRegistry.java:55) - >> getConnectionById(null)
[sqlunit] DEBUG [main] (DatabaseResult.java:55) - [DatabaseResult]
[sqlunit] DEBUG [main] (SymbolTable.java:280) - >> setCurrentResultSet(1)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__0.resultset__},1)
[sqlunit] DEBUG [main] (SymbolTable.java:290) - >> setCurrentRow(1)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__0.row__},1)
[sqlunit] DEBUG [main] (SymbolTable.java:300) - >> setCurrentCol(1)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__0.col__},1)
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -7
[sqlunit] DEBUG [main] (TypeFactory.java:51) - >> getInstance(BIT)
[sqlunit] DEBUG [main] (TypeFactory.java:73) - Looking up adaptive_server_anywhere.BIT
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: adaptive_server_anywhere.BIT
[sqlunit] DEBUG [main] (TypeFactory.java:75) - found a typeClass: null
[sqlunit] DEBUG [main] (TypeFactory.java:79) - Falling back on basic type lookup for BIT
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BIT
[sqlunit] DEBUG [main] (TypeFactory.java:88) - Instantiating a net.sourceforge.sqlunit.types.BooleanType
[sqlunit] DEBUG [main] (TypeMapper.java:155) - finding id by name: BIT
[sqlunit] DEBUG [main] (TypeUtils.java:83) - >> getXmlTypeFromSqlType(-7)
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -7
[sqlunit] DEBUG [main] (SymbolTable.java:300) - >> setCurrentCol(2)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__0.col__},2)
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -6
[sqlunit] DEBUG [main] (TypeFactory.java:51) - >> getInstance(TINYINT)
[sqlunit] DEBUG [main] (TypeFactory.java:73) - Looking up adaptive_server_anywhere.TINYINT
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: adaptive_server_anywhere.TINYINT
[sqlunit] DEBUG [main] (TypeFactory.java:75) - found a typeClass: null
[sqlunit] DEBUG [main] (TypeFactory.java:79) - Falling back on basic type lookup for TINYINT
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TINYINT
[sqlunit] DEBUG [main] (TypeFactory.java:88) - Instantiating a net.sourceforge.sqlunit.types.ByteType
[sqlunit] DEBUG [main] (TypeMapper.java:155) - finding id by name: TINYINT
[sqlunit] DEBUG [main] (TypeUtils.java:83) - >> getXmlTypeFromSqlType(-6)
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -6
[sqlunit] DEBUG [main] (SymbolTable.java:300) - >> setCurrentCol(3)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__0.col__},3)
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 5
[sqlunit] DEBUG [main] (TypeFactory.java:51) - >> getInstance(SMALLINT)
[sqlunit] DEBUG [main] (TypeFactory.java:73) - Looking up adaptive_server_anywhere.SMALLINT
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: adaptive_server_anywhere.SMALLINT
[sqlunit] DEBUG [main] (TypeFactory.java:75) - found a typeClass: null
[sqlunit] DEBUG [main] (TypeFactory.java:79) - Falling back on basic type lookup for SMALLINT
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: SMALLINT
[sqlunit] DEBUG [main] (TypeFactory.java:88) - Instantiating a net.sourceforge.sqlunit.types.ShortType
[sqlunit] DEBUG [main] (TypeMapper.java:155) - finding id by name: SMALLINT
[sqlunit] DEBUG [main] (TypeUtils.java:83) - >> getXmlTypeFromSqlType(5)
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 5
[sqlunit] DEBUG [main] (ConnectionRegistry.java:135) - >> invalidate(null)
[sqlunit] DEBUG [main] (SymbolTable.java:84) - >> setObject(${__FailureMessage__},net.sourceforge.sqlunit.SQLUnitException
[sqlunit] DEBUG [main] (SQLUnitResult.java:47) - >> addFailureCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:108) - >> setLastException(e)
[sqlunit] DEBUG [main] (SymbolTable.java:96) - >> getValue(${__ElapsedMillisStr__})
[sqlunit] DEBUG [main] (SymbolTable.java:70) - >> getObject(${__ElapsedMillisStr__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__ElapsedMillisStr__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__ElapsedMillisStr__})
[sqlunit] Running test[1]: Testing all datatypes (0ms)
[sqlunit] DEBUG [main] (SQLUnitResult.java:99) - >> getLastException()
[sqlunit] Could not format java.lang.Integer to SMALLINT(5), unsupported datatype
[sqlunit] DEBUG [main] (SymbolTable.java:129) - >> getSymbols()
[sqlunit] Tearing down test...
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(teardown)
[sqlunit] DEBUG [main] (TeardownHandler.java:82) - >> process(elTeardown)
[sqlunit] DEBUG [main] (ConnectionRegistry.java:158) - >> releaseConnections()
[sqlunit] DEBUG [main] (SQLUnitResult.java:90) - >> errorCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:81) - >> failureCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:135) - >> wasSuccessful()
[sqlunit] DEBUG [main] (SQLUnitResult.java:90) - >> errorCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:81) - >> failureCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:144) - >> toString()
[sqlunit] DEBUG [main] (SQLUnitResult.java:99) - >> getLastException()
[sqlunit] FATAL [main] (SQLUnit.java:198) - SQLUnit Tests Failed: In file: test/ASA/testtypes.xml, tests: 1, failures: 1, errors = 0
[sqlunit] net.sourceforge.sqlunit.SQLUnitException: SQLUnit Tests Failed: In file: test/ASA/testtypes.xml, tests: 1, failures: 1, errors = 0
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:220)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.runTest(SQLUnit.java:195)
[sqlunit] at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.java:109)
[sqlunit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[sqlunit] at org.apache.tools.ant.Task.perform(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute(Target.java:301)
[sqlunit] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[sqlunit] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[sqlunit] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[sqlunit] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[sqlunit] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[sqlunit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[sqlunit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[sqlunit] Caused by: net.sourceforge.sqlunit.SQLUnitException: Could not format java.lang.Integer to SMALLINT(5), unsupported datatype
[sqlunit] at net.sourceforge.sqlunit.types.ShortType.toString(ShortType.java:47)
[sqlunit] at net.sourceforge.sqlunit.beans.ResultSetBean.<init>(ResultSetBean.java:96)
[sqlunit] at net.sourceforge.sqlunit.handlers.SqlHandler.executeQuery(SqlHandler.java:259)
[sqlunit] at net.sourceforge.sqlunit.handlers.SqlHandler.executeSQL(SqlHandler.java:149)
[sqlunit] at net.sourceforge.sqlunit.handlers.CallHandler.process(CallHandler.java:132)
[sqlunit] at net.sourceforge.sqlunit.handlers.TestHandler.process(TestHandler.java:182)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.processDoc(SQLUnit.java:296)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:217)
[sqlunit] ... 12 more
[sqlunit] SQLUnit Tests Failed: In file: test/ASA/testtypes.xml, tests: 1, failures: 1, errors = 0
[sqlunit] net.sourceforge.sqlunit.SQLUnitException: One or more SQLUnit Tests failed, see the console for details
[sqlunit] at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.java:126)
[sqlunit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[sqlunit] at org.apache.tools.ant.Task.perform(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute(Target.java:301)
[sqlunit] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[sqlunit] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[sqlunit] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[sqlunit] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[sqlunit] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[sqlunit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[sqlunit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[sqlunit] One or more SQLUnit Tests failed, see the console for details
BUILD SUCCESSFUL
Total time: 4 seconds
Thanks,
Dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, the approach is correct. By default, SQLUnit looks at types.properties to determine the mapping it should do for the data it has recieved back from the database. So to override the mapping, you would need to add entries into types.properties or into a usertypes.properties file in your classpath.
The error message you are getting is this:
Could not format java.lang.Integer to SMALLINT(5), unsupported datatype
So in this case, it gets back an object from the database which is a SMALLINT, which according to the default type mapping, maps to a ShortType, which is a wrapper over the java.lang.Short type. However, what it is getting back is a java.lang.Integer which it cannot cast into a Short. So we need to map the IntegerType to it instead which is a wrapper over java.lang.Integer.
So to override the default mapping, you would need to do add these lines to the types.properties:
adaptive_server_anywhere.SMALLINT.class = net.sourceforge.sqlunit.types.IntegerType
adaptive_server_anywhere.SMALLINT.type = 5
I guess I should make the error message cleaner. Let me think about a possible template that uses the same data but provides more clarity. I am hoping to release 4.0 tonight so perhaps thats something for the next release.
-sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So for me to run my testtypes.xml, I have these 2 entries in types.properties, can you make the same updates to the current CVS before the 4.0 release:
Thanks Dave, the first one was in CVS already, and I just pushed the second one in too.
-sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2004-09-10
HI,
I'm using SQL unit against our Sybase 12.5 ASE server using jconn2 v 5.2. I still get the SMALLINT problem described in your post. I definitely have your entries in types.properties, but from quickly debugging the code it seemed that my type was being mapped to SMALLINT.class (not the ASA version). I got mine to work by simply changing this entry to Integer (not SHORT). Is this indicative of a depepr problem? Just thought I'd let you guys know.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did the initial mapping based on a document I picked up on the Internet that described a set of base mappings to java.lang.* types or primitive types (such as byte[]) for most (some exotic ones such as DATALINK were missing) of the SQL types. Of course, the data may not be indicative of the actual implementations used by a majority of the databases, but I had to start somewhere.
The idea is that databases which do not use the "standard" mappings may override them cleanly in their usertypes.properties file, and if you let us know, as you did, we can put this mapping in the types.properties file for the next release of SQLUnit.
Some of the original mappings are unfortunate choices, such as NUMERIC to Double, since I have found 2 databases which used BigDecimal instead. The SMALLINT to Short also looks like something similar, it should have probably been Integer at the start, so we have to override less. However, a re-mapping exercise may cause currently running tests to break, which makes me wary of going this route.
The approach I would suggest to your problem is to override the mapping, not replace it as you have done. The Sybase ASE database product name is "adaptive_server_enterprise", so you should /add/ a set of entries for:
adaptive_server_enterprise.SMALLINT.class = net.sourceforge.sqlunit.types.IntegerType
adaptive_server_enterprise.SMALLINT.type = 5
in either the types.properties file, or if you would rather not mess with having to recompile the code, into a usertypes.properties file in your CLASSPATH.
I will add this into CVS for types.properties and it should be available in the next release. Thanks for the input, let me know if you find more anomalies such as these, so we can try to make the overrrides for ASE as complete as possible.
Thanks
Sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2004-09-13
Thanks Sujit - I figured there would be a neater solution.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I dont know, but I thought this was pretty a pretty neat way to deal with databases implementing datatypes differently. I agree that the way to set up overrides is not immediately intuitive, but I have documented it quite extensively, and once you understand how to do this, its pretty clear.
The error message could use some more clarity though, and I plan to change it to be more descriptive and include the position where the conversion failure happened as well.
However, if you have ideas on how this can be made better, please let me know, and I will definitely consider implementing it.
Thanks
Sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2004-09-14
Ah no, you misunderstood me... I merely meant that I thought there would be a neater way than simply overriding SMALLINT for every database like I did. No criticism intended.
However, I do agree a more informative message might be in order, suggesting that the user check the types in the file for the database type they're using.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2004-09-14
Hi again,
More info for you. I've just had to override the ASE setting for numeric, as you suggested:
Also, I'm havgin trouble with NULLs. Presumably I've missed the point again somewhere. The trouble I was having was for a table where a column is a varchar, but contains a null value. In your code for ResultSetBean.java you have
<b>colValue = rs.getObject(colId)</b>
And in ASE colValue is returned as a null reference so that when you call
<b>colTypeObj.toString(colValue)</b>
You get an error.
I have got around this by sticking a check in for null references before this is called (if it is null I replace it with an empty string). This raises the possibility of nulls being mistaken for empty strings. Just wondered what the correct way of dealing with this problem is? Is there a similar entry I can make in the properties file?
Thanks for your help,
Chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the info, I will add this in to the cvs update that I plan to do today. I just added some test cases for connections and fixed up the exception chaining somewhat so the results are more relevant (contains the connection-id, etc). Also added docs for getting connections in different ways.
The problem with NULL looks like a bug. In the old code, I got around that by sending back a string "NULL", but I think I may have missed it in the new code. Thanks for catching it. I will make the fix and update this thread (probably tomorrow or day after).
Oh, and sorry if I implied that I was offended in my previous post. I agree with you that the initial choice of datatype mappings was unfortunate, but with time and feedback, we should be able to reach a point where we have overrides for all the commonly used databases, and overriding mappings for new databases or new datatypes would be very simple (and do-able by the user, although feedback would definitely help make life easier for the next user) :-).
I will also fix the error message like I described above, perhaps I can even fix it along with the fix for your code.
Thanks
Sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for getting back this late to you on this issue, but I had fixed and checked in the null fix sometime back and forgotten to update this thread. Basically the fix consists of detecting if the object returned from the database resultset is a null, if so stringify it to the string "NULL". The converse also holds true, if you wish to pass in a null parameter to the stored procedure, then you can specify the string "NULL" as well as set the is-null attribute to true.
I have also fixed the error message to be a little clearer, and added an additional column in the supported types documentation which tells you the base java type the Type object wraps.
Hope this helps, and sorry for the delay in responding.
-sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a general question, looking for the correct way to deal with it.
sqlunit-flat:
[sqlunit] *** Running SQLUnit file: test/ASA/testtypes.xml
[sqlunit] Getting connection(DEFAULT)
[sqlunit] Setting up test...
[sqlunit] Running test[1]: Testing all datatypes (0ms)
[sqlunit] Could not format java.lang.Integer to SMALLINT(5), unsupported datatype
[sqlunit] Tearing down test...
[sqlunit] SQLUnit Tests Failed: In file: test/ASA/testtypes.xml, tests: 1, failures: 1, errors = 0
[sqlunit] One or more SQLUnit Tests failed, see the console for details
Basically I am trying to test all available data types that are supported by ASA. So the test I wrote does this:
<test name="Testing all datatypes">
<call>
<stmt>
select CAST(1 AS BIT) as "bit"
, CAST(10 AS TINYINT) as "tinyint"
, CAST(100 AS SMALLINT) as "smallint"
--, CAST(1000 AS INTEGER) as "integer"
--, CAST(10000 AS UNSIGNED INTEGER) as "unsigned_integer"
--, CAST(100000 AS BIGINT) as "bigint"
--, CAST(1000000 AS UNSIGNED BIGINT) as "unsigned_bigint"
--, CAST('char' AS CHAR(4)) as "char"
--, CAST('varchar' AS VARCHAR(7)) as "varchar"
--, CAST('long varchar' AS LONG VARCHAR) as "long_varchar"
--, CAST('binary' AS BINARY(6)) as "binary"
--, CAST('varbinary' AS VARBINARY(9)) as "varbinary"
--, CAST('long binary' AS LONG BINARY) as "long_binary"
--, CAST('xml' AS XML) as "xml"
--, CAST('1900/1/1' AS DATE) as "date"
--, CAST('1900/1/1 13:02:55' AS DATETIME) as "datetime"
--, CAST('1901/1/1' AS TIMESTAMP) as "timestamp"
--, CAST('1902/1/1' AS SMALLDATETIME) as "smalldatetime"
--, CAST('300.12' AS NUMERIC(5,2)) as "numeric"
--, CAST('301.13' AS DECIMAL(5,2)) as "decimal"
--, CAST('402.14' AS FLOAT) as "float"
--, CAST('403.15' AS REAL) as "real"
--, CAST('404.15' AS DOUBLE) as "double"
from dummy
</stmt>
</call>
<result>
<resultset id="1">
<row id="1">
<col id="01" type="INTEGER">100</col>
<col id="02" type="BIT">1</col>
<col id="03" type="TINYINT">10</col>
<col id="04" type="SMALLINT">100</col>
<col id="05" type="INTEGER">1000</col>
<col id="06" type="UNSIGNED INTEGER">10000</col>
<col id="07" type="BIGINT">100000</col>
<col id="08" type="UNSIGNED BIGINT">1000000</col>
<col id="09" type="CHAR(4)">char</col>
<col id="10" type="CHAR(4)">char</col>
<col id="10" type="VARCHAR(7)">varchar</col>
<col id="11" type="LONG VARCHAR">long varchar</col>
<col id="12" type="BINARY(6)">binary</col>
<col id="13" type="VARBINARY(9)">varbinary</col>
<col id="14" type="LONG BINARY">long binary</col>
<col id="15" type="XML">xml</col>
<col id="16" type="DATE">1900/1/1</col>
<col id="17" type="DATETIME">1900/1/1 13:02:55</col>
<col id="18" type="TIMESTAMP">1901/1/1</col>
<col id="19" type="SMALLDATETIME">1902/1/1</col>
<col id="20" type="NUMERIC(5,2)">300.12</col>
<col id="21" type="DECIMAL(5,2)">301.13</col>
<col id="22" type="FLOAT">402.14</col>
<col id="23" type="REAL">403.15</col>
<col id="24" type="DOUBLE">404.15</col>
</row>
</resultset>
</result>
</test>
So I have begun working through the various types. I am assuming I will have to update this file when I run into certain cases:
src\net\sourceforge\sqlunit\types.properties
Looking at that file now, for SMALLINT I see:
SMALLINT.class = net.sourceforge.sqlunit.types.ShortType
SMALLINT.type = 5
Since I have not changed this specifically for ASA, that is the value it will use.
Here is the debug output. I stopped at smallint, since I wanted to understand the error sqlunit was reporting before continuing.
init:
compile:
def:
sqlunit-flat:
[sqlunit] DEBUG [main] (SQLUnit.java:216) - >> testWrapper()
[sqlunit] DEBUG [main] (SQLUnit.java:238) - >> processDoc()
[sqlunit] DEBUG [main] (TypeMapper.java:67) - instantiating TypeMapper
[sqlunit] DEBUG [main] (TypeMapper.java:189) - loading types from: net.sourceforge.sqlunit.types
[sqlunit] DEBUG [main] (TypeMapper.java:189) - loading types from: usertypes
[sqlunit] DEBUG [main] (TypeMapper.java:221) - loading non-mapped types
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -7
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -7
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BIT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -6
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -6
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TINYINT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 5
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 5
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: SMALLINT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 4
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 4
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: INTEGER
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -5
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -5
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BIGINT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 6
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 6
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: FLOAT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 7
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 7
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: REAL
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 8
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 8
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: DOUBLE
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: NUMERIC
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 3
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 3
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: DECIMAL
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 1
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 1
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: CHAR
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 12
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 12
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: VARCHAR
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -1
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -1
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: LONGVARCHAR
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 91
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 91
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: DATE
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 92
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 92
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TIME
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 93
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 93
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TIMESTAMP
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -2
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -2
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BINARY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -3
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -3
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: VARBINARY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -4
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -4
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: LONGVARBINARY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 0
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 0
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: NULL
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 1111
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 1111
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: OTHER
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2000
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2000
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: JAVA_OBJECT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2001
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2001
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: null
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2002
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2002
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: null
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2003
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2003
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: ARRAY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2004
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2004
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BLOB
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2005
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2005
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: CLOB
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2006
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2006
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: null
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 70
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 70
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: null
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 16
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 16
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BOOLEAN
[sqlunit] DEBUG [main] (SQLUnitResult.java:126) - >> setTestFile(test/ASA/testtypes.xml)
[sqlunit] *** Running SQLUnit file: test/ASA/testtypes.xml
[sqlunit] DEBUG [main] (ConnectionRegistry.java:55) - >> getConnectionById(null)
[sqlunit] Getting connection(DEFAULT)
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(connection)
[sqlunit] DEBUG [main] (ConnectionHandler.java:181) - >> process()
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element connection,connection-id)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element connection,extern)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element connection,transaction-support)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(on)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element connection,reconnect-on-failure)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(on)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element connection,server-name)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element driver)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(ianywhere.ml.jdbcodbc.IDriver)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element url)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(jdbc:odbc:driver=Adaptive Server Anywhere 9.0)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element user)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(DBA)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element password)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(SQL)
[sqlunit] DEBUG [main] (ConnectionRegistry.java:113) - >> setConnectionById(null)
[sqlunit] DEBUG [main] (ConnectionFactory.java:56) - >> getInstance(props)
[sqlunit] DEBUG [main] (ConnectionRegistry.java:55) - >> getConnectionById(null)
[sqlunit] Setting up test...
[sqlunit] DEBUG [main] (SQLUnitResult.java:63) - >> addRunCount()
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(test)
[sqlunit] DEBUG [main] (TestHandler.java:143) - >> process(elTest)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,java-object-support)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(off)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,java-object-support)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(off)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__JavaObjectSupport__},off)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,failure-message)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,name)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(Testing all datatypes)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,expected-duration-millis)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,percentage-tolerance)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,assert)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(call)
[sqlunit] DEBUG [main] (CallHandler.java:108) - >> process()
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element call,connection-id)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element stmt)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(
[sqlunit] select CAST(1 AS BIT) as "bit"
[sqlunit] , CAST(10 AS TINYINT) as "tinyint"
[sqlunit] , CAST(100 AS SMALLINT) as "smallint"
[sqlunit] --, CAST(1000 AS INTEGER) as "integer"
[sqlunit] --, CAST(10000 AS UNSIGNED INTEGER) as "unsigned_integer"
[sqlunit] --, CAST(100000 AS BIGINT) as "bigint"
[sqlunit] --, CAST(1000000 AS UNSIGNED BIGINT) as "unsigned_bigint"
[sqlunit] --, CAST('char' AS CHAR(4)) as "char"
[sqlunit] --, CAST('varchar' AS VARCHAR(7)) as "varchar"
[sqlunit] --, CAST('long varchar' AS LONG VARCHAR) as "long_varchar"
[sqlunit] --, CAST('binary' AS BINARY(6)) as "binary"
[sqlunit] --, CAST('varbinary' AS VARBINARY(9)) as "varbinary"
[sqlunit] --, CAST('long binary' AS LONG BINARY) as "long_binary"
[sqlunit] --, CAST('xml' AS XML) as "xml"
[sqlunit] --, CAST('1900/1/1' AS DATE) as "date"
[sqlunit] --, CAST('1900/1/1 13:02:55' AS DATETIME) as "datetime"
[sqlunit] --, CAST('1901/1/1' AS TIMESTAMP) as "timestamp"
[sqlunit] --, CAST('1902/1/1' AS SMALLDATETIME) as "smalldatetime"
[sqlunit] --, CAST('300.12' AS NUMERIC(5,2)) as "numeric"
[sqlunit] --, CAST('301.13' AS DECIMAL(5,2)) as "decimal"
[sqlunit] --, CAST('402.14' AS FLOAT) as "float"
[sqlunit] --, CAST('403.15' AS REAL) as "real"
[sqlunit] --, CAST('404.15' AS DOUBLE) as "double"
[sqlunit] from dummy
[sqlunit] )
[sqlunit] DEBUG [main] (SymbolTable.java:263) - >> replaceVariables(
[sqlunit] select CAST(1 AS BIT) as "bit"
[sqlunit] , CAST(10 AS TINYINT) as "tinyint"
[sqlunit] , CAST(100 AS SMALLINT) as "smallint"
[sqlunit] --, CAST(1000 AS INTEGER) as "integer"
[sqlunit] --, CAST(10000 AS UNSIGNED INTEGER) as "unsigned_integer"
[sqlunit] --, CAST(100000 AS BIGINT) as "bigint"
[sqlunit] --, CAST(1000000 AS UNSIGNED BIGINT) as "unsigned_bigint"
[sqlunit] --, CAST('char' AS CHAR(4)) as "char"
[sqlunit] --, CAST('varchar' AS VARCHAR(7)) as "varchar"
[sqlunit] --, CAST('long varchar' AS LONG VARCHAR) as "long_varchar"
[sqlunit] --, CAST('binary' AS BINARY(6)) as "binary"
[sqlunit] --, CAST('varbinary' AS VARBINARY(9)) as "varbinary"
[sqlunit] --, CAST('long binary' AS LONG BINARY) as "long_binary"
[sqlunit] --, CAST('xml' AS XML) as "xml"
[sqlunit] --, CAST('1900/1/1' AS DATE) as "date"
[sqlunit] --, CAST('1900/1/1 13:02:55' AS DATETIME) as "datetime"
[sqlunit] --, CAST('1901/1/1' AS TIMESTAMP) as "timestamp"
[sqlunit] --, CAST('1902/1/1' AS SMALLDATETIME) as "smalldatetime"
[sqlunit] --, CAST('300.12' AS NUMERIC(5,2)) as "numeric"
[sqlunit] --, CAST('301.13' AS DECIMAL(5,2)) as "decimal"
[sqlunit] --, CAST('402.14' AS FLOAT) as "float"
[sqlunit] --, CAST('403.15' AS REAL) as "real"
[sqlunit] --, CAST('404.15' AS DOUBLE) as "double"
[sqlunit] from dummy
[sqlunit] )
[sqlunit] DEBUG [main] (SymbolTable.java:129) - >> getSymbols()
[sqlunit] DEBUG [main] (SymbolTable.java:96) - >> getValue(${__JavaObjectSupport__})
[sqlunit] DEBUG [main] (SymbolTable.java:70) - >> getObject(${__JavaObjectSupport__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__JavaObjectSupport__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__JavaObjectSupport__})
[sqlunit] DEBUG [main] (SqlHandler.java:141) - executeSQL(null,
[sqlunit] select CAST(1 AS BIT) as "bit"
[sqlunit] , CAST(10 AS TINYINT) as "tinyint"
[sqlunit] , CAST(100 AS SMALLINT) as "smallint"
[sqlunit] --, CAST(1000 AS INTEGER) as "integer"
[sqlunit] --, CAST(10000 AS UNSIGNED INTEGER) as "unsigned_integer"
[sqlunit] --, CAST(100000 AS BIGINT) as "bigint"
[sqlunit] --, CAST(1000000 AS UNSIGNED BIGINT) as "unsigned_bigint"
[sqlunit] --, CAST('char' AS CHAR(4)) as "char"
[sqlunit] --, CAST('varchar' AS VARCHAR(7)) as "varchar"
[sqlunit] --, CAST('long varchar' AS LONG VARCHAR) as "long_varchar"
[sqlunit] --, CAST('binary' AS BINARY(6)) as "binary"
[sqlunit] --, CAST('varbinary' AS VARBINARY(9)) as "varbinary"
[sqlunit] --, CAST('long binary' AS LONG BINARY) as "long_binary"
[sqlunit] --, CAST('xml' AS XML) as "xml"
[sqlunit] --, CAST('1900/1/1' AS DATE) as "date"
[sqlunit] --, CAST('1900/1/1 13:02:55' AS DATETIME) as "datetime"
[sqlunit] --, CAST('1901/1/1' AS TIMESTAMP) as "timestamp"
[sqlunit] --, CAST('1902/1/1' AS SMALLDATETIME) as "smalldatetime"
[sqlunit] --, CAST('300.12' AS NUMERIC(5,2)) as "numeric"
[sqlunit] --, CAST('301.13' AS DECIMAL(5,2)) as "decimal"
[sqlunit] --, CAST('402.14' AS FLOAT) as "float"
[sqlunit] --, CAST('403.15' AS REAL) as "real"
[sqlunit] --, CAST('404.15' AS DOUBLE) as "double"
[sqlunit] from dummy
[sqlunit] ,params)
[sqlunit] DEBUG [main] (ConnectionRegistry.java:55) - >> getConnectionById(null)
[sqlunit] DEBUG [main] (DatabaseResult.java:55) - [DatabaseResult]
[sqlunit] DEBUG [main] (SymbolTable.java:280) - >> setCurrentResultSet(1)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__0.resultset__},1)
[sqlunit] DEBUG [main] (SymbolTable.java:290) - >> setCurrentRow(1)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__0.row__},1)
[sqlunit] DEBUG [main] (SymbolTable.java:300) - >> setCurrentCol(1)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__0.col__},1)
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -7
[sqlunit] DEBUG [main] (TypeFactory.java:51) - >> getInstance(BIT)
[sqlunit] DEBUG [main] (TypeFactory.java:73) - Looking up adaptive_server_anywhere.BIT
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: adaptive_server_anywhere.BIT
[sqlunit] DEBUG [main] (TypeFactory.java:75) - found a typeClass: null
[sqlunit] DEBUG [main] (TypeFactory.java:79) - Falling back on basic type lookup for BIT
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BIT
[sqlunit] DEBUG [main] (TypeFactory.java:88) - Instantiating a net.sourceforge.sqlunit.types.BooleanType
[sqlunit] DEBUG [main] (TypeMapper.java:155) - finding id by name: BIT
[sqlunit] DEBUG [main] (TypeUtils.java:83) - >> getXmlTypeFromSqlType(-7)
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -7
[sqlunit] DEBUG [main] (SymbolTable.java:300) - >> setCurrentCol(2)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__0.col__},2)
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -6
[sqlunit] DEBUG [main] (TypeFactory.java:51) - >> getInstance(TINYINT)
[sqlunit] DEBUG [main] (TypeFactory.java:73) - Looking up adaptive_server_anywhere.TINYINT
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: adaptive_server_anywhere.TINYINT
[sqlunit] DEBUG [main] (TypeFactory.java:75) - found a typeClass: null
[sqlunit] DEBUG [main] (TypeFactory.java:79) - Falling back on basic type lookup for TINYINT
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TINYINT
[sqlunit] DEBUG [main] (TypeFactory.java:88) - Instantiating a net.sourceforge.sqlunit.types.ByteType
[sqlunit] DEBUG [main] (TypeMapper.java:155) - finding id by name: TINYINT
[sqlunit] DEBUG [main] (TypeUtils.java:83) - >> getXmlTypeFromSqlType(-6)
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -6
[sqlunit] DEBUG [main] (SymbolTable.java:300) - >> setCurrentCol(3)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__0.col__},3)
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 5
[sqlunit] DEBUG [main] (TypeFactory.java:51) - >> getInstance(SMALLINT)
[sqlunit] DEBUG [main] (TypeFactory.java:73) - Looking up adaptive_server_anywhere.SMALLINT
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: adaptive_server_anywhere.SMALLINT
[sqlunit] DEBUG [main] (TypeFactory.java:75) - found a typeClass: null
[sqlunit] DEBUG [main] (TypeFactory.java:79) - Falling back on basic type lookup for SMALLINT
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: SMALLINT
[sqlunit] DEBUG [main] (TypeFactory.java:88) - Instantiating a net.sourceforge.sqlunit.types.ShortType
[sqlunit] DEBUG [main] (TypeMapper.java:155) - finding id by name: SMALLINT
[sqlunit] DEBUG [main] (TypeUtils.java:83) - >> getXmlTypeFromSqlType(5)
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 5
[sqlunit] DEBUG [main] (ConnectionRegistry.java:135) - >> invalidate(null)
[sqlunit] DEBUG [main] (SymbolTable.java:84) - >> setObject(${__FailureMessage__},net.sourceforge.sqlunit.SQLUnitException
[sqlunit] DEBUG [main] (SQLUnitResult.java:47) - >> addFailureCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:108) - >> setLastException(e)
[sqlunit] DEBUG [main] (SymbolTable.java:96) - >> getValue(${__ElapsedMillisStr__})
[sqlunit] DEBUG [main] (SymbolTable.java:70) - >> getObject(${__ElapsedMillisStr__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__ElapsedMillisStr__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__ElapsedMillisStr__})
[sqlunit] Running test[1]: Testing all datatypes (0ms)
[sqlunit] DEBUG [main] (SQLUnitResult.java:99) - >> getLastException()
[sqlunit] Could not format java.lang.Integer to SMALLINT(5), unsupported datatype
[sqlunit] DEBUG [main] (SymbolTable.java:129) - >> getSymbols()
[sqlunit] Tearing down test...
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(teardown)
[sqlunit] DEBUG [main] (TeardownHandler.java:82) - >> process(elTeardown)
[sqlunit] DEBUG [main] (ConnectionRegistry.java:158) - >> releaseConnections()
[sqlunit] DEBUG [main] (SQLUnitResult.java:90) - >> errorCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:81) - >> failureCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:135) - >> wasSuccessful()
[sqlunit] DEBUG [main] (SQLUnitResult.java:90) - >> errorCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:81) - >> failureCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:144) - >> toString()
[sqlunit] DEBUG [main] (SQLUnitResult.java:99) - >> getLastException()
[sqlunit] FATAL [main] (SQLUnit.java:198) - SQLUnit Tests Failed: In file: test/ASA/testtypes.xml, tests: 1, failures: 1, errors = 0
[sqlunit] net.sourceforge.sqlunit.SQLUnitException: SQLUnit Tests Failed: In file: test/ASA/testtypes.xml, tests: 1, failures: 1, errors = 0
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:220)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.runTest(SQLUnit.java:195)
[sqlunit] at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.java:109)
[sqlunit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[sqlunit] at org.apache.tools.ant.Task.perform(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute(Target.java:301)
[sqlunit] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[sqlunit] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[sqlunit] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[sqlunit] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[sqlunit] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[sqlunit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[sqlunit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[sqlunit] Caused by: net.sourceforge.sqlunit.SQLUnitException: Could not format java.lang.Integer to SMALLINT(5), unsupported datatype
[sqlunit] at net.sourceforge.sqlunit.types.ShortType.toString(ShortType.java:47)
[sqlunit] at net.sourceforge.sqlunit.beans.ResultSetBean.<init>(ResultSetBean.java:96)
[sqlunit] at net.sourceforge.sqlunit.handlers.SqlHandler.executeQuery(SqlHandler.java:259)
[sqlunit] at net.sourceforge.sqlunit.handlers.SqlHandler.executeSQL(SqlHandler.java:149)
[sqlunit] at net.sourceforge.sqlunit.handlers.CallHandler.process(CallHandler.java:132)
[sqlunit] at net.sourceforge.sqlunit.handlers.TestHandler.process(TestHandler.java:182)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.processDoc(SQLUnit.java:296)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:217)
[sqlunit] ... 12 more
[sqlunit] SQLUnit Tests Failed: In file: test/ASA/testtypes.xml, tests: 1, failures: 1, errors = 0
[sqlunit] net.sourceforge.sqlunit.SQLUnitException: One or more SQLUnit Tests failed, see the console for details
[sqlunit] at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.java:126)
[sqlunit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[sqlunit] at org.apache.tools.ant.Task.perform(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute(Target.java:301)
[sqlunit] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[sqlunit] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[sqlunit] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[sqlunit] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[sqlunit] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[sqlunit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[sqlunit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[sqlunit] One or more SQLUnit Tests failed, see the console for details
BUILD SUCCESSFUL
Total time: 4 seconds
Thanks,
Dave
Yes, the approach is correct. By default, SQLUnit looks at types.properties to determine the mapping it should do for the data it has recieved back from the database. So to override the mapping, you would need to add entries into types.properties or into a usertypes.properties file in your classpath.
The error message you are getting is this:
Could not format java.lang.Integer to SMALLINT(5), unsupported datatype
So in this case, it gets back an object from the database which is a SMALLINT, which according to the default type mapping, maps to a ShortType, which is a wrapper over the java.lang.Short type. However, what it is getting back is a java.lang.Integer which it cannot cast into a Short. So we need to map the IntegerType to it instead which is a wrapper over java.lang.Integer.
So to override the default mapping, you would need to do add these lines to the types.properties:
adaptive_server_anywhere.SMALLINT.class = net.sourceforge.sqlunit.types.IntegerType
adaptive_server_anywhere.SMALLINT.type = 5
I guess I should make the error message cleaner. Let me think about a possible template that uses the same data but provides more clarity. I am hoping to release 4.0 tonight so perhaps thats something for the next release.
-sujit
That was the only addition I had to make.
So for me to run my testtypes.xml, I have these 2 entries in types.properties, can you make the same updates to the current CVS before the 4.0 release:
##############################################################################
# Sybase Adaptive Server Anywhere
##############################################################################
adaptive_server_anywhere.NUMERIC.class = net.sourceforge.sqlunit.types.BigDecimalType
adaptive_server_anywhere.NUMERIC.type = 2
adaptive_server_anywhere.SMALLINT.class = net.sourceforge.sqlunit.types.IntegerType
adaptive_server_anywhere.SMALLINT.type = 5
Thanks,
Dave
Thanks Dave, the first one was in CVS already, and I just pushed the second one in too.
-sujit
HI,
I'm using SQL unit against our Sybase 12.5 ASE server using jconn2 v 5.2. I still get the SMALLINT problem described in your post. I definitely have your entries in types.properties, but from quickly debugging the code it seemed that my type was being mapped to SMALLINT.class (not the ASA version). I got mine to work by simply changing this entry to Integer (not SHORT). Is this indicative of a depepr problem? Just thought I'd let you guys know.
Hi Chris,
No this is they way its supposed to work :-).
I did the initial mapping based on a document I picked up on the Internet that described a set of base mappings to java.lang.* types or primitive types (such as byte[]) for most (some exotic ones such as DATALINK were missing) of the SQL types. Of course, the data may not be indicative of the actual implementations used by a majority of the databases, but I had to start somewhere.
The idea is that databases which do not use the "standard" mappings may override them cleanly in their usertypes.properties file, and if you let us know, as you did, we can put this mapping in the types.properties file for the next release of SQLUnit.
Some of the original mappings are unfortunate choices, such as NUMERIC to Double, since I have found 2 databases which used BigDecimal instead. The SMALLINT to Short also looks like something similar, it should have probably been Integer at the start, so we have to override less. However, a re-mapping exercise may cause currently running tests to break, which makes me wary of going this route.
The approach I would suggest to your problem is to override the mapping, not replace it as you have done. The Sybase ASE database product name is "adaptive_server_enterprise", so you should /add/ a set of entries for:
adaptive_server_enterprise.SMALLINT.class = net.sourceforge.sqlunit.types.IntegerType
adaptive_server_enterprise.SMALLINT.type = 5
in either the types.properties file, or if you would rather not mess with having to recompile the code, into a usertypes.properties file in your CLASSPATH.
I will add this into CVS for types.properties and it should be available in the next release. Thanks for the input, let me know if you find more anomalies such as these, so we can try to make the overrrides for ASE as complete as possible.
Thanks
Sujit
Thanks Sujit - I figured there would be a neater solution.
Hi Chris,
You are welcome.
I dont know, but I thought this was pretty a pretty neat way to deal with databases implementing datatypes differently. I agree that the way to set up overrides is not immediately intuitive, but I have documented it quite extensively, and once you understand how to do this, its pretty clear.
The error message could use some more clarity though, and I plan to change it to be more descriptive and include the position where the conversion failure happened as well.
However, if you have ideas on how this can be made better, please let me know, and I will definitely consider implementing it.
Thanks
Sujit
Ah no, you misunderstood me... I merely meant that I thought there would be a neater way than simply overriding SMALLINT for every database like I did. No criticism intended.
However, I do agree a more informative message might be in order, suggesting that the user check the types in the file for the database type they're using.
Hi again,
More info for you. I've just had to override the ASE setting for numeric, as you suggested:
adaptive_server_enterprise.NUMERIC.class = net.sourceforge.sqlunit.types.BigDecimalType
adaptive_server_enterprise.NUMERIC.type = 2
Also, I'm havgin trouble with NULLs. Presumably I've missed the point again somewhere. The trouble I was having was for a table where a column is a varchar, but contains a null value. In your code for ResultSetBean.java you have
<b>colValue = rs.getObject(colId)</b>
And in ASE colValue is returned as a null reference so that when you call
<b>colTypeObj.toString(colValue)</b>
You get an error.
I have got around this by sticking a check in for null references before this is called (if it is null I replace it with an empty string). This raises the possibility of nulls being mistaken for empty strings. Just wondered what the correct way of dealing with this problem is? Is there a similar entry I can make in the properties file?
Thanks for your help,
Chris
Hi Chris,
Thanks for the info, I will add this in to the cvs update that I plan to do today. I just added some test cases for connections and fixed up the exception chaining somewhat so the results are more relevant (contains the connection-id, etc). Also added docs for getting connections in different ways.
The problem with NULL looks like a bug. In the old code, I got around that by sending back a string "NULL", but I think I may have missed it in the new code. Thanks for catching it. I will make the fix and update this thread (probably tomorrow or day after).
Oh, and sorry if I implied that I was offended in my previous post. I agree with you that the initial choice of datatype mappings was unfortunate, but with time and feedback, we should be able to reach a point where we have overrides for all the commonly used databases, and overriding mappings for new databases or new datatypes would be very simple (and do-able by the user, although feedback would definitely help make life easier for the next user) :-).
I will also fix the error message like I described above, perhaps I can even fix it along with the fix for your code.
Thanks
Sujit
Hi Chris,
Sorry for getting back this late to you on this issue, but I had fixed and checked in the null fix sometime back and forgotten to update this thread. Basically the fix consists of detecting if the object returned from the database resultset is a null, if so stringify it to the string "NULL". The converse also holds true, if you wish to pass in a null parameter to the stored procedure, then you can specify the string "NULL" as well as set the is-null attribute to true.
I have also fixed the error message to be a little clearer, and added an additional column in the supported types documentation which tells you the base java type the Type object wraps.
Hope this helps, and sorry for the delay in responding.
-sujit