Today is Friday, the 13th
-
There's also the wonderful little bit of hungarianness on the front of it;
nLen
. It's like the author of the code is allowing for the case where the parameter is changed from being declared a couple of lines above to in the class declaration. It's a hyper-BoyScout-ism; being prepared even when there's manifestly no need (the name can be changed when the variable is moved).
-
Looking at the code snippet again, there's even more to discover: I assume this to be C#, so the arguments ParamName, ParamValue and Unicode should start lowercased. Just like cmd and nLen already are.
-
Looking at the code snippet again, there's even more to discover: I assume this to be C#, so the arguments ParamName, ParamValue and Unicode should start lowercased. Just like cmd and nLen already are.
It is indeed C#. The casing of the arguments is just style, so you can discuss that all you want, but it's not nearly as bad as how it basically recreates a worse version of the SqlParameter constructor.
-
but it's not nearly as bad as how it basically recreates a worse version of the SqlParameter constructor.
Full Ack. One wonders what the original idea behind it might have been... to create oneliners at the point where AddStringParam(...) is used?
You could do that withcmd.Parameters.Add(new SqlParameter(...))
as well, of course, but perhaps the coder didn't know about all the constructor overloads available.
-
Full Ack. One wonders what the original idea behind it might have been... to create oneliners at the point where AddStringParam(...) is used?You could do that with cmd.Parameters.Add(new SqlParameter(...)) as well, of course, but perhaps the coder didn't know about all the constructor overloads available.
The biggest issue is that this class over-manages parameters (which are low-risk, it's hard to screw those up too badly), but doesn't manage the DB connection, and leaves that to the developer. It's easy to screw that up and leave connections open. It's just so bad that they prevent the developer from dropping a pen on their foot (about how dangerous the parameters are), but allow developers to shoot themself in the foot.
-
You could do that with
cmd.Parameters.Add(new SqlParameter(...))
as well, of course, but perhaps the coder didn't know about all the constructor overloads available.
-
AddWithValue
Frameworks that provide every sensible method you could ever think of make it a lot easier to reinvent the wheel. More often than not you might not even notice.
-
Frameworks that provide every sensible method you could ever think of make it a lot easier to reinvent the wheel. More often than not you might not even notice.
Is that from the PHP documentation?
-
-
-
ARE YOU INSINUATING I KNOW PHP?????
Come. Join us. We have REAL escaped strings.
Filed under: ... now
-
At least they decided to try to sanitise things for MySQLi,
mysqli::escape_string
is a thing. (But the procedural fashion, of course, does mandatemysqli_real_escape_string
for consistency with the old MySQL extension.
-
No, just that you can Google.
PHP might offer plenty of methods; "sensible" however is not necessary a good word to describe them.Filed under: I hope to make it to retirement without ever having done PHP programming
-
PHP might offer plenty of methods; "sensible" however is not necessary a good word to describe them.
Filed under: I hope to make it to retirement without ever having done PHP programming
That is true.
My solution to the PHP problem is to just replace all PHP that I'm asked to work on with Python. Might not work so well when the strategy at my current place is to get rid of all PHP, and we only have a small number of brief PHP scripts.
-
Come. Join us. We have REAL escaped strings.
I'm not there yet, I think... I still haven't lost all of my ideals about good code.
-
We have REAL escaped strings.
Did they try to run away with the refrigerator?
Filed Under: When did you finally catch them?
-
Just checked. Yup, "Fear of PHP Programming" is missing from this poll.
-
But is it PHPhobia or PHPophobia? Inquiring minds need to know.
-
But is it PHPhobia or PHPophobia?
I just realized I don't even know what PHP stands for...Edit: ah, ok, a recursive backronym: PHP Hypertext Preprocessor.
-
-
recursive backronym: PHP Hypertext Preprocessor
Historical revisionism, since recursive backronyms are a Thing. Used to be Personal Home Page, which pretty much tells you all you need to know about intended usage.
-
-
PHP/FI if we're going down that particular route to hell. But it was rewritten for 3.0 with the first version of Zend Engine and rewritten again for 4.0 with the second version of Zend Engine and then they invented the new name somewhere along the way.
-
But we can at least agree that recursive backronyms are dumb?
-
Dumb: Utterly Mind Boggling. Though I feel that wasn't quite what you meant.
-
Not sure whether this should go here, or in the Bad Ideas thread. Probably both..
In summary, idiot (UK) armed police arrest someone dressed up as Jason Voorhees on Friday 13th, because some idiot member of the public rang them up because idiot member of the public thought the wooden machete part of his costume was real.
Idiot UK police force justified this behaviour saying
West Yorkshire Police have since issued a warning about the 'distress' caused by carrying toy weapons in public.
-
You think that's bad...
-
This is what I mean by living in a surprisingly sane country these days (I did live in London a couple years back).
Compare and contrast: two years ago I took part in an extended amateur photo-shoot right smack in the middle of Warsaw. The theme: Shadowrun. Picture evidence:
Don't know if that'll be accessible (it ought to be on a public page). Long story short: bunch of hoodlums with point ears/fangs/other and more ASGs than you can shake a dead elf at, running about in the city center, followed by a herd of photographers.
The only people who took note were a couple of security guards at an office building, who told us to get off their lawn (or steps or whatever).
-
I think it's time for me to learn Polish...
-
The theme: Shadowrun
I love Shadowrun but I'm not into the LARP scene. I just play the vidja games.
Filed under: I recently beat Shadowrun Returns on Very Hard as an elf decker.
-
I love Shadowrun... I just play the vidja games
No, just no. If you don't require piles of d6s then it isn't shadowrun.
-
I love Shadowrun but I'm not into the LARP scene. I just play the vidja games.
No, just no. If you don't require piles of d6s then it isn't shadowrun.
Funniest thing is: I've never played Shadowrun in my life...
Filed under: been meaning to though, running CP2020 these days
-