On Aug 25, 2011, at 2:03 PM, Alexander Reichstadt wrote: > Hi, > > Thank you for your many responses. > >> const char *cstr = [s UTF8String]; >> mysql_stmt_prepare(myStatement, cstr, strlen(cstr)); > > > This fixed the bug. > > Alexander
Just in case the string has a NULL character, I'd use: NSData *data = [s dataUsingEncoding:NSUTF8StringEncoding]; mysql_stmt_prepare(myStatement, [data bytes], [data length]); Of course, if you *did* have a NULL character in your string, then the mysql_stmt_prepare would probably barf at some point. You could use the comparison of strlen() and [data length] to make sure that you're not passing a NULL. -- Glenn L. Austin, Computer Wizard and Race Car Driver <>< <http://www.austin-soft.com> _______________________________________________ Cocoa-dev mailing list ([email protected]) Please 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
