- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Come on guys. Your options are limited on an embedded filesystem.
Admin
try this rmdir /s c:*
it's about the same thing.
Admin
Clearly this is the "rm -rf /" for embedded file-systems that don't have an OS.
Admin
in case you did not notice - this is SQL Server, not Oracle. Btw, '' is equivalent to NULL in Oracle, well known, documented, no WTF
Admin
Maybe it is used to check if the DB-connection is still alive? Throwing an exception if it is not.
(ofcourse there must be better ways :-) )
Admin
Not very exciting. This is just a "code around" for some crappy but irreplaceable legacy system that didn't know how to handle nulls.
Admin
Admin
Billy Preston, I think.
Admin
But they did a source code audit, and said Nothing is wrong with my system!
Admin
HA HA HA, you are too funny!!! Pure genius.
Admin
Perhaps nothing used to be something and then they made cutbacks.
Admin
This begs the question: Can you have an END without a BEGIN?
Admin
FTFY
Admin
Seriously, where is the WTF? It's short, simple to understand, and does precisely what it says.
Apparently Alex is stretching for material again.
Admin
A man traveling through the Orient passed a small courtyard and heard voices murmuring. He went in and saw an altar with a large stone 0 in the middle. White-robed people were kneeling before the altar, softly chanting "Nil… nil… nil…" while ceremonial priests sang prayers to The Great Nullity and The Blessed Emptiness.
Eventually, the man turned to a white-robed observer beside him and asked “Is Nothing sacred?”
Admin
Breakpoint
Admin
and '' is equivalent to SOMETHING in SQL Server 2015. They're working on it. Promised.
Admin
Looks like a database ping to me. Verify that you have a working connection and can execute a stored procedure. There are probably cleaner ways of doing it but looks like it works.
Admin
I've got nothing.
Admin
gOLD!!
Admin
But then you might be a troll, so I go now...
Admin
Because we all know stored procedures are more secure.
Admin
SQL> select decode('', null, 1, 2) as test from dual;
SQL> select case when '' is null then 'Null' else 'Not Null' end as test2 from dual;
TEST2
Null
Admin
The first SQL koan has been written and has been lost on the the laymen. you all have much to learn.
Admin
So the problem here is that Tony has Triskaidekaphobia?
Admin
What if the field is VARCHAR(1) ? What if the field isn't VARCHAR at all?
'' is NOT equivalent to null -> NULL can be used to represent an empty string. This is not the same thing.
Admin
And also....
(splitting hairs perhaps) if they were both equivalent then '=' and 'is' shoul.d be able to used interchangeably. Interestingly, you get a different result for these two statements:
This implies that an empty string can be represented as null, but not that null and '' is equivalent.
Further, if null and '' were equivalent, the following should be valid:
This does not mean that '' is equivalent to null.
Admin
There's nothing good. Even if you do it yourself.
Sorry.
Admin
Ooh ooh! I get it - the WTF is Hungarian notation, right? ducks
Admin
Usually you open a connection before you can call any SP's, which fails before reaching the SP.
No, this SP has a much more perverted purpose.
Admin
Guess you gotta look on the bright side then ;)
Admin
Nice one
Admin
In some old FoxPro (I know, ew) code at work, I found this procedure:
procedure nothing return
It would seem nothing is quite important in many systems.
Admin
Yes, I am very surprised it took until half way down page 2 of the comments before anyone noticed that the SQL would not even parse.
Admin
/* I forgot how to test my database permissions or whether I still have a connection, here is my workaround */
try { rs = conn.execute("EXEC sp_getNothing"); } ...
Admin
I don't get this.
Admin
ditto
Admin
There could be a legitimate reason for this...testing a database connection being retrieved from a pool before using it.
Admin
Admin
Even government taxes inheritance, such code are indirect taxation on developer time!
Admin
Nothin' from nothin' leaves nothin' You gotta have somethin' If you wanna be with me Nothin' from nothin' leaves nothin' You gotta have somethin' If you wanna be with me
I'm not tryin' to be your hero 'Cause that zero is too cold for me, Brrr I'm not tryin' to be your highness 'Cause that minus is too low to see, yeah
Admin
The article says it was actually used 13 times in the code. It would have been instructive to see a couple of those calls to see why call even existed.
Admin
No it doesn't. </grammar nazism>
Admin
... well... unless functionality was dependent upon the exception being thrown by code calling a stored proc that doesn't exist and the author found this code in a script with SA access, both of which are exponentially WTFier. I'm more willing to believe this was a writing error.
Admin
Actually I can think of a legitimate use (although it's a stretch) for this (assuming it is meant to be legal SQL). Using it in a unit test to see the effect of a query returning an empty string.
Admin
Yes, but calling that 13 times in production code?????
Yazeran
Plan: To go to Mars one day with a hammer
Admin
Admin
Admin
It really is null, so '' = '' is unknown. In truth, after using Oracle for a while, it makes sense; I rarely actually want to distinguish between an empty string and missing data. Even when I want to, NULLs are a clumsy way to represent missing or unknown data. TRWTF is three-valued logic.
Oracle has a table called Dual that has one row and one column. It's quite common to see SELECT SYSDATE FROM DUAL. That's why I don't think this is a WTF in the slightest. I would have created a view or even a table to keep errant apps from adding stuff, but there's nothing wrong with a stored procedure.
Incidentally, in the relational algebra, you can have a relational value (which is like a table) that has no attributes (like columns), and either zero or one empty tuples (like rows). For extra credit, figure out which one is the identity of the cross product.
Admin
You're not here to have fun ...