Re: MySQL Escaped String
Re: MySQL Escaped String
- Subject: Re: MySQL Escaped String
- From: Joakim Danielson <email@hidden>
- Date: Tue, 11 Jan 2005 14:44:48 +0100
Hi
You should insert an extra ' in front of the first ' instead of a \. So your code should be
replaceOccurenceOfString:@"'" withString:@"''"...
Joakim
On 2005-01-11, at 08.42, Robin Hermann wrote:
Hi List,
I'm new to the list and a newbie to Cocoa.
Probably an easy one, but couldn't find it on the web: I need een escaped string for MySQL
I tried this:
<x-tad-bigger>
NSMutableString *dataField = [NSMutableString stringWithCapacity:10];
[dataField setString: [dataRecord objectForKey:corrField]];
[dataField replaceOccurrencesOfString:@"'" withString:@"\'" options:NSLiteralSearch range:NSMakeRange(0, [dataField length]) ];</x-tad-bigger>
But that doesn't work. How should I do it?
Robin Hermann _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden