[/
    Copyright (c) 2019-2024 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
   
    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
]

[/ This file was auto-generated by examples_qbk.py. Do not edit directly ]

[section:examples Examples]

To run the examples, please go through the [link mysql.examples.setup setup] first.

Here is a list of available examples:

[heading Tutorials]

Self-contained programs demonstrating the basic concepts.

* [link mysql.examples.tutorial_sync Tutorial 1 listing: hello world!]
* [link mysql.examples.tutorial_async Tutorial 2 listing: going async with C++20 coroutines]
* [link mysql.examples.tutorial_with_params Tutorial 3 listing: queries with parameters]
* [link mysql.examples.tutorial_static_interface Tutorial 4 listing: the static interface]
* [link mysql.examples.tutorial_updates_transactions Tutorial 5 listing: UPDATEs, transactions and multi-queries]
* [link mysql.examples.tutorial_connection_pool Tutorial 6 listing: connection pools]
* [link mysql.examples.tutorial_error_handling Tutorial 7 listing: error handling]

[heading Simple programs]

Self-contained programs demonstrating more advanced concepts and techniques.

* [link mysql.examples.inserts INSERTs, last_insert_id() and NULL values]
* [link mysql.examples.deletes DELETEs and affected_rows()]
* [link mysql.examples.prepared_statements Prepared statements]
* [link mysql.examples.disable_tls Disabling TLS for a connection]
* [link mysql.examples.tls_certificate_verification Setting TLS options: enabling TLS certificate verification]
* [link mysql.examples.metadata Metadata]
* [link mysql.examples.multi_function Reading rows in batches with multi-function operations]
* [link mysql.examples.callbacks Callbacks (async functions in C++11)]
* [link mysql.examples.coroutines_cpp11 Stackful coroutines (async functions in C++11)]
* [link mysql.examples.unix_socket UNIX sockets]
* [link mysql.examples.batch_inserts Batch inserts using client-side query formatting]
* [link mysql.examples.batch_inserts_generic Generic batch inserts with Boost.Describe]
* [link mysql.examples.dynamic_filters Queries with dynamic filters]
* [link mysql.examples.patch_updates Dynamic UPDATE queries with PATCH-like semantics]
* [link mysql.examples.source_script Sourcing a .sql file using multi-queries]
* [link mysql.examples.pipeline (Experimental) Pipelines]

[heading Advanced examples]

Programs implementing real-world functionality.


# [@https://github.com/anarthal/servertech-chat The BoostServerTech chat project uses Boost.MySQL and Boost.Redis to implement a chat server]

[heading Setup]

To run the examples, you need a MySQL server you can connect to.
Examples make use of a database named `boost_mysql_examples`.
The server hostname and credentials (username and password) are passed 
to the examples via the command line.

You can spin up a server quickly by using Docker:

[!teletype]
```
    # Remove the "-v /var/run/mysqld:/var/run/mysqld" part if you don't need UNIX sockets
    > docker run --name some-mysql -p 3306:3306 -v /var/run/mysqld:/var/run/mysqld -d -e MYSQL_ROOT_PASSWORD= -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -d mysql

    # All the required data can be loaded by running example/db_setup.sql.
    # If you're using the above container, the root user has a blank password
    > mysql -u root < example/db_setup.sql
```

Please note that this container is just for demonstrative purposes,
and is not suitable for production.

The root MySQL user for these containers is `root` and has an empty password.


[section:tutorial_sync Tutorial 1 listing: hello world!]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_tutorial_sync]

[endsect]




[section:tutorial_async Tutorial 2 listing: going async with C++20 coroutines]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_tutorial_async]

[endsect]




[section:tutorial_with_params Tutorial 3 listing: queries with parameters]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_tutorial_with_params]

[endsect]




[section:tutorial_static_interface Tutorial 4 listing: the static interface]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_tutorial_static_interface]

[endsect]




[section:tutorial_updates_transactions Tutorial 5 listing: UPDATEs, transactions and multi-queries]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_tutorial_updates_transactions]

[endsect]




[section:tutorial_connection_pool Tutorial 6 listing: connection pools]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_tutorial_connection_pool]

[endsect]




[section:tutorial_error_handling Tutorial 7 listing: error handling]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_tutorial_error_handling]

[endsect]




[section:inserts INSERTs, last_insert_id() and NULL values]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_inserts]

[endsect]




[section:deletes DELETEs and affected_rows()]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_deletes]

[endsect]




[section:prepared_statements Prepared statements]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_prepared_statements]

[endsect]




[section:disable_tls Disabling TLS for a connection]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_disable_tls]

[endsect]




[section:tls_certificate_verification Setting TLS options: enabling TLS certificate verification]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_tls_certificate_verification]

[endsect]




[section:metadata Metadata]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_metadata]

[endsect]




[section:multi_function Reading rows in batches with multi-function operations]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_multi_function]

[endsect]




[section:callbacks Callbacks (async functions in C++11)]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_callbacks]

[endsect]




[section:coroutines_cpp11 Stackful coroutines (async functions in C++11)]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_coroutines_cpp11]

[endsect]




[section:unix_socket UNIX sockets]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_unix_socket]

[endsect]




[section:batch_inserts Batch inserts using client-side query formatting]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_batch_inserts]

[endsect]




[section:batch_inserts_generic Generic batch inserts with Boost.Describe]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_batch_inserts_generic]

[endsect]




[section:dynamic_filters Queries with dynamic filters]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_dynamic_filters]

[endsect]




[section:patch_updates Dynamic UPDATE queries with PATCH-like semantics]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_patch_updates]

[endsect]




[section:source_script Sourcing a .sql file using multi-queries]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_source_script]

[endsect]




[section:pipeline (Experimental) Pipelines]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_pipeline]

[endsect]




[section:http_server_cpp20 A REST API server that uses C++20 coroutines]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_http_server_cpp20_main_cpp]

[example_http_server_cpp20_types_hpp]

[example_http_server_cpp20_error_hpp]

[example_http_server_cpp20_error_cpp]

[example_http_server_cpp20_repository_hpp]

[example_http_server_cpp20_repository_cpp]

[example_http_server_cpp20_handle_request_hpp]

[example_http_server_cpp20_handle_request_cpp]

[example_http_server_cpp20_server_hpp]

[example_http_server_cpp20_server_cpp]

[endsect]




[section:http_server_cpp14_coroutines A C++14 REST API server that uses asio::yield_context]

This example assumes you have gone through the [link mysql.examples.setup setup].

[example_http_server_cpp14_coroutines_main_cpp]

[example_http_server_cpp14_coroutines_types_hpp]

[example_http_server_cpp14_coroutines_repository_hpp]

[example_http_server_cpp14_coroutines_repository_cpp]

[example_http_server_cpp14_coroutines_handle_request_hpp]

[example_http_server_cpp14_coroutines_handle_request_cpp]

[example_http_server_cpp14_coroutines_server_hpp]

[example_http_server_cpp14_coroutines_server_cpp]

[endsect]


[endsect]

