Xcode:如何在Xcode编辑器中将长字符串换行?

3

我有一条很长的SQL语句,想在Xcode编辑器中将其换行,应该如何操作呢?

[db executeUpdate:@"insert into test (rid, one, two, amount, startdate, recurrance) values (nil, ?, ?, ?, ?, ?)",
2个回答

6

尝试:

[db executeUpdate:@"insert into test (rid, one, two, amount, values"  
                   " startdate, recurrance)(nil, ?, ?, ?, ?, ?)",...

0

我遇到了类似的问题... 可能有点多疑... 但是我喜欢我的 SQL 字符串看起来漂亮,并且在出现问题时容易追踪,所以我使用了 stringWithFormat。

例如:

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

希望这正是您所寻找的内容 (我想我可能在错误的页面上发布了...也许这里更好)

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接