[英]ResultSetMetadata column types for count()/sum()
In MySQL select: 在MySQL中,选择:
count(BIGINT)
returns type=-5 (BigInteger), I expected Long
count(BIGINT)
返回type = -5(BigInteger),我期望Long
sum(SMALLINT)
returns type=3 (BigDecimal), I expected Integer
sum(SMALLINT)
返回type = 3(BigDecimal),我希望是Integer
Is there anything that can be done? 有什么可以做的吗?
The value of -5 indicates java.sql.Types.BIGINT
, which is the JDBC/SQL equivalent of a Java long
, so this value is entirely expected. 值-5表示
java.sql.Types.BIGINT
,它是Java long
的JDBC / SQL等效项,因此完全可以预期该值。
As to why SUM
is mapped to 3, or java.sql.DECIMAL
, I'm not sure. 至于为什么将
SUM
映射到3或java.sql.DECIMAL
,我不确定。 It might just be that is what MySQL does when summing not floating-point types. 这可能就是MySQL在对非浮点类型求和时所做的事情。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.