NSString escaping single quotes
NSString escaping single quotes
- Subject: NSString escaping single quotes
- From: Michael Sullivan <email@hidden>
- Date: Mon, 19 Mar 2007 18:33:17 +0900
Hi,
I'm probably doing something stupid here. I'm trying to pass a
string to ODBC drivers using the ODBCKit. The example code uses a
NSString, but the code bombs when trying to execute the SQL
statement. The debugger reveals that the string is constructed with
a \ in front of the ' characters which contain the string for the SQL
statement. I suspect this is causing the SQL parser to hang.
The string is declared like this:
NSString *sql = [NSString stringWithFormat:@"select * from t_state
where state_code = '%@'", code];
The contents of the string being passed is this:
select * from t_state where state_code = \'xx\'
So, how do I get rid of the \ in front of the single quotes?
Thanks,
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden