Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:41

0001 //
0002 // Copyright (c) 2019-2023 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 
0008 #ifndef BOOST_MYSQL_IMPL_INTERNAL_PROTOCOL_CONSTANTS_HPP
0009 #define BOOST_MYSQL_IMPL_INTERNAL_PROTOCOL_CONSTANTS_HPP
0010 
0011 #include <cstddef>
0012 #include <cstdint>
0013 
0014 namespace boost {
0015 namespace mysql {
0016 namespace detail {
0017 
0018 constexpr std::size_t MAX_PACKET_SIZE = 0xffffff;
0019 constexpr std::size_t HEADER_SIZE = 4;
0020 
0021 // The binary collation number, used to distinguish blobs from strings
0022 constexpr std::uint16_t binary_collation = 63;
0023 
0024 // Prepared statements
0025 namespace cursor_types {
0026 
0027 constexpr std::uint8_t no_cursor = 0;
0028 constexpr std::uint8_t read_only = 1;
0029 constexpr std::uint8_t for_update = 2;
0030 constexpr std::uint8_t scrollable = 4;
0031 
0032 }  // namespace cursor_types
0033 
0034 // Binary protocol (de)serialization constants
0035 namespace binc {
0036 
0037 constexpr std::size_t length_sz = 1;  // length byte, for date, datetime and time
0038 constexpr std::size_t year_sz = 2;
0039 constexpr std::size_t month_sz = 1;
0040 constexpr std::size_t date_day_sz = 1;
0041 constexpr std::size_t time_days_sz = 4;
0042 constexpr std::size_t hours_sz = 1;
0043 constexpr std::size_t mins_sz = 1;
0044 constexpr std::size_t secs_sz = 1;
0045 constexpr std::size_t micros_sz = 4;
0046 constexpr std::size_t time_sign_sz = 1;
0047 
0048 constexpr std::size_t date_sz = year_sz + month_sz + date_day_sz;  // does not include length
0049 
0050 constexpr std::size_t datetime_d_sz = date_sz;
0051 constexpr std::size_t datetime_dhms_sz = datetime_d_sz + hours_sz + mins_sz + secs_sz;
0052 constexpr std::size_t datetime_dhmsu_sz = datetime_dhms_sz + micros_sz;
0053 
0054 constexpr std::size_t time_dhms_sz = time_sign_sz + time_days_sz + hours_sz + mins_sz + secs_sz;
0055 constexpr std::size_t time_dhmsu_sz = time_dhms_sz + micros_sz;
0056 
0057 constexpr std::size_t time_max_days = 34;  // equivalent to the 839 hours, in the broken format
0058 
0059 }  // namespace binc
0060 
0061 }  // namespace detail
0062 }  // namespace mysql
0063 }  // namespace boost
0064 
0065 #endif