I have a database schema that I do not control (it's a sqlite3 file exported from a desktop application that I need to interoperate with), that contains UUIDs for some of the columns. I'm using sqlite-net-pcl in a Xamarin.Forms app, and I cannot work out how to successfully read these columns. Here's what I've tried:
- using the sqlite3 command line, I've confirmed that the schema has type
uuidfor the relevant column, and usingselect count(distinct uuidcolumn) from mytable;I've confirmed that there are values for each row. (The column is nullable which is relevant for the code snippet below but in practice all the rows have non-null values) - I have this model object:
namespace brahms.Model
{
[Table("mytable")]
public class MyTable
{
[Column("uuidcolumn")]
public Guid UUIDColumn { get; }
[PrimaryKey, AutoIncrement, NotNull]
[Column("recordid")]
public int RecordID { get; set; }
}
}
- if I fetch an object using
database.Query<MyTable>()queries,UUIDColumnis always equal toGuid.Empty. - I tried switching the type in the class definition to
Byte[]; it's alwaysnull. - I tried switching the type in the class definition to
string; it's alwaysnull. - Same applies to the
UInt16[]type (the GUID might be stored as a blob of 16-bit words, so I tried that type too)
How can I read the values in uuid-typed columns using sqlite-net-pcl?