• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSString escaping single quotes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSString escaping single quotes
      • From: Sean Murphy <email@hidden>
  • Prev by Date: Re: Changing order of views dynamically
  • Next by Date: Re: NSDatePicker behaviour is odd when typing date
  • Previous by thread: C++ MAC Cocoa & Powerplant developer required for contract in Antwerp, Belgium
  • Next by thread: Re: NSString escaping single quotes
  • Index(es):
    • Date
    • Thread