-
-
Notifications
You must be signed in to change notification settings - Fork 519
Description
I have a feeling that I'm missing something, but my experience with the PostgresCompiler is that it has several problems creating valid queries even for simple scenarios. There are things which seem so basic that I cannot be the first to run into them - hence the feeling that I am missing something. The queries were executed by manually taking the compiled sql and executing them with Dapper, if it makes any difference. I'm using version 2.4 of the library.
- When using
query.WhereContains, the query string itself is not surrounded with's which it must be. I updated theCompileBasicStringConditionimplementation to change the switch statement to the following:
switch (x.Operator)
{
case "starts":
text2 = "'" + text2 + "%'";
break;
case "ends":
text2 = "'%" + text2 + "'";
break;
case "contains":
text2 = "'%" + text2 + "%'";
break;
}-
When using
query.WhereLikeI had the same problem as in 1), but here the solution was just to prewrap my argument in single quotes at the call site. This is less of a big deal, but takes away from a feeling that the library "just works". -
When selecting columns, they are wrapped in
"s. This is not valid, so I had to do the following in my compiler.
public override string WrapValue(string value) =>
value;I'm not sure if this has any influence on 1) and 2), but I don't think so since the quotation character is " which is not what is needed in those cases.