将BigInteger存储到Mysql中 [英] Store BigInteger into Mysql
问题描述
由于数学约束,我必须使用BigInteger类来表示值。
经过一些计算后,我想存储结果(由2x BigInteger实例)into Mysql ...
存储此类对象的最佳数据类型是什么?
使用Blob来存储这些结果的二进制格式(128位)?但我想避免不必要的类型转换。
我建议使用Blob,然后 BigInteger(byte [] val)
构造函数从字节数组转到BigInteger,而使用 BigInteger#toByteArray()
/ p>
Due to mathematica constraints I've to use the BigInteger class to represent values.
After some calculations I would like to store the result (given by 2x BigInteger instances) into Mysql...
What is the best datatype to store such object ?
I was thinking about using a Blob to store the binary format of those results (128 bits) ? But I would like to avoid unnecessary type conversions.
I would recommend using a Blob and then the BigInteger(byte[] val)
constructor to go from byte array to BigInteger, and the BigInteger#toByteArray()
method for the other way.
这篇关于将BigInteger存储到Mysql中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!