sqlkata/querybuilder

SqliteCompiler - Issue when using Unique Identifier

kapilbhavsar opened this issue · 1 comments

The query generated by SqliteCompiler for a table with UUID, the parameters are treated as string.
But the sqlite db stores UUID as blob so the strings needs to be passed as X'3E9FDFCAFF7B3B4AB2065C63BC4609C4' instead of '3E9FDFCAFF7B3B4AB2065C63BC4609C4'.
SqliteCompiler doesn't appends X and the query returns with no result.

This further creates problems when using Include or IncludeMany. If the primary and foreign keys are UniqueIdentifier the Include function does not works.

https://stackoverflow.com/questions/7815587/using-guid-in-sqlite-select-where-guid-is-stored-in-the-sqlite-db-as-binaries

I was using postgresql and one more thing I noticed with Include ..
In the handleIncludes method of QueryFactory class, you are converting all the local keys to string
var localIds = dynamicResult.Where(x => x[include.LocalKey] != null) .Select(x => x[include.LocalKey].ToString()) .ToList();
So all the parameters are passed as string which again gives error 42883: operator does not exist: uuid = text.
It works if I remove ToString.