开发者

Xcode: How can I add large sql querys to the xcode editor without double quotes at the start and end of each line?

I asked a question earlier today "Xcode: How do I wrap a long string around to the next line in the xcode editor" ...

Xcode: How do I wrap a long string around to the next line in the xcode editor

... but this is going to be inconvenient, I`ve got some quite large sql statements, whi开发者_运维百科ch are nicely formatted. In PHP I now you can do something like >> sql then << something like that.

Is there something similar in xcode?


Nope. You'll have to escape the double quotes, or quote using single quotes instead.


I had similar issue... call me paranoid.. but i like my sqlstring to look pretty and easy to trace in case something went wrong i used the stringWithFormat

example:

NSString sqlString = [NSString stringWithFormat: @"%@ %@ %@ %@ %@",
                   @"SELECT name, address, phone",
                   @"FROM whateverDatabase",
                   @"LEFT JOIN ...",
                   @"WHERE ...",
                   @"AND ...."];

hopefully if this is what you are looking for

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜