cancel
Showing results for 
Search instead for 
Did you mean: 

How to use (get and set) unsigned types on java android

Former Member
3,627

Hi,

I've been using UltraliteJ for Android and trying to get and set unsigned types - specifically int, long and short - to my table from java. But the problem is that I haven't found any method to do it. Anyone knows if are there any way in UltraliteJ to do it?

Table example:

CREATE TABLE unsigned_test (
id INT PRIMARY KEY,
value UNSIGNED INT

)

In this case, I want to set a value from java to "value" table variable and get it after that.

The SqlAnywhere version I've been using is 12.0.1 EBF 3605.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member

You can use PreparedStatement.set(int, long) for setting values for unsigned int columns, or set(int, int) for unsigned short columns. For unsigned bigint columns, there is no Java primitive type that can be used to store values >= 2^63, but you can use set(int, DecimalNumber) for those values. If the value is < 2^63, you can use set(int, long). Depending on where you get the value from, you could also set it as a string with set(int, String).