SELECT Stare decisis

June 22, 2007 12:04

A quick example of why understanding SQL operator precedence is important - or "Why I should have approached Work Item 11221 more carefully."

OperatorPrecedence


6 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Related posts

Comments

June 24. 2007 14:39

Andrew Rimmer

Unless sleep deprivation has got me hallucinating, both of the SQL Statements are completely flawed!

The reason you get 77 results for one and not the other is because the IsDeleted field is set to 0 in your database and not null. If you set them to null, your second query would be 77 and the first query 1. If you had a mix of zeros and nulls in the database, you would get mixed results from the 2 queries.

This is serious problem with SubSonic 2.0.2.

You will need to bracket the OR clause to get it to work.

Where (IsDeleted = 0 or IsDeleted is null) and ProductName = 'Chai'

Andrew

Andrew Rimmer

June 24. 2007 15:17

Eric Kemp

Andrew, you're right. There is still an issue with the logical deletes. I'll be restructuring this today, and will likely be issuing a 2.0.3 release. I believe that this should only affect scenarios where the logical delete columns are specified as nullable. Thank you for reporting this.

Bracketing is certainly the correct way to do this. Unfortunately, this is a bit of tricky issue right now with the way that queries are constructed in the engine. I guess I was being a bit lazy here, and obviously the unit tests aren't sufficient in this area.

However, I think this makes the original point even more relevant. Smile

Eric Kemp

June 24. 2007 15:24

kevin

@andrew - you nailed it on the head regarding bracketing

@eric - great 2.02 release and with this issue fix making it into 2.03 subsonic is looking sweeter by the day - great job!

kevin

June 24. 2007 22:54

Eric Kemp

This is (or should be) fixed in Revision 126... If you don't download it for this, do it for the template engine... Smile

Eric Kemp

January 14. 2008 08:36

Aron

Hi Irv, I don't know what you were thinking here dude! You got a pretty model (altho kind of old), but you have caught her with her eyes cloes in a not very good pose. Biggest problem is YOU NEED CROP to a vertical!!!!! Backdrop is too small and there is not enough of a sweep so you can see the crease. If you send me a file I can fix it in Photoshop and I can give http://hentaimangavideo.info/index.php?p=37">37
http://hentai-movie-downloads.info/index.php?p=14">14
http://hardcore-hentaivideo.info/index.php?p=41">41
http://xxx-hentaivideo.info/index.php?p=22">22 you my suggested crop. If you don't care aboout your PROFESSIONALISM you are never going to get work as a pro believe me!!! Hope I am not being too harsh. Oh well best regards anyway, M.H.

Aron

Comments are closed