on 2012 Apr 17 5:43 PM
I have a long binary field in an Android UltraliteJ database and when I insert a value into it the byte array is around 800-900K in length. However, when I select it out it's less than 64K and not an image. The length returned varies depending on the length of the byte array I inserted. If I compress the image so it's around 20K it is returned from the select statement as the same size and is displayed as an image.
The database is in the applications Data folder on a Galaxy Nexus, Android version 4.0.1.
This is version 12.0.1.3537.
Is this is a bug or are long binary columns limited to 64k on Android?
Thanks, Jonathan
EDIT I've tried both resultset.getBytes(x) and resultset.getBlobInputStream and both have returned the same byte array (the wrong one).
EDIT(Calvin)
PreparedStatement command_statement; command_statement = connection.prepareStatement(commandText); command_statement.set(x + 1, byteArray); Log.v("Test","Insert Byte Array - " + Integer.toString(byteArray.length));
Request clarification before answering.
After consulting with Chris, I have determined that this is a bug with PreparedStatement.set(int,byte[]). The byte array is limited to 32 KB in size right now. I will fix that in an upcoming release. There is no such limitation on long binary columns in UltraLite databases, and, as a workaround, you could use PreparedStatement.getBlobOutputStream(int) to get a java.io.OutputStream, and use that to write the value into the long binary field. Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
FWIW, the CR description is here.
User | Count |
---|---|
60 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.