How to split a string literal across multiple lines in C / Objective-C?

I have a pretty long sqlite query:

const char *sql_query = "SELECT statuses.word_id FROM lang1_words, statuses WHERE statuses.word_id = lang1_words.word_id ORDER BY lang1_words.word ASC";

How can I break it in a number of lines to make it easier to read?
If I do the following:

const char *sql_query = "SELECT word_id
                        FROM table1, table2
                        WHERE table2.word_id = table1.word_id
                        ORDER BY table1.word ASC";

I am getting an error.

Is there a way to write queries in multiple lines?

9 Answers
9

Leave a Comment