Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Text queries

To run a text query, use any of the following functions:

Almost any query that may be issued in the mysql command line can be executed using this method. This includes SELECTs, UPDATEs, INSERTs, DELETEs, CREATE TABLEs... In particular, you may start transactions issuing a START TRANSACTION, commit them using COMMIT and rolling them back using ROLLBACK.


[Warning] Warning

SQL injection warning: if you compose queries by concatenating strings without sanitization, your code is vulnerable to SQL injection attacks. Use prepared statements when possible!

Use cases

You should generally prefer prepared statements over text queries. Text queries can be useful for simple, non-parametrized queries:

Avoid text queries involving user input.