I'm currently writing an application using VS C++, Qt, and SQLite.
I have a user interface where the user uses a series of combo boxes to select certain criteria that they want to fetch from the database. When this dialog closes, all of the combo boxes selected text (string values) will be passed, and concatenated, into a single string. Two string are created: the field name and the field values.

The final result or the strings will be, for example:
(Actual code uses vectors and 'for' loops:

string select = "SELECT " + field1 + ", "+ field2 etc
string whereClause = "Where " + field1 + "=" + comboString1 + " AND " + field2 + "=" comboString2 etc

These resulting two strings will be used in a SQLite database query where it will fetch the results and display them in another GUI window.

So, my question is to do with string length. I'm worried that the strings will become too big to store all of these literals(?) - there will be a large amount of queries when completed . Another alternative would be to store the string values in a text file. However, the SQL query needs to be a single string, a query can't be made in instalments (as far as I'm aware).

Any ideals? An external file.sql that SQLite could load or something.


You shouldn't fret about it. The string will automatically resize depending upon the RAM available until you run out of it, which IMO shouldn't be happening.
The common SQL Query might be:

SELECT <Fields> FROM [Table] WHERE <Condition> GROUP BY <Field> ORDER BY <Field>

In the above code the only thing that would significantly increase the string size will be the <Fields>. That too after thousands of fields with pretty big names. Others, however, wouldn't exceed say approx. 100 characters.

The maximum length of a std::string is about the same as the maximum value of an unsigned integer, which is pretty darned big (see limits.h -- 4,294,967,295 on my compiler). Its highly unlikely your query will come even close to that number of characters.