I just discovered that I didn't read the documentation properly and I thought that JET_coltyp.Decimal corresponded to the CLR Decimal type. I also though there was no Int64 equivalent, or perhaps it wasn't complete yet. Now I realise that JET_coltyp.Decimal
is an 8-byte signed integer (Int64). But I'm still not sure how to store CLR Decimal types in ESE. The API documentation says:
JET_coltypCurrency ... This column type is identical to the variant currency type. This column type can also be used as a native 8-byte signed integer
This implies that I can put a CLR Decimal and Int64 value into JET_coltyp.Decimal column. Is that correct? I've never tried casting between Int64 and Decimal, but I suppose it's valid as they're the same size. Does that mean this is valid? ...
Api.SetColumn(sessid, tabid, colid, (long)mydecimal);
decimal mydecimal = (decimal)Api.RetrieveColumnAsInt64(sessid, tableid, colid);
This is a CLR question more than an Esent one, but it would nice to have the issue clarified. It's a bit tricky that JET_coltyp.Decimal is an Int64 and JET_coltyp.Long is an INT32.