|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: 2 days ago @ 10:04 AM
Points: 753,
Visits: 3,786
|
|
GSquared (1/31/2012)
Any standard character on the keyboard is a liability for this kind of thing. But well-written code doesn't have problems with it.
If I understand correctly, I think that having to wrap every text field in a function, just in case there are quotes in it, is a design flaw. Ideally, that would be unnecessary.
But thanks for all the information Gus, I want to look into this further.
______________________________________________________________________ The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. - Stephen Hawking
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Yesterday @ 3:32 PM
Points: 8,980,
Visits: 8,540
|
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Monday, June 17, 2013 1:45 PM
Points: 15,442,
Visits: 9,572
|
|
mtillman-921105 (1/31/2012)
GSquared (1/31/2012)
Any standard character on the keyboard is a liability for this kind of thing. But well-written code doesn't have problems with it.If I understand correctly, I think that having to wrap every text field in a function, just in case there are quotes in it, is a design flaw. Ideally, that would be unnecessary. But thanks for all the information Gus, I want to look into this further.
What I'm saying is, you don't need to wrap them in a function unless there's something wrong with the code. The reason people strip these things out is to prevent SQL injection, and it's the wrong way to do that. It's completely unnecessary if you do it the right way.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Monday, June 10, 2013 1:08 PM
Points: 679,
Visits: 2,038
|
|
mtillman-921105 (1/30/2012)
Well, if they're not already doing so, I hope that new programming languages start using another delimiter for strings other than quotes. Even brackets "[]" would have been better characters to use, at least for English, since those characters aren't normally necessary.
1) The best delimiter for separating units of ASCII data is the Unit Separator, ASCII 31 (0x1F). Record Separator is ASCII 30 (0x1E), Group Separator is ASCII 29 (0x1D), and File Separator is ASCII 29 (0x1C); these have been defined since ASCII was defined in the early 1960's, though it's fallen out of use.
2) Delimiters shouldn't be relevant if you have good field to field mappings between app and database; regrettably, some of us don't have that luxury.
In response to the original post, as everyone else said, it's the app's problem; the database is there to take exactly what it's given, whether it's a Q, a š, a ©, or an ', and return that upon request.
As far as CPU hit, with current hardware, in general, properly escaping each character in a string is not likely to cost more CPU than checking on the database connection and authentication, formatting the data for the connection type, transmitting the data, getting a result, validating the result, and other database connection overhead tasks.
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Monday, June 17, 2013 1:45 PM
Points: 15,442,
Visits: 9,572
|
|
Nadrek (2/1/2012)
mtillman-921105 (1/30/2012)
Well, if they're not already doing so, I hope that new programming languages start using another delimiter for strings other than quotes. Even brackets "[]" would have been better characters to use, at least for English, since those characters aren't normally necessary.1) The best delimiter for separating units of ASCII data is the Unit Separator, ASCII 31 (0x1F). Record Separator is ASCII 30 (0x1E), Group Separator is ASCII 29 (0x1D), and File Separator is ASCII 29 (0x1C); these have been defined since ASCII was defined in the early 1960's, though it's fallen out of use. 2) Delimiters shouldn't be relevant if you have good field to field mappings between app and database; regrettably, some of us don't have that luxury. In response to the original post, as everyone else said, it's the app's problem; the database is there to take exactly what it's given, whether it's a Q, a š, a ©, or an ', and return that upon request. As far as CPU hit, with current hardware, in general, properly escaping each character in a string is not likely to cost more CPU than checking on the database connection and authentication, formatting the data for the connection type, transmitting the data, getting a result, validating the result, and other database connection overhead tasks.
The ASCII escape characters aren't human-visible and don't have keys on a regular keyboard, so, while they work beatifully for computers, they don't work at all well for people. That's almost certainly why they've fallen out of use. Same reason we don't program in Assembler.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: 2 days ago @ 10:04 AM
Points: 753,
Visits: 3,786
|
|
Thanks for the information.
I haven't commented much lately, but I'm extra busy with work these days. But I appreciate your time and insights.
______________________________________________________________________ The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. - Stephen Hawking
|
|
|
|