Database API: raw queries

If you prefer to access database using raw queries, use plain Database-class and query-method.

escapeSQL-function can be used to escape illegal characters such as '. NULL is a special word and it has to be escaped by the user. 'NULL' maps to NULL and ''NULL'' to 'NULL' etc.

Use Database::groupInsert - if you want to create rows with new integer as the first field.

A query example:

Database db("sqlite3", "database=test.db");
db.query("CREATE TABLE custom(value INTEGER);");
db.query("INSERT INTO custom VALUES (1)");
Records recs = db.query("SELECT * from custom");
for (Records::iterator i = recs.begin(); i != recs.end(); i++)
cout << (*i)[0] << endl;
std::vector< Record > Records
Definition: types.hpp:26 Logo