yasser777 / nettiers

Automatically exported from code.google.com/p/nettiers
0 stars 0 forks source link

ParameterBuilder with Empty String value #101

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a ParameterBuilder
2. Add an AppendEquals where the value of the field is an empty string as
the only parameter in the builder
3. call DataRepository.SomeProvider.Find(ParameterBuilder, "Order By")

What is the expected output? What do you see instead?
Expected output would be to compare the field in the parameter builder with
the empty string value. Instead it acts like it is ignoring the parameter
completely and returns all items in the table as if there is no where
clause at all.

What version of .netTiers and CodeSmith are you using?
.netTiers 2.2
CodeSmith 4.1.3

Please provide any additional information below.

Original issue reported on code.google.com by da...@nteg.com on 16 Sep 2008 at 5:08

GoogleCodeExporter commented 9 years ago
See the original post at 
http://community.codesmithtools.com/forums/p/8869/32753.aspx

Original comment by da...@nteg.com on 16 Sep 2008 at 5:10

GoogleCodeExporter commented 9 years ago
This is way deep in the code.  I am a little uncomfortable changing this.  I 
can see 
where people could have coded things that expect this functionality at this 
point.

I can see where you would want to find something with an empty string, and I 
can see 
where you might want to exclude things with an empty string.  I can see both 
cases.

I would almost think you might need to keep doing your workaround for now.  As 
we 
start the next version of Nettiers, maybe we can start out doing this way.

Assigning this to v3.

Original comment by jmhin...@gmail.com on 5 Oct 2008 at 5:51

GoogleCodeExporter commented 9 years ago
I can't see a reason that you would ever want the parameter ignored if it were 
an
empty string. In what situation could you see that desired or expected? Maybe I 
am
just short-sighted on it but to me it seems broken the way it is now.

Original comment by da...@nteg.com on 9 Oct 2008 at 1:20

GoogleCodeExporter commented 9 years ago
Let's say someone wrote a ASP.NET search page, with 20 text boxes.  On the 
Search, 
it is putting the values in the text box into the Criteria class, not checking 
to 
see whether or not the textbox is empty.

I haven't looked at the Nettiers UI, but it wouldn't suprise me one bit to see 
it 
coded this way.

jeff

Original comment by jmhin...@gmail.com on 9 Oct 2008 at 2:32

GoogleCodeExporter commented 9 years ago
Ah, that does make sense that it could've been written that way. I would still
contend that it would be the exception and the rule seems like it should be the
opposite of what it is. It bit me hard when I found it as it was a shopping cart
issue where someone had somehow lost their cart cookie (thus the empty string) 
and it
ended up putting every item in everyone's cart onto this person's order making 
it
several thousand dollars worth. Good for me, bad for the customer. 

If I am saying: 

SELECT * FROM SOMETABLE WHERE ThisField='' 

then I am not expecting it to ever be 

SELECT * FROM SOMETABLE 

and leave off the WHERE clause completely due to an empty string. I expect it 
to be
evaluated with the empty string. Does that make sense? 

I would not be shocked that someone somewhere has a situation like you 
described, but
I would bet there are way more of the opposite scenarios. Anyway, way more than 
my
two cents...

Original comment by da...@nteg.com on 9 Oct 2008 at 3:19

GoogleCodeExporter commented 9 years ago
i meet this problem too.
how can i build a query like : SELECT * FROM SOMETABLE WHERE ThisField='' 
in some case ,thisfield is just empty string

Original comment by honghua...@gmail.com on 5 Jan 2009 at 8:10

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 25 May 2009 at 3:48