Question about DBI and single-quote delimeter
Since character fields are generally delimeted by single quotes, if i want to insert a character string like player name that may contain a single-quote or use a WHERE clause and do a comparison against a sting that might contain a single-quote how would I escape the single quote in that string variable?
In perl this is easy, Code:
$name =~ s/'/\\'/g;Thanks :) Mug |
|
Ahhh, well that makes sense... ;)
So something like this: while ( replace( sName, "'", "\\'") ){ } or instead of \\' do I use ^' , I'm unclear ? Thanks Bail! -Mug |
replaceall :)
Its a function thats floating around on the forums somewhere, just search for it |
Code:
And yes, the escape character is the ^ |
replaceall is not a viable solution assuming this is what I wanted to do:
replaceall(name, 32, "'", "^'") It gets caught in an infinite loop because the index of containi isn't updating as it finds a single-quote So am I the first person thats wanted to do this or is there some other way that hasn't been suggested yet? :) EDIT: I checked string.inc and there does not seem to be a version of contain where you can pass the starting index to search from, that'd be a big help. -Mug |
:D :D :D :up: contain(string[startchar], ...) :up: :D :D :D
Might work |
Will give it a try, thanks PM!
-Mug |
| All times are GMT -4. The time now is 17:27. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.