efcore icon indicating copy to clipboard operation
efcore copied to clipboard

SQLite: Querying on byte[] JSON property doesn't work

Open roji opened this issue 1 year ago • 3 comments

See test JsonQuerySqliteTest.Json_predicate_on_byte_array.

roji avatar Apr 12 '24 16:04 roji

according to documentation for json_extract:

SQL datatype of the result is NULL for a JSON null, INTEGER or REAL for a JSON numeric value, an INTEGER zero for a JSON false value, an INTEGER one for a JSON true value, the dequoted text for a JSON string value, and a text representation for JSON object and array values

We also return unexpected results when projecting byte array. for byte array 1, 2, 3 we actually return 48 49 48 50 48 51, so ASCII for 010203.

Non-JSON byte arrays work fine.

maumar avatar Apr 27 '24 00:04 maumar

@maumar am no longer sure, but shouldn't we doing base64 decoding on the string data coming out of the JSON?

roji avatar Apr 28 '24 21:04 roji

IIUC the SQLite provider represents byte[] as hex in JSON since 011f0ecc91d044e299eadd044ed0e990828b295e

ranma42 avatar Jun 28 '24 16:06 ranma42