我有一条很长的SQL语句,想在Xcode编辑器中将其换行,应该如何操作呢?
[db executeUpdate:@"insert into test (rid, one, two, amount, startdate, recurrance) values (nil, ?, ?, ?, ?, ?)",
我有一条很长的SQL语句,想在Xcode编辑器中将其换行,应该如何操作呢?
[db executeUpdate:@"insert into test (rid, one, two, amount, startdate, recurrance) values (nil, ?, ?, ?, ?, ?)",
尝试:
[db executeUpdate:@"insert into test (rid, one, two, amount, values"
" startdate, recurrance)(nil, ?, ?, ?, ?, ?)",...
我遇到了类似的问题... 可能有点多疑... 但是我喜欢我的 SQL 字符串看起来漂亮,并且在出现问题时容易追踪,所以我使用了 stringWithFormat。
例如:
NSString sqlString = [NSString stringWithFormat: @"%@ %@ %@ %@ %@",
@"SELECT name, address, phone",
@"FROM whateverDatabase",
@"LEFT JOIN ...",
@"WHERE ...",
@"AND ...."];