SubSonic RESTHandler question

This is my first time playing with SubSonic RESTHandler and it's awesome ... There is one quirk that interests me.

RESTHandler.cs (line 319):

//if this column is a string, by default do a fuzzy search
if(comp == Comparison.Like || column.IsString)
{
    comp = Comparison.Like;
    paramValue = String.Concat("%", paramValue, "%");
}

      

This small code error forces all searches in string columns to be wildcard searches by default. This seems counter intuitive, as you've provided a nice set of comparisons that we can add to the parameter (_is, _notequal, etc.). Is there any reason why this was done? EvalComparison uses "Comparison.Equals" by default, so unless "column.IsString" is explicitly required, it looks like it should be removed since it breaks the ability to use different types of comparisons.

This was driving me crazy since you can't do "WHERE Field = X" without some modification code ...

Just wondering if this is more of a feature than a bug ...

Thanks!

Zach

+1


a source to share


2 answers


This is because it is a LIKE operation that usually allows a database to perform string operations. The feeling at the time was that if you wanted equals, you could just use that.



It's been a while since I touched on this code - if you were kind enough to open the error, I'll take a look at it.

+1


a source


It really looks like a function. This is based on the idea that if I search for a string in a column without wildcards, I must match the string exactly, or I don't get any hits. I suspect this was done to make it easier to program text search fields.



0


a source







All Articles