Fixed
Status Update
Comments
ch...@gmail.com <ch...@gmail.com> #2
i am getting that error as part of instrumented unit test
Also facing issues while updating
UPDATE test_device SET test = :test WHERE serial_number = :serialNumber
for some reason the actual compilation works just fine but unit test throws error
Error Code : 1 (SQLITE_ERROR)
Caused By : SQL(query) error or missing database
(near "?": syntax error (code 1): , while compiling: UPDATE test_device SET test = ?,?,?,?,?,?,? WHERE serial_number = ?)
Also facing issues while updating
UPDATE test_device SET test = :test WHERE serial_number = :serialNumber
for some reason the actual compilation works just fine but unit test throws error
Error Code : 1 (SQLITE_ERROR)
Caused By : SQL(query) error or missing database
(near "?": syntax error (code 1): , while compiling: UPDATE test_device SET test = ?,?,?,?,?,?,? WHERE serial_number = ?)
yb...@google.com <yb...@google.com> #3
can you put the full query?
I'm afraid what is happening is that, you are passing byte[] to the method and Room by mistake things it is a set of bytes instead of just the blob.
does your query looks something like this:
@Query("UPDATE test_device SET test = :test WHERE serial_number = :serialNumber")
void update(String serialNumber, byte[] test)
?
I'm afraid what is happening is that, you are passing byte[] to the method and Room by mistake things it is a set of bytes instead of just the blob.
does your query looks something like this:
@Query("UPDATE test_device SET test = :test WHERE serial_number = :serialNumber")
void update(String serialNumber, byte[] test)
?
ch...@gmail.com <ch...@gmail.com> #4
@Query("SELECT test from test_device WHERE serial_number = :serialNumber")
public byte[] getTest(String serialNumber);
@Query("UPDATE test_device SET test = :test WHERE serial_number = :serialNumber")
public void updateTest(byte[] test, String serialNumber);
i am basically passing a byte array
something like "TEST".getBytes() to update function
and even the getTest method fails with what i have mentioned in my first comment
public byte[] getTest(String serialNumber);
@Query("UPDATE test_device SET test = :test WHERE serial_number = :serialNumber")
public void updateTest(byte[] test, String serialNumber);
i am basically passing a byte array
something like "TEST".getBytes() to update function
and even the getTest method fails with what i have mentioned in my first comment
yb...@google.com <yb...@google.com>
ya...@google.com <ya...@google.com>
ch...@gmail.com <ch...@gmail.com> #5
Thanks!
Description
Version used:alpha1
Devices/Android versions reproduced on:Samsung S7
Entity with a column having byte[] as primary data type has issues reading it
android.database.sqlite.SQLiteException: unknown error (code 0): Unable to convert BLOB to long
at android.database.CursorWindow.nativeGetLong(Native Method)
at android.database.CursorWindow.getLong(CursorWindow.java:524)
at android.database.CursorWindow.getShort(CursorWindow.java:575)
at android.database.AbstractWindowedCursor.getShort(AbstractWindowedCursor.java:63)
Sample query: SELECT test from test_device WHERE serial_number = ?
here is test is of type byte[]