526 Commits

Author SHA1 Message Date
Anarthal (Rubén Pérez) b34120eb4b Reduces pool_params::ping_interval default from 1h to 10s (#512)
Improves the detection of broken connections to reduce the chance of
handing over broken connections.

close #510
2026-06-17 10:54:03 +02:00
Anarthal (Rubén Pérez) 0661a2bb52 Adds a way to configure the server's default charset, for tracking (#511)
Adds a way to configure which character set is the server using by
default, to make tracking more intelligent. This can be used to avoid
redundant SET NAMES statements, specially when using connection_pool.

Adds pool_params::charset_strategy and pool_charset_strategy
Adds connect_params::server_default_charset
Adds the invalid_connection_id constant

close #498
2026-06-16 16:07:23 +02:00
vsoulgard 5d9ff8f34d Optimizes message memmoves (#501)
Changes read_buffer to always use powers of two when growing in size
Optimizes message_reader to avoid memmoves when the data to move is big

close #462
2026-03-29 12:13:32 +02:00
Anarthal (Rubén Pérez) 6a82609638 caching_sha2_password can now be used without TLS
Fixed a problem that caused pfr_by_name<T> to fail compilation when T has no fields under older clang/libc++ versions.

close #313
close #483
2025-06-07 13:20:48 +02:00
Anarthal (Rubén Pérez) 90405e79e4 Handshake is now more resilient
Errors issued by the server for caching_sha2_password users after a fast
auth OK packet has been received (e.g. bad database errors) are now
reported correctly
Handshake now correctly detects protocol violation errors, like double
auth switches

close #469 
close #468
2025-05-07 13:11:52 +02:00
Holger Hoffstätte 472e844175 Add <cstdint> to fix compilation failures with gcc-15
This fixes compilation failures we've seen in Gentoo when trying to run
the boost testuite.
2025-05-07 11:55:15 +02:00
Anarthal (Rubén Pérez) 27e417dc2d capabilities is now a scoped enum
close #471
2025-04-25 20:11:19 +02:00
Anarthal (Rubén Pérez) d56b4cd421 metadata is now implemented as a single std::vector
Instead of several separate std::string objects, metadata now uses a
single std::vector<char> and offsets, which is more efficient
Default-constructing metadata objects now leaves all fields in a
  well-defined state
Added unit tests for metadata

close #461 
close #465 
close #164
2025-04-05 19:46:43 +02:00
Anarthal (Rubén Pérez) fa397b7535 Fixed a race condition in per-operation cancellation in variant_stream
close #454
2025-02-26 16:49:50 +01:00
Anarthal (Rubén Pérez) e988c9ad9e Added docs on using asio::cancel_after with pool_params::thread_safe
close #402
2025-02-24 22:11:35 +01:00
Anarthal (Rubén Pérez) 33660e2710 Starting operations while engaged in multi-function ops is no longer UB
Attempting to start an operation involving server communication after a
multi-function operation has been started and before all its associated
packets have been read now fails with
client_errc::engaged_in_multi_function, instead of causing undefined
behavior.
Attempting to start a read_some_rows or read_resultset_head operation
with no in-progress multi-function operation now fails with
client_errc::not_engaged_in_multi_function.
Attempting to start an operation that requires an established session
before a successful connect now fails with client_errc::not_connected.
Added the three client_errc enum values mentioned above.
Renamed detail::connection_status (connection_pool) to node_status.
Added detail::connection_status (connection_state_data).
Removed redundant spotcheck tests.

close #448 
close #450
2025-02-22 19:15:03 +01:00
Anarthal (Rubén Pérez) 3868d8a0cf Added unit tests for the close connection algorithm
close #445
2025-02-19 16:13:23 +01:00
Anarthal (Rubén Pérez) 41a674628f Added quit_connection unit tests and refactored
Quit now correctly marks TLS as terminated, even if it encounters an error
Removed ssl_state

close #444
2025-02-17 18:46:46 +01:00
Anarthal (Rubén Pérez) cd0ee4ad14 Replaced C++20 feature test macros by Boost.Config's for C++17 headers 2025-02-13 08:03:57 +01:00
Anarthal (Rubén Pérez) 793b678287 Updated file copyrights to 2025 2025-02-11 20:42:41 +01:00
Anarthal (Rubén Pérez) f5ff37539a Fixed a race condition in per-operation cancellation in connection operations
Now connection/any_connection async operations are cancelled even when
the cancellation signal is emitted after an intermediate operation
completes, but before its intermediate handler gets called.
Restored a connection_id integration test that required this fix.

close #199
2025-02-11 19:15:50 +01:00
Anarthal (Rubén Pérez) 829dbf775c Connections now check for in-progress async operations and fail without UB
connection and any_connection now check whether there is an in-progress
async operation, and fail with client_errc::operation_in_progress if
there is one. This situation no longer triggers undefined behavior.
Refactored the internal sans-io algorithms

close #405
2025-02-05 20:15:54 +01:00
Anarthal (Rubén Pérez) bef74828a9 Added any_connection::connection_id
close #408
2025-02-05 15:14:06 +01:00
Dirk Stolle 403ce603aa Fixed a few typos 2025-01-24 15:45:45 +01:00
Anarthal (Rubén Pérez) 1c67537290 connection_pool now resizes correctly in the presence of pending connections
Changed the algorithm that calculates how many connections to create to
correctly take into account the number of pending requests.
This makes the pool resize as expected and avoids potential deadlocks.

close #395
2025-01-06 17:14:32 +01:00
Anarthal (Rubén Pérez) 25f9900c0b Fixed ping_interval docs regarding its relation with wait_timeout
close #391
2025-01-03 11:37:33 +01:00
Anarthal (Rubén Pérez) f6c119210d Boost 1.87: new discussion and examples (part 1)
Added tutorials 2, 3 and 4
Changed most of the discussion to use any_connection
Added examples on disabling TLS, multi-function operations, multi-queries and transactions
All examples now use any_connection
Automate parts of example qbk generation

Partially addresses #365 and #366
2024-11-05 00:12:27 +01:00
Anarthal (Rubén Pérez) 8b2727f840 with_diagnostics now passes through unknown signatures
This makes asio::as_tuple and asio::redirect_error usable as partial
completion tokens with any_connection and connection_pool.
Fixed a Jamfile issue that caused warnings in dependencies to fail CI builds.
Removed leftover comment in the pipeline example.
2024-11-02 20:10:22 +01:00
Anarthal (Rubén Pérez) 272533c938 Boost 1.87 API status update
any_connection, client-side SQL formatting and connection_pool are now
stable
connection is now marked as legacy (not recommended for new code)
Added legacy/experimental tags in quickref file

close #364
2024-10-29 18:02:54 +01:00
Anarthal (Rubén Pérez) fe5b27d78e Document that ping_interval should be >= wait_timeout
Fix defect in connection_pool docs

close #290
2024-10-14 17:41:08 +02:00
Anarthal (Rubén Pérez) eba723f5a7 connection_pool destructor now cancels async operations
Improved connection_pool docs on thread-safety.

close #370
2024-10-14 13:35:32 +02:00
Anarthal (Rubén Pérez) 6842c2d83d sequence now returns an owning type
Renamed format_sequence_view to format_sequence
format_sequence members are now part of the public API
Moved sequence to a separate header
Added sequence_range_t

close #359
2024-10-11 22:17:17 +02:00
Anarthal (Rubén Pérez) bb568ba071 Documented connection_pool execution semantics
Refactored pool internals to remove wait_group
Added an external strand thread-safety test

close #361
2024-10-10 15:52:17 +02:00
Anarthal (Rubén Pérez) 146b555817 Replaced run_with_timeout by asio::cancel_after
close #351
2024-10-04 11:35:02 +02:00
Anarthal (Rubén Pérez) 268aa33a84 Connections now support immediate executors
Immediate completions in connection and any_connection are now correctly
    dispatched to the token's immediate executor using asio::async_immediate
    instead of plain asio::post.
Added a section on executors in the reference docs of async functions in
    connection and any_connection
Disabled TSAN connection_pool_cancel_get_connection for libc++ builds

close #301
2024-10-03 20:19:51 +02:00
Anarthal (Rubén Pérez) 7ef6ff8773 Removed pool executor params
Added pool_params::connection_executor

close #350
2024-10-03 06:28:43 +02:00
Anarthal (Rubén Pérez) a4a40d8b90 async_get_connection now waits if the pool is not running
close #356
2024-09-30 21:38:30 +02:00
Anarthal (Rubén Pérez) e72b4906af Removed connection_pool::async_get_connection timeout overloads
Please use asio::cancel_after, instead.
Replaced client_errc::timeout, client_errc::cancelled by
    client_errc::no_connection_available, client_errc::pool_cancelled
async_get_connection no longer uses the last connect error code as failure error code,
    but embeds this info in the output diagnostics

close #349
2024-09-26 08:30:52 +02:00
Anarthal (Rubén Pérez) a84b774bef Per-operation cancellation for connection_pool
close #197
2024-09-21 21:10:31 +02:00
Anarthal (Rubén Pérez) 761d25bcdd Removed gcc-11 PFR warning suppression
As per https://github.com/boostorg/pfr/issues/166
2024-09-17 18:32:01 +02:00
Anarthal (Rubén Pérez) 0f843cd963 Refactored connection_pool unit tests
Removed IoTraits
Removed mock_timer_service
Simplified connection_pool_impl unit tests
2024-09-16 17:32:41 +02:00
Anarthal (Rubén Pérez) 1f79e5ce3f connection_pool thread-safety is now more robust
Thread-safety is now achieved using pool_params::thread_safe.
Removed pool_executor_params::thread_safe
Unsafe pools now use the standard Asio semantics
Safe pools are now safe even if the handlers' associated executors point
    to a context different from the pool's context

close #268
2024-09-14 13:06:54 +02:00
Anarthal (Rubén Pérez) 4a1604d685 Remove incorrect noexcept from field_view ctor
close #340
2024-09-13 22:51:01 +02:00
Anarthal (Rubén Pérez) 6d08247bab Migrate docs to pydocca
Improved reference docs linkage and fixed several formatting issues
Removed obsolete performance warning about close_statement

close #334
2024-09-06 16:38:38 +02:00
Anarthal (Rubén Pérez) 00bc81260c Added LCOV_EXCL_LINE to unreachable lines
close #227
2024-08-13 10:49:38 +02:00
Anarthal (Rubén Pérez) 95a9aa1068 Added with_diagnostics completion token
Made with_diagnostics(deferred) the default token for any_connection and
connection_pool.
throw_on_error is now marked as legacy.

close #329 
close #296
2024-08-13 10:48:49 +02:00
Anarthal (Rubén Pérez) 36dc47693e Async ops now support cancel_after and similar tokens
All initiations have now an associated executor.

close #330
2024-08-08 18:46:34 +02:00
Anarthal (Rubén Pérez) a20fc3e5ea Added with_params
close #218
2024-08-01 12:59:56 +02:00
Anarthal (Rubén Pérez) f76e17c37b Using an unconnected any_connection no longer crashes
Refactored `variant_stream` and added tests

close #230 
close #321
2024-07-29 13:37:01 +02:00
Anarthal (Rubén Pérez) b0c2639dbb Writes exceeding max buffer size no longer resize the buffer before failing
close #297
2024-07-26 11:46:32 +02:00
Anarthal (Rubén Pérez) a8c992dd95 as_netresult completion token for tests
Restructured handshake integration tests
Removed er_connection infrastructure
Reworked network_result
Greatly simplified integration tests
2024-07-23 18:27:30 +02:00
Anarthal (Rubén Pérez) 0060494170 Refactored connection_impl to allow diagnostics-aware tokens
All async_initiate's in the library are now uniformly called with a diagnostics* as 1st argument
2024-07-15 17:57:11 +02:00
Anarthal (Rubén Pérez) 6c48d6c6a6 Boost 1.86 new server error codes
close #304
2024-07-08 10:57:48 +02:00
Anarthal (Rubén Pérez) eb4cea7fcb Disabled Naggle's algorithm in any_connection
Fixes a performance issue with pipelines only containing close statement
stages.

close #277
2024-07-02 18:35:03 +02:00
Anarthal (Rubén Pérez) 0944b2af77 Added a max limit to any_connection buffer size
any_connection max buffer size is now 64MB
Renamed any_connection_params::initial_read_buffer_size to initial_buffer_size
Renamed pool_params::initial_read_buffer_size to initial_buffer_size

close #278
2024-06-30 15:49:27 +02:00