mirror of
https://github.com/boostorg/mysql.git
synced 2025-05-12 14:11:41 +00:00
Boostification, part 2
Fully migrated Linux and Windows jobs to Drone Fixed time-zone related issue in integ tests Support for MSVC 14.1 Support for latest docca version Recover codecov support Test to verify cmake find_package for a b2-generated distribution Resilience against openssl not being found in Windows
This commit is contained in:
parent
f662df3635
commit
bf4071f370
@ -12,3 +12,4 @@ compile_commands.json
|
|||||||
.cache/
|
.cache/
|
||||||
doc/
|
doc/
|
||||||
include/
|
include/
|
||||||
|
__build*__/
|
||||||
|
255
.drone.star
255
.drone.star
@ -5,32 +5,231 @@
|
|||||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
#
|
#
|
||||||
|
|
||||||
def main(ctx):
|
_triggers = { "branch": [ "master", "develop", "drone*", "bugfix/*", "feature/*", "fix/*", "pr/*" ] }
|
||||||
return [
|
_container_sha = 'f2ac4ad7d4038c604bad2a2c66893c5c966b869a'
|
||||||
windows_cxx("MSVC 14.1", "", image="cppalliance/dronevs2017", buildtype="b2", buildscript="drone", environment={
|
|
||||||
"B2_TOOLSET": "msvc-14.1",
|
|
||||||
"B2_CXXSTD": "11,14,17",
|
def _image(name):
|
||||||
"B2_VARIANT": "release",
|
return 'ghcr.io/anarthal-containers/{}:{}'.format(name, _container_sha)
|
||||||
"B2_ADDRESS_MODEL": "64"
|
|
||||||
}),
|
|
||||||
windows_cxx("MSVC 14.2", "", image="cppalliance/dronevs2019", buildtype="b2", buildscript="drone", environment={
|
def _b2_command(source_dir, toolset, cxxstd, variant, stdlib='native', address_model='64', server_host='localhost'):
|
||||||
"B2_TOOLSET": "msvc-14.2",
|
return 'python tools/ci.py ' + \
|
||||||
"B2_CXXSTD": "14,17",
|
'--build-kind=b2 ' + \
|
||||||
"B2_VARIANT": "release",
|
'--source-dir="{}" '.format(source_dir) + \
|
||||||
"B2_ADDRESS_MODEL": "64"
|
'--toolset={} '.format(toolset) + \
|
||||||
}),
|
'--cxxstd={} '.format(cxxstd) + \
|
||||||
windows_cxx("MSVC 14.3", "", image="cppalliance/dronevs2022", buildtype="b2", buildscript="drone", environment={
|
'--variant={} '.format(variant) + \
|
||||||
"B2_TOOLSET": "msvc-14.3",
|
'--stdlib={} '.format(stdlib) + \
|
||||||
"B2_CXXSTD": "17,20",
|
'--address-model={} '.format(address_model) + \
|
||||||
"B2_VARIANT": "debug,release",
|
'--server-host={} '.format(server_host)
|
||||||
"B2_ADDRESS_MODEL": "64"
|
|
||||||
}),
|
|
||||||
windows_cxx("MSVC 14.3, 32-bit", "", image="cppalliance/dronevs2022", buildtype="b2", buildscript="drone", environment={
|
def _cmake_command(source_dir, build_shared_libs=0, valgrind=0, coverage=0, generator='Ninja', db='mysql8', server_host='localhost'):
|
||||||
"B2_TOOLSET": "msvc-14.3",
|
return 'python tools/ci.py ' + \
|
||||||
"B2_CXXSTD": "20",
|
'--build-kind=cmake ' + \
|
||||||
"B2_VARIANT": "debug,release",
|
'--generator="{}" '.format(generator) + \
|
||||||
"B2_ADDRESS_MODEL": "32"
|
'--source-dir="{}" '.format(source_dir) + \
|
||||||
})
|
'--build-shared-libs={} '.format(build_shared_libs) + \
|
||||||
]
|
'--valgrind={} '.format(valgrind) + \
|
||||||
|
'--coverage={} '.format(coverage) + \
|
||||||
|
'--is-mysql8={} '.format(1 if db == 'mysql8' else 0) + \
|
||||||
|
'--server-host={} '.format(server_host)
|
||||||
|
|
||||||
|
|
||||||
|
def _linux_pipeline(name, image, command, db):
|
||||||
|
return {
|
||||||
|
"name": name,
|
||||||
|
"kind": "pipeline",
|
||||||
|
"type": "docker",
|
||||||
|
"trigger": _triggers,
|
||||||
|
"platform": {
|
||||||
|
"os": "linux",
|
||||||
|
"arch": "amd64"
|
||||||
|
},
|
||||||
|
"clone": {
|
||||||
|
"retries": 5
|
||||||
|
},
|
||||||
|
"node": {},
|
||||||
|
"steps": [{
|
||||||
|
"name": "Everything",
|
||||||
|
"image": image,
|
||||||
|
"pull": "if-not-exists",
|
||||||
|
"volumes": [{
|
||||||
|
"name": "mysql-socket",
|
||||||
|
"path": "/var/run/mysqld"
|
||||||
|
}],
|
||||||
|
"commands": [command],
|
||||||
|
"environment": {
|
||||||
|
"CODECOV_TOKEN": {
|
||||||
|
"from_secret": "CODECOV_TOKEN"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
"services": [{
|
||||||
|
"name": "mysql",
|
||||||
|
"image": _image(db),
|
||||||
|
"volumes": [{
|
||||||
|
"name": "mysql-socket",
|
||||||
|
"path": "/var/run/mysqld"
|
||||||
|
}]
|
||||||
|
}],
|
||||||
|
"volumes": [{
|
||||||
|
"name": "mysql-socket",
|
||||||
|
"temp": {}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _windows_pipeline(name, image, command):
|
||||||
|
return {
|
||||||
|
"name": name,
|
||||||
|
"kind": "pipeline",
|
||||||
|
"type": "docker",
|
||||||
|
"trigger": _triggers,
|
||||||
|
"platform": {
|
||||||
|
"os": "windows",
|
||||||
|
"arch": "amd64"
|
||||||
|
},
|
||||||
|
"clone": {
|
||||||
|
"retries": 5
|
||||||
|
},
|
||||||
|
"node": {},
|
||||||
|
"steps": [{
|
||||||
|
"name": "Everything",
|
||||||
|
"image": image,
|
||||||
|
"pull": "if-not-exists",
|
||||||
|
"commands": [command]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def linux_b2(
|
||||||
|
name,
|
||||||
|
image,
|
||||||
|
toolset,
|
||||||
|
cxxstd,
|
||||||
|
variant='debug,release',
|
||||||
|
stdlib='native'
|
||||||
|
):
|
||||||
|
command = _b2_command(
|
||||||
|
source_dir='$(pwd)',
|
||||||
|
toolset=toolset,
|
||||||
|
cxxstd=cxxstd,
|
||||||
|
variant=variant,
|
||||||
|
stdlib=stdlib,
|
||||||
|
server_host='mysql'
|
||||||
|
)
|
||||||
|
return _linux_pipeline(name, image, command, db='mysql8')
|
||||||
|
|
||||||
|
|
||||||
|
def windows_b2(
|
||||||
|
name,
|
||||||
|
image,
|
||||||
|
toolset,
|
||||||
|
cxxstd,
|
||||||
|
variant,
|
||||||
|
address_model = '64'
|
||||||
|
):
|
||||||
|
command = _b2_command(
|
||||||
|
source_dir='$Env:DRONE_WORKSPACE',
|
||||||
|
toolset=toolset,
|
||||||
|
cxxstd=cxxstd,
|
||||||
|
variant=variant,
|
||||||
|
address_model=address_model,
|
||||||
|
server_host='localhost'
|
||||||
|
)
|
||||||
|
return _windows_pipeline(name, image, command)
|
||||||
|
|
||||||
|
|
||||||
|
def linux_cmake(
|
||||||
|
name,
|
||||||
|
image,
|
||||||
|
build_shared_libs=0,
|
||||||
|
valgrind=0,
|
||||||
|
coverage=0,
|
||||||
|
db='mysql8'
|
||||||
|
):
|
||||||
|
command = _cmake_command(
|
||||||
|
source_dir='$(pwd)',
|
||||||
|
build_shared_libs=build_shared_libs,
|
||||||
|
valgrind=valgrind,
|
||||||
|
coverage=coverage,
|
||||||
|
db=db,
|
||||||
|
server_host='mysql'
|
||||||
|
)
|
||||||
|
return _linux_pipeline(name, image, command, db=db)
|
||||||
|
|
||||||
|
|
||||||
|
def windows_cmake(
|
||||||
|
name,
|
||||||
|
build_shared_libs=0
|
||||||
|
):
|
||||||
|
command = _cmake_command(
|
||||||
|
source_dir='$Env:DRONE_WORKSPACE',
|
||||||
|
build_shared_libs=build_shared_libs,
|
||||||
|
generator='Visual Studio 17 2022',
|
||||||
|
db='mysql8',
|
||||||
|
server_host='localhost'
|
||||||
|
)
|
||||||
|
return _windows_pipeline(name, _image('build-msvc14_3'), command)
|
||||||
|
|
||||||
|
|
||||||
|
def docs():
|
||||||
|
return {
|
||||||
|
"name": "Linux docs",
|
||||||
|
"kind": "pipeline",
|
||||||
|
"type": "docker",
|
||||||
|
"trigger": _triggers,
|
||||||
|
"platform": {
|
||||||
|
"os": "linux",
|
||||||
|
"arch": "amd64"
|
||||||
|
},
|
||||||
|
"clone": {
|
||||||
|
"retries": 5
|
||||||
|
},
|
||||||
|
"node": {},
|
||||||
|
"steps": [{
|
||||||
|
"name": "Everything",
|
||||||
|
"image": _image('build-docs'),
|
||||||
|
"pull": "if-not-exists",
|
||||||
|
"commands": [
|
||||||
|
'python tools/ci.py --build-kind=docs --source-dir=$(pwd)'
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def main(ctx):
|
||||||
|
return [
|
||||||
|
# CMake Linux
|
||||||
|
linux_cmake('Linux CMake valgrind', _image('build-gcc11'), valgrind=1, build_shared_libs=0),
|
||||||
|
linux_cmake('Linux CMake coverage', _image('build-gcc11'), coverage=1, build_shared_libs=0),
|
||||||
|
linux_cmake('Linux CMake MySQL 5.x', _image('build-clang14'), db='mysql5', build_shared_libs=0),
|
||||||
|
linux_cmake('Linux CMake MariaDB', _image('build-clang14'), db='mariadb', build_shared_libs=1),
|
||||||
|
|
||||||
|
# CMake Windows
|
||||||
|
windows_cmake('Windows CMake static', build_shared_libs=0),
|
||||||
|
windows_cmake('Windows CMake shared', build_shared_libs=1),
|
||||||
|
|
||||||
|
# B2 Linux
|
||||||
|
linux_b2('Linux B2 clang-3.6', _image('build-clang3_6'), toolset='clang-3.6', cxxstd='14'),
|
||||||
|
linux_b2('Linux B2 clang-7', _image('build-clang7'), toolset='clang-7', cxxstd='17'),
|
||||||
|
linux_b2('Linux B2 clang-11', _image('build-clang11'), toolset='clang-11', cxxstd='20'),
|
||||||
|
linux_b2('Linux B2 clang-14', _image('build-clang14'), toolset='clang-14', cxxstd='11,14,17,20', variant='release'),
|
||||||
|
linux_b2('Linux B2 clang-libc++', _image('build-clang14'), toolset='clang-14', cxxstd='20', stdlib='libc++'),
|
||||||
|
linux_b2('Linux B2 gcc-5', _image('build-gcc5'), toolset='gcc-5', cxxstd='11'), # gcc-5 C++14 doesn't like my constexpr field_view
|
||||||
|
linux_b2('Linux B2 gcc-6', _image('build-gcc6'), toolset='gcc-6', cxxstd='14,17'),
|
||||||
|
linux_b2('Linux B2 gcc-10', _image('build-gcc10'), toolset='gcc-10', cxxstd='20'),
|
||||||
|
linux_b2('Linux B2 gcc-11', _image('build-gcc11'), toolset='gcc-11', cxxstd='11,14,17,20', variant='release'),
|
||||||
|
|
||||||
|
# B2 Windows
|
||||||
|
windows_b2('Windows B2 msvc14.1 32-bit', _image('build-msvc14_1'), toolset='msvc-14.1', cxxstd='11,14,17', variant='release', address_model='32'),
|
||||||
|
windows_b2('Windows B2 msvc14.1 64-bit', _image('build-msvc14_1'), toolset='msvc-14.1', cxxstd='14,17', variant='release', address_model='64'),
|
||||||
|
windows_b2('Windows B2 msvc14.2', _image('build-msvc14_2'), toolset='msvc-14.2', cxxstd='14,17', variant='release', address_model='64'),
|
||||||
|
windows_b2('Windows B2 msvc14.3', _image('build-msvc14_3'), toolset='msvc-14.3', cxxstd='17,20', variant='debug,release', address_model='64'),
|
||||||
|
|
||||||
|
# Docs
|
||||||
|
docs()
|
||||||
|
]
|
||||||
|
|
||||||
load("@boost_ci//ci/drone/:functions.star", "windows_cxx")
|
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
REM
|
|
||||||
REM Copyright (c) 2019-2022 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
|
|
||||||
REM
|
|
||||||
REM Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
REM file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
REM
|
|
||||||
|
|
||||||
setlocal enabledelayedexpansion
|
|
||||||
|
|
||||||
if "%DRONE_JOB_BUILDTYPE%" == "b2" (
|
|
||||||
call tools\build_windows_b2.bat
|
|
||||||
) else if "%DRONE_JOB_BUILDTYPE%" == "cmake" (
|
|
||||||
call tools\build_windows_cmake.bat
|
|
||||||
) else (
|
|
||||||
echo "Unknown DRONE_JOB_BUILDTYPE: %DRONE_JOB_BUILDTYPE%"
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
99
.github/workflows/build-code.yml
vendored
99
.github/workflows/build-code.yml
vendored
@ -9,101 +9,22 @@ name: Build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches-ignore: [gh-pages, boostification]
|
branches-ignore: [gh-pages]
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linux-cmake:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- { name: valgrind, image: build-gcc11, valgrind: 1, coverage: 0, db: mysql8, build_shared: OFF }
|
|
||||||
- { name: coverage, image: build-gcc11, valgrind: 0, coverage: 1, db: mysql8, build_shared: OFF }
|
|
||||||
- { name: mysql5, image: build-clang14, valgrind: 0, coverage: 0, db: mysql5, build_shared: OFF }
|
|
||||||
- { name: mariadb, image: build-clang14, valgrind: 0, coverage: 0, db: mariadb, build_shared: ON }
|
|
||||||
container:
|
|
||||||
image: ghcr.io/anarthal-containers/${{ matrix.image }}:latest
|
|
||||||
volumes:
|
|
||||||
- /var/run/mysqld:/var/run/mysqld
|
|
||||||
services:
|
|
||||||
mysql:
|
|
||||||
image: ghcr.io/anarthal-containers/${{ matrix.db }}:latest
|
|
||||||
ports:
|
|
||||||
- 3306:3306
|
|
||||||
volumes:
|
|
||||||
- /var/run/mysqld:/var/run/mysqld
|
|
||||||
options: >-
|
|
||||||
--health-cmd "mysqladmin ping -h localhost"
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
BOOST_MYSQL_SERVER_HOST: mysql # This should match the service name in this yml
|
|
||||||
USE_VALGRIND: ${{ matrix.valgrind }}
|
|
||||||
USE_COVERAGE: ${{ matrix.coverage }}
|
|
||||||
BOOST_MYSQL_DATABASE: ${{ matrix.db }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Build and test
|
|
||||||
run: bash tools/build_unix_cmake.sh
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
linux-b2:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- { name: clang-3.6, image: build-clang3_6, toolset: clang-3.6, stdlib: native, cxxstd: '14' }
|
|
||||||
- { name: clang-7, image: build-clang7, toolset: clang-7, stdlib: native, cxxstd: '17' }
|
|
||||||
- { name: clang-11, image: build-clang11, toolset: clang-11, stdlib: native, cxxstd: '20' }
|
|
||||||
- { name: clang-14, image: build-clang14, toolset: clang-14, stdlib: native, cxxstd: '11,14,17,20' }
|
|
||||||
- { name: clang-libc++, image: build-clang14, toolset: clang-14, stdlib: libc++, cxxstd: '20' }
|
|
||||||
- { name: gcc-5, image: build-gcc5, toolset: gcc-5, stdlib: native, cxxstd: '11' } # gcc-5 C++14 doesn't like my constexpr field_view
|
|
||||||
- { name: gcc-6, image: build-gcc6, toolset: gcc-6, stdlib: native, cxxstd: '14,17' }
|
|
||||||
- { name: gcc-10, image: build-gcc10, toolset: gcc-10, stdlib: native, cxxstd: '20' }
|
|
||||||
- { name: gcc-11, image: build-gcc11, toolset: gcc-11, stdlib: native, cxxstd: '11,14,17,20' }
|
|
||||||
container:
|
|
||||||
image: ghcr.io/anarthal-containers/${{ matrix.image }}:latest
|
|
||||||
volumes:
|
|
||||||
- /var/run/mysqld:/var/run/mysqld
|
|
||||||
services:
|
|
||||||
mysql:
|
|
||||||
image: ghcr.io/anarthal-containers/mysql8:latest
|
|
||||||
ports:
|
|
||||||
- 3306:3306
|
|
||||||
volumes:
|
|
||||||
- /var/run/mysqld:/var/run/mysqld
|
|
||||||
options: >-
|
|
||||||
--health-cmd "mysqladmin ping -h localhost"
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
BOOST_MYSQL_SERVER_HOST: mysql # This should match the service name in this yml
|
|
||||||
B2_TOOLSET: ${{ matrix.toolset }}
|
|
||||||
B2_VARIANT: debug,release
|
|
||||||
B2_CXXSTD: ${{ matrix.cxxstd }}
|
|
||||||
B2_STDLIB: ${{ matrix.stdlib }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- run: bash tools/build_unix_b2.sh
|
|
||||||
|
|
||||||
|
|
||||||
osx:
|
osx:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
env:
|
env:
|
||||||
BOOST_MYSQL_SERVER_HOST: 127.0.0.1 # Force use IPv4
|
|
||||||
OPENSSL_ROOT: /usr/local/opt/openssl
|
OPENSSL_ROOT: /usr/local/opt/openssl
|
||||||
B2_TOOLSET: clang
|
|
||||||
B2_VARIANT: debug,release
|
|
||||||
B2_CXXSTD: 17
|
|
||||||
B2_STDLIB: native
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- run: bash tools/setup_db_osx.sh
|
- run: bash tools/setup_db_osx.sh
|
||||||
- run: bash tools/build_unix_b2.sh
|
- run: |
|
||||||
|
python3 tools/ci.py \
|
||||||
|
--build-kind=b2 \
|
||||||
|
--source-dir=$(pwd) \
|
||||||
|
--toolset=clang \
|
||||||
|
--cxxstd=20 \
|
||||||
|
--variant=debug,release \
|
||||||
|
--server-host=127.0.0.1 # Force use IPv4
|
||||||
|
31
.github/workflows/build-docs.yml
vendored
31
.github/workflows/build-docs.yml
vendored
@ -1,31 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2019-2022 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)
|
|
||||||
#
|
|
||||||
|
|
||||||
name: Build docs
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: ghcr.io/anarthal-containers/build-docs:latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Build docs
|
|
||||||
run: bash -e -x tools/build_docs.sh
|
|
||||||
|
|
||||||
- name: Deploy to GitHub pages
|
|
||||||
uses: JamesIves/github-pages-deploy-action@v4
|
|
||||||
with:
|
|
||||||
branch: gh-pages
|
|
||||||
folder: /opt/boost/libs/mysql/doc/html
|
|
24
Jamfile
24
Jamfile
@ -36,21 +36,30 @@ if [ os.name ] = NT
|
|||||||
echo "OpenSSL > 1.1.0. Including libssl" ;
|
echo "OpenSSL > 1.1.0. Including libssl" ;
|
||||||
lib ssl : : <target-os>windows <name>libssl ;
|
lib ssl : : <target-os>windows <name>libssl ;
|
||||||
}
|
}
|
||||||
|
else if [ path.exists $(OPENSSL_ROOT)/lib/ssleay32.lib ]
|
||||||
|
{
|
||||||
|
echo "OpenSSL < 1.1.0. Including ssleay32" ;
|
||||||
|
lib ssl : : <target-os>windows <name>ssleay32 ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lib ssl : : <link>shared ;
|
||||||
|
}
|
||||||
|
|
||||||
if [ path.exists $(OPENSSL_ROOT)/lib/libcrypto.lib ]
|
if [ path.exists $(OPENSSL_ROOT)/lib/libcrypto.lib ]
|
||||||
{
|
{
|
||||||
echo "OpenSSL > 1.1.0. Including libcrypto" ;
|
echo "OpenSSL > 1.1.0. Including libcrypto" ;
|
||||||
lib crypto : : <target-os>windows <name>libcrypto ;
|
lib crypto : : <target-os>windows <name>libcrypto ;
|
||||||
}
|
}
|
||||||
if [ path.exists $(OPENSSL_ROOT)/lib/ssleay32.lib ]
|
else if [ path.exists $(OPENSSL_ROOT)/lib/libeay32.lib ]
|
||||||
{
|
|
||||||
echo "OpenSSL < 1.1.0. Including ssleay32" ;
|
|
||||||
lib ssl : : <target-os>windows <name>ssleay32 ;
|
|
||||||
}
|
|
||||||
if [ path.exists $(OPENSSL_ROOT)/lib/libeay32.lib ]
|
|
||||||
{
|
{
|
||||||
echo "OpenSSL < 1.1.0. Including libeay32" ;
|
echo "OpenSSL < 1.1.0. Including libeay32" ;
|
||||||
lib crypto : : <target-os>windows <name>libeay32 ;
|
lib crypto : : <target-os>windows <name>libeay32 ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lib crypto : : <link>shared ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -109,6 +118,3 @@ lib asio
|
|||||||
;
|
;
|
||||||
|
|
||||||
alias mysql : asio ;
|
alias mysql : asio ;
|
||||||
|
|
||||||
build-project example ;
|
|
||||||
build-project test ;
|
|
||||||
|
56
README.md
56
README.md
@ -1,8 +1,9 @@
|
|||||||
# \<Proposed for\> Boost.MySQL (not yet in Boost)
|
# Boost.MySQL (to be released in Boost 1.82)
|
||||||
|
|
||||||
Linux/OSX | Windows | Coverage | Documentation
|
Branch | Windows/Linux Build | OSX build | Coverage
|
||||||
-----------|---------|----------|--------------
|
-------|---------------------|-----------|---------
|
||||||
[](https://github.com/anarthal/mysql) | [](https://ci.appveyor.com/project/anarthal/mysql/branch/master) | [](https://codecov.io/gh/anarthal/mysql-asio/branch/master) | [](https://github.com/anarthal/mysql/actions/workflows/build-docs.yml)
|
[`master`](https://github.com/boostorg/mysql/tree/master) | [](https://drone.cpp.al/boostorg/mysql) | [](https://github.com/boostorg/mysql) | [](https://codecov.io/gh/boostorg/mysql/branch/master)
|
||||||
|
[`develop`](https://github.com/boostorg/mysql/tree/develop) | [](https://drone.cpp.al/boostorg/mysql) | [](https://github.com/boostorg/mysql) | [](https://codecov.io/gh/boostorg/mysql/branch/develop)
|
||||||
|
|
||||||
Boost.Mysql is a C++11 client for the MySQL database server, based on Boost.Asio.
|
Boost.Mysql is a C++11 client for the MySQL database server, based on Boost.Asio.
|
||||||
This library is in the process of being proposed for Boost.
|
This library is in the process of being proposed for Boost.
|
||||||
@ -18,34 +19,43 @@ Documentation and examples are [here](https://anarthal.github.io/mysql/index.htm
|
|||||||
- It is written in C++11 and takes advantage of it.
|
- It is written in C++11 and takes advantage of it.
|
||||||
- It is header only.
|
- It is header only.
|
||||||
|
|
||||||
## Building
|
## Using the library
|
||||||
|
|
||||||
As this is a header-only library, you do not need to build it. However, as it
|
To use this library, you need:
|
||||||
has a bunch of dependencies, we suggest you use CMake to pull them in as you build
|
|
||||||
your application.
|
|
||||||
|
|
||||||
Download Boost.MySQL and make it available to your CMake script (we suggest you use
|
- A C++11 capable compiler.
|
||||||
CMake's FetchContent module to do this), and then call add_subdirectory() on the
|
- Boost 1.82 or higher.
|
||||||
Boost.MySQL root directory. This will look for all the required dependencies.
|
|
||||||
|
|
||||||
Finally, link your target against the **Boost::mysql** interface library, and you will be done!
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
- C++11 capable compiler (tested with gcc 5 to 11, clang 3.6 to 13 and MSVC 19.25).
|
|
||||||
- Boost.
|
|
||||||
- OpenSSL.
|
- OpenSSL.
|
||||||
- CMake 3.13.0 or higher, if using CMake to build against the library (this is the preferred way).
|
- CMake 3.13.0 or higher, if using CMake to build against the library (this is the preferred way).
|
||||||
- Tested with MySQL v5.7.29, MySQL v8.0.19, MariaDB v10.3 and MariaDB v10.5.
|
|
||||||
|
The library is header-only, but it depends on other Boost header-only libraries and on OpenSSL.
|
||||||
|
To use the library, install Boost the way you would normally do (e.g. via `b2 install`), and create
|
||||||
|
a `CMakeLists.txt` like this (replace `main` by your executable name and `main.cpp` by your list of source files):
|
||||||
|
|
||||||
|
https://github.com/boostorg/mysql/blob/develop/test/cmake_b2_test/CMakeLists.txt#L10-L19
|
||||||
|
|
||||||
|
## Tested with
|
||||||
|
|
||||||
|
Boost.MySQL has been tested with the following compilers:
|
||||||
|
- gcc 5 to 11.
|
||||||
|
- clang 3.6 to 14.
|
||||||
|
- msvc 14.1, 14.2 and 14.3.
|
||||||
|
|
||||||
|
And with the following databases:
|
||||||
|
- MySQL v5.7.29
|
||||||
|
- MySQL v8.0.20
|
||||||
|
- MariaDB v10.3
|
||||||
|
|
||||||
## Versioning and upgrading
|
## Versioning and upgrading
|
||||||
|
|
||||||
The current latest version is 0.1.0. Until Boost.Mysql passes its Boost formal review,
|
The current latest version is 0.2.0. Boost.Mysql has officially passed its formal review
|
||||||
the library might get non-backwards-compatible changes between minor versions.
|
and is now in the process of being integrated into Boost. As part of this process, the library
|
||||||
Sorry for that! Any breaking change will be listed here, together with a rationale and
|
will get breaking changes that were deemed required by the formal review. The library will get
|
||||||
|
its first stable release when Boost 1.82 is released (scheduled for early 2023).
|
||||||
|
Any breaking change from v0.2.0 will be listed here, together with a rationale and
|
||||||
an upgrade guide. If you encounter any trouble, please open an issue in the repository.
|
an upgrade guide. If you encounter any trouble, please open an issue in the repository.
|
||||||
|
|
||||||
### Breaking changes from 0.0.x to 0.1.x
|
### Breaking changes from 0.0.x to 0.2.x
|
||||||
|
|
||||||
This version has changed the way SSL is handled by the library to
|
This version has changed the way SSL is handled by the library to
|
||||||
a more standard approach, similar to what Boost.Beast and Boost.Asio use.
|
a more standard approach, similar to what Boost.Beast and Boost.Asio use.
|
||||||
|
301
doc/Jamfile
301
doc/Jamfile
@ -5,271 +5,79 @@
|
|||||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
#
|
#
|
||||||
|
|
||||||
project /boost/mysql/doc ;
|
|
||||||
|
|
||||||
import os ;
|
project mysql/doc ;
|
||||||
import path ;
|
|
||||||
import boostbook ;
|
import boostbook ;
|
||||||
import quickbook ;
|
import os ;
|
||||||
import xsltproc ;
|
import ../../../tools/docca/docca.jam ;
|
||||||
import doxygen ;
|
|
||||||
import modules ;
|
|
||||||
import saxonhe ;
|
|
||||||
import common ;
|
|
||||||
|
|
||||||
local BOOST_ROOT = [ os.environ BOOST_ROOT ] ; #../../.. ;
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
docca.reference reference.qbk
|
||||||
#
|
|
||||||
# Build the list of header files that Doxygen will scan. We need
|
|
||||||
# this list to inform the build system of the dependencies so the
|
|
||||||
# docs can be rebuild if any of the header files change.
|
|
||||||
#
|
|
||||||
|
|
||||||
local sources = [ path.glob-tree ../include/boost/mysql : *.hpp : detail impl ] ;
|
|
||||||
|
|
||||||
# Get the configured paths to doxygen and xsltproc
|
|
||||||
|
|
||||||
.doxygen = [ doxygen.name ] ;
|
|
||||||
.doxygen ?= doxygen ;
|
|
||||||
|
|
||||||
.xsltproc = [ xsltproc.name ] ;
|
|
||||||
.xsltproc ?= xsltproc ;
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Invoke Doxygen to process the header files and produce the XML
|
|
||||||
# containing the description of the C++ declarations and extracted
|
|
||||||
# Javadoc comments.
|
|
||||||
#
|
|
||||||
make index.xml
|
|
||||||
:
|
:
|
||||||
./Doxyfile
|
xsl/custom-overrides.xsl
|
||||||
|
[ glob-tree-ex ../include/boost/mysql : *.hpp : detail impl ]
|
||||||
:
|
:
|
||||||
@make_doxygen_xml
|
<doxygen:param>PROJECT_NAME=MySQL
|
||||||
:
|
<doxygen:param>PROJECT_BRIEF="C++ MySQL Client Library"
|
||||||
<dependency>$(sources)
|
<doxygen:param>DISTRIBUTE_GROUP_DOC=YES
|
||||||
|
<doxygen:param>ENABLE_PREPROCESSING=YES
|
||||||
|
<doxygen:param>MACRO_EXPANSION=YES
|
||||||
|
<doxygen:param>EXPAND_ONLY_PREDEF=YES
|
||||||
|
<doxygen:param>SEARCH_INCLUDES=NO
|
||||||
|
<doxygen:param>"PREDEFINED=\\
|
||||||
|
BOOST_MYSQL_DOXYGEN \\
|
||||||
|
\"BOOST_ASIO_INITFN_RESULT_TYPE(t,a)=auto\" \\
|
||||||
|
\"BOOST_ASIO_COMPLETION_TOKEN_FOR(sig)=class\" \\
|
||||||
|
\"BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ct,sig)=auto\" \\
|
||||||
|
\"BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(ex)=\" \\
|
||||||
|
\"BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(ex)=\" \\
|
||||||
|
\"protected=private\" \\
|
||||||
|
\"BOOST_CXX14_CONSTEXPR=constexpr\" \\
|
||||||
|
\"BOOST_MYSQL_FIELD_LIKE_TUPLE=class\" \\
|
||||||
|
\"BOOST_MYSQL_FIELD_VIEW_FORWARD_ITERATOR=class\" \\
|
||||||
|
"
|
||||||
|
<doxygen:param>SKIP_FUNCTION_MACROS=NO
|
||||||
|
<doxygen:param>OUTPUT_LANGUAGE=English
|
||||||
|
<doxygen:param>ABBREVIATE_BRIEF=
|
||||||
|
<doxygen:param>INLINE_INHERITED_MEMB=YES
|
||||||
|
<doxygen:param>AUTOLINK_SUPPORT=NO
|
||||||
|
<doxygen:param>EXTRACT_ALL=NO
|
||||||
|
<doxygen:param>EXTRACT_PRIVATE=NO
|
||||||
|
<doxygen:param>EXTRACT_LOCAL_CLASSES=NO
|
||||||
|
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
|
||||||
|
<doxygen:param>HIDE_UNDOC_CLASSES=YES
|
||||||
|
<doxygen:param>HIDE_FRIEND_COMPOUNDS=YES
|
||||||
|
<doxygen:param>CASE_SENSE_NAMES=YES
|
||||||
|
<doxygen:param>SHOW_INCLUDE_FILES=NO
|
||||||
|
<doxygen:param>INLINE_INFO=NO
|
||||||
|
<doxygen:param>SORT_MEMBER_DOCS=NO
|
||||||
|
<doxygen:param>SORT_MEMBERS_CTORS_1ST=YES
|
||||||
|
<doxygen:param>SHOW_USED_FILES=NO
|
||||||
|
<doxygen:param>SHOW_FILES=NO
|
||||||
|
<doxygen:param>SHOW_NAMESPACES=NO
|
||||||
|
<doxygen:param>CLASS_DIAGRAMS=NO
|
||||||
;
|
;
|
||||||
|
|
||||||
rule make_doxygen_xml ( targets * : sources * : properties * )
|
|
||||||
{
|
|
||||||
LIB_DIR on $(targets) =
|
|
||||||
[ path.native [ path.parent [ path.root
|
|
||||||
[ on $(sources[1]) return $(SEARCH) ] [ path.pwd ] ] ] ] ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ os.name ] = NT
|
|
||||||
{
|
|
||||||
actions make_doxygen_xml
|
|
||||||
{
|
|
||||||
SET LIB_DIR=$(LIB_DIR)
|
|
||||||
SET XML_OUTPUT=$(1:D)
|
|
||||||
"$(.doxygen)" $(2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
actions make_doxygen_xml
|
|
||||||
{
|
|
||||||
export LIB_DIR=$(LIB_DIR)
|
|
||||||
export XML_OUTPUT=$(1:D)
|
|
||||||
"$(.doxygen)" $(2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Copy all the XSLT modules to the target directory.
|
|
||||||
#
|
|
||||||
# FIXME: Change this so we can just specify a directory,
|
|
||||||
# rather than every file individually.
|
|
||||||
#
|
|
||||||
# Also, somehow force dependencies in a general way
|
|
||||||
# such that the XSLT has to be executed again
|
|
||||||
# if any of the modules change. For example,
|
|
||||||
# if base-extract-xml-pages.xml changes, then
|
|
||||||
# an invocation of extract-xml-pages.xsl (which
|
|
||||||
# imports the former) must be run again.
|
|
||||||
#
|
|
||||||
path-constant docca : $(BOOST_ROOT)/tools/docca ;
|
|
||||||
make extract-xml-pages.xsl : $(docca)/include/docca/extract-xml-pages.xsl : @copy_script ;
|
|
||||||
make base-extract-xml-pages.xsl : $(docca)/include/docca/base-extract-xml-pages.xsl : @copy_script ;
|
|
||||||
make common.xsl : $(docca)/include/docca/common.xsl : @copy_script ;
|
|
||||||
make stage1.xsl : $(docca)/include/docca/stage1.xsl : @copy_script ;
|
|
||||||
make base-stage1.xsl : $(docca)/include/docca/base-stage1.xsl : @copy_script ;
|
|
||||||
make stage2.xsl : $(docca)/include/docca/stage2.xsl : @copy_script ;
|
|
||||||
# Workaround to prevent docca from escaping quickbook from Doxygen comments
|
|
||||||
make base-stage2.xsl : $(BOOST_ROOT)/libs/mysql/doc/docca-base-stage2-noescape.xsl : @copy_script ;
|
|
||||||
make assemble-quickbook.xsl : $(docca)/include/docca/assemble-quickbook.xsl : @copy_script ;
|
|
||||||
make emphasized-types.xsl : $(BOOST_ROOT)/libs/mysql/doc/xsl/emphasized-types.xsl : @copy_script ;
|
|
||||||
make base-config.xsl : $(docca)/include/docca/base-config.xsl : @copy_script ;
|
|
||||||
|
|
||||||
# Copy the project-specific config XSLT
|
|
||||||
make custom-overrides.xsl : xsl/custom-overrides.xsl : @copy_script ;
|
|
||||||
|
|
||||||
# Make a copy of the given file.
|
|
||||||
actions copy_script
|
|
||||||
{
|
|
||||||
cp $(2[1]) $(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# This is to initially create the directory as a side effect; I'm sure there's a better way...
|
|
||||||
make xml-pages/directory/placeholder : index.xml : @null_action ;
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Run index.xml through the first transformation stage
|
|
||||||
# (assembling and splitting the XML into page-specific files).
|
|
||||||
#
|
|
||||||
make xml-pages.xml
|
|
||||||
:
|
|
||||||
index.xml
|
|
||||||
extract-xml-pages.xsl
|
|
||||||
|
|
||||||
# Make bjam aware of additional dependencies
|
|
||||||
base-extract-xml-pages.xsl
|
|
||||||
base-config.xsl
|
|
||||||
custom-overrides.xsl
|
|
||||||
common.xsl
|
|
||||||
:
|
|
||||||
saxonhe.saxonhe
|
|
||||||
;
|
|
||||||
|
|
||||||
# This is just to make the directory eligible as a source
|
|
||||||
make xml-pages : index.xml : @null_action ;
|
|
||||||
|
|
||||||
# This is to initially create the directory as a side effect; I'm sure there's a better way...
|
|
||||||
make stage1/results/directory/placeholder : xml-pages.xml : @null_action ;
|
|
||||||
make stage2/results/directory/placeholder : xml-pages.xml : @null_action ;
|
|
||||||
|
|
||||||
# TODO: figure out why this (and the following stage) get built every time
|
|
||||||
make stage1/results
|
|
||||||
:
|
|
||||||
xml-pages
|
|
||||||
stage1.xsl
|
|
||||||
|
|
||||||
# additional dependencies
|
|
||||||
xml-pages.xml
|
|
||||||
base-stage1.xsl
|
|
||||||
base-config.xsl
|
|
||||||
custom-overrides.xsl
|
|
||||||
common.xsl
|
|
||||||
:
|
|
||||||
saxonhe.saxonhe_dir
|
|
||||||
;
|
|
||||||
|
|
||||||
make stage2/results
|
|
||||||
:
|
|
||||||
stage1/results
|
|
||||||
stage2.xsl
|
|
||||||
|
|
||||||
# additional dependencies
|
|
||||||
emphasized-types.xsl
|
|
||||||
base-stage2.xsl
|
|
||||||
base-config.xsl
|
|
||||||
custom-overrides.xsl
|
|
||||||
common.xsl
|
|
||||||
:
|
|
||||||
saxonhe.saxonhe_dir
|
|
||||||
;
|
|
||||||
|
|
||||||
make reference.qbk
|
|
||||||
:
|
|
||||||
xml-pages.xml
|
|
||||||
assemble-quickbook.xsl
|
|
||||||
|
|
||||||
# TODO: make this input to the XSLT somehow
|
|
||||||
# rather than relying on it being hard-coded
|
|
||||||
# in the XSLT (which it is!)
|
|
||||||
stage2/results
|
|
||||||
:
|
|
||||||
saxonhe.saxonhe
|
|
||||||
;
|
|
||||||
|
|
||||||
actions make_dir
|
|
||||||
{
|
|
||||||
mkdir $(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
make combine.xslt : index.xml : @null_action ;
|
|
||||||
|
|
||||||
actions touch_file
|
|
||||||
{
|
|
||||||
touch $(1) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
actions null_action
|
|
||||||
{
|
|
||||||
touch -c $(1) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
make reference.xml
|
|
||||||
:
|
|
||||||
combine.xslt
|
|
||||||
index.xml
|
|
||||||
:
|
|
||||||
@call-xsltproc
|
|
||||||
;
|
|
||||||
|
|
||||||
actions call-xsltproc
|
|
||||||
{
|
|
||||||
"$(.xsltproc)" $(2) > $(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
# We have to make a copy of reference.qbk and put it
|
|
||||||
# in a place where the static .qbk files can find it
|
|
||||||
install qbk : reference.qbk ;
|
|
||||||
|
|
||||||
# stylesheets and callouts are for out-of-tree docs on anarthal.github.io
|
|
||||||
install stylesheets
|
|
||||||
:
|
|
||||||
$(BOOST_ROOT)/doc/src/boostbook.css
|
|
||||||
:
|
|
||||||
<location>html/
|
|
||||||
;
|
|
||||||
|
|
||||||
explicit stylesheets ;
|
|
||||||
|
|
||||||
install callouts
|
|
||||||
:
|
|
||||||
[ glob $(BOOST_ROOT)/doc/src/images/callouts/*.png ]
|
|
||||||
:
|
|
||||||
<location>html/images/callouts
|
|
||||||
;
|
|
||||||
|
|
||||||
explicit callout ;
|
|
||||||
|
|
||||||
install images
|
install images
|
||||||
:
|
:
|
||||||
[ glob $(BOOST_ROOT)/doc/src/images/*.png images/*.svg ]
|
[ glob images/*.png images/*.svg ]
|
||||||
:
|
:
|
||||||
<location>html/mysql/images
|
<location>html/mysql/images
|
||||||
;
|
;
|
||||||
|
|
||||||
explicit images ;
|
explicit images ;
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Produce the Boost.Book XML from the QuickBook
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
xml mysql_doc
|
xml mysql_doc
|
||||||
:
|
:
|
||||||
qbk/00_main.qbk
|
qbk/00_main.qbk
|
||||||
:
|
:
|
||||||
<dependency>qbk
|
<dependency>reference.qbk
|
||||||
|
<dependency>images
|
||||||
;
|
;
|
||||||
|
|
||||||
explicit mysql_doc ;
|
explicit mysql_doc ;
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# HTML documentation for $(BOOST_ROOT)/doc/html
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
boostbook mysql
|
boostbook mysql
|
||||||
:
|
:
|
||||||
@ -279,25 +87,22 @@ boostbook mysql
|
|||||||
<xsl:param>"boost.root=https://www.boost.org/doc/libs/1_80_0"
|
<xsl:param>"boost.root=https://www.boost.org/doc/libs/1_80_0"
|
||||||
<xsl:param>boost.graphics.root=images/
|
<xsl:param>boost.graphics.root=images/
|
||||||
<xsl:param>nav.layout=none
|
<xsl:param>nav.layout=none
|
||||||
|
# <xsl:param>boost.root=../../../..
|
||||||
<xsl:param>chapter.autolabel=1
|
<xsl:param>chapter.autolabel=1
|
||||||
<xsl:param>chunk.section.depth=8 # Depth to which sections should be chunked
|
<xsl:param>chunk.section.depth=8 # Depth to which sections should be chunked
|
||||||
<xsl:param>chunk.first.sections=1 # Chunk the first top-level section?
|
<xsl:param>chunk.first.sections=1 # Chunk the first top-level section?
|
||||||
<xsl:param>toc.section.depth=8 # How deep should recursive sections appear in the TOC?
|
<xsl:param>toc.section.depth=8 # How deep should recursive sections appear in the TOC?
|
||||||
<xsl:param>toc.max.depth=8 # How many levels should be created for each TOC?
|
<xsl:param>toc.max.depth=8 # How many levels should be created for each TOC?
|
||||||
<xsl:param>generate.section.toc.level=8 # Control depth of TOC generation in sections
|
#<xsl:param>generate.toc=""
|
||||||
<xsl:param>generate.toc="chapter toc,title section nop reference nop"
|
<xsl:param>generate.toc="chapter toc,title section nop reference nop part toc"
|
||||||
<xsl:param>html.stylesheet=boostbook.css
|
|
||||||
<include>../../../tools/boostbook/dtd
|
<include>../../../tools/boostbook/dtd
|
||||||
:
|
:
|
||||||
<dependency>stylesheets
|
|
||||||
<dependency>images
|
<dependency>images
|
||||||
;
|
;
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# These are used to inform the build system of the
|
# These are used to inform the build system of the
|
||||||
# means to build the integrated and stand-alone docs.
|
# means to build the integrated and stand-alone docs.
|
||||||
#
|
|
||||||
|
|
||||||
alias boostdoc ;
|
alias boostdoc ;
|
||||||
explicit boostdoc ;
|
explicit boostdoc ;
|
||||||
|
@ -1,232 +0,0 @@
|
|||||||
<!DOCTYPE xsl:stylesheet [
|
|
||||||
<!ENTITY SYNTAX_BLOCK "*[ self::compound
|
|
||||||
| self::function
|
|
||||||
| self::typedef
|
|
||||||
| self::enum
|
|
||||||
| self::variable
|
|
||||||
| self::overloaded-member
|
|
||||||
]">
|
|
||||||
]>
|
|
||||||
<xsl:stylesheet version="3.0"
|
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
||||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
||||||
xmlns:d="http://github.com/vinniefalco/docca"
|
|
||||||
expand-text="yes">
|
|
||||||
|
|
||||||
<xsl:import href="common.xsl"/>
|
|
||||||
|
|
||||||
<xsl:output method="text"/>
|
|
||||||
|
|
||||||
<xsl:include href="emphasized-types.xsl"/>
|
|
||||||
|
|
||||||
<xsl:param name="DEBUG" select="false()"/>
|
|
||||||
|
|
||||||
<xsl:variable name="list-indent-width" select="4"/>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="/page">
|
|
||||||
<xsl:text>{$nl}</xsl:text>
|
|
||||||
<xsl:text>[section:{tokenize(@id,'\.')[last()]} {d:qb-escape(title)}]</xsl:text>
|
|
||||||
<xsl:apply-templates mode="indexterm" select="."/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="indexterm" match="page"/>
|
|
||||||
<xsl:template mode="indexterm" match="page[@primary-index-term]"
|
|
||||||
>{$nl}[indexterm1 {d:qb-escape(@primary-index-term)}]{$nl}</xsl:template>
|
|
||||||
<xsl:template mode="indexterm" match="page[@secondary-index-term]" priority="1"
|
|
||||||
>{$nl}[indexterm2 {d:qb-escape(@primary-index-term)}..{
|
|
||||||
d:qb-escape(@secondary-index-term)}]{$nl}</xsl:template>
|
|
||||||
|
|
||||||
<!-- Title is already included in section header -->
|
|
||||||
<xsl:template match="/page/title"/>
|
|
||||||
|
|
||||||
<xsl:template match="heading">{$nl}[heading {.}]</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="location">
|
|
||||||
<xsl:apply-templates mode="includes-template" select="."/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="footer/location">
|
|
||||||
<xsl:apply-templates mode="includes-template-footer" select="."/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="&SYNTAX_BLOCK;">{$nl}```{$nl}</xsl:template>
|
|
||||||
<xsl:template mode="after" match="&SYNTAX_BLOCK;">{$nl}```{$nl}</xsl:template>
|
|
||||||
|
|
||||||
<!-- Merge adjacent overloaded-members into one syntax block, separated by one blank line -->
|
|
||||||
<xsl:template mode="after" match="overloaded-member[following-sibling::*[1]/self::overloaded-member]" priority="1"/>
|
|
||||||
<xsl:template mode="before" match="overloaded-member[preceding-sibling::*[1]/self::overloaded-member]" priority="1"
|
|
||||||
>{$nl}{$nl}</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="after" match="overloaded-member/type[normalize-space(.)]
|
|
||||||
| function/type[normalize-space(.)]">{$nl}</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="append" match="function">;</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="append" match="overloaded-member">
|
|
||||||
<xsl:text>;{$nl}</xsl:text>
|
|
||||||
<xsl:variable name="more-link" as="element()">
|
|
||||||
<emphasis>'''&raquo;''' <ref d:refid="{ref/@d:refid}">more...</ref></emphasis>
|
|
||||||
</xsl:variable>
|
|
||||||
<xsl:text> ``</xsl:text>
|
|
||||||
<xsl:apply-templates select="$more-link"/>
|
|
||||||
<xsl:text>``</xsl:text>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template priority="1"
|
|
||||||
match="&SYNTAX_BLOCK;//ref">``[link {$doc-ref}.{@d:refid} {d:qb-escape(.)}]``</xsl:template>
|
|
||||||
<xsl:template match="td[1]//ref" >[link {$doc-ref}.{@d:refid} {d:qb-escape(.)}]</xsl:template>
|
|
||||||
<xsl:template match="ref" >[link {$doc-ref}.{@d:refid} `{d:qb-escape(.)}`]</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="computeroutput[not(ref)] | code">`</xsl:template>
|
|
||||||
<xsl:template mode="after" match="computeroutput[not(ref)] | code">`</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="enum/name">enum </xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="typedef/name">using </xsl:template>
|
|
||||||
<xsl:template mode="after" match="typedef/name"> = </xsl:template>
|
|
||||||
<xsl:template mode="after" match="typedef/type">;</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="type[. eq '__implementation_defined__' ]">``['implementation-defined]``</xsl:template>
|
|
||||||
<xsl:template match="type[. eq '__see_below__' ]">``['see-below]``</xsl:template>
|
|
||||||
<xsl:template match="type[. = ('__deduced__','void_or_deduced')]">``__deduced__``</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="variable/name | variable/initializer">{' '}</xsl:template>
|
|
||||||
<xsl:template mode="append" match="variable">;</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="after" match="compound/kind">{' '}</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="base[1]"> :{$nl} </xsl:template>
|
|
||||||
<xsl:template mode="before" match="base" >{$nl} </xsl:template>
|
|
||||||
<xsl:template mode="after" match="base[position() ne last()]">,</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="after" match="base/prot">{' '}</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="templateparamlist">template<</xsl:template>
|
|
||||||
<xsl:template mode="after" match="templateparamlist">>{$nl}</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="param">{$nl} </xsl:template>
|
|
||||||
<xsl:template mode="after" match="param[position() ne last()]">,</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="after" match="param[declname]/type">{' '}</xsl:template>
|
|
||||||
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="params">(</xsl:template>
|
|
||||||
<xsl:template mode="after" match="params">)</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="templateparamlist/param/declname[. = $emphasized-template-parameter-types]"
|
|
||||||
>__{translate(.,'_','')}__</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="defval"> = </xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="modifier[. eq 'const']">{' '}</xsl:template>
|
|
||||||
<xsl:template mode="after" match="modifier[. eq 'const']"/>
|
|
||||||
|
|
||||||
<xsl:template mode="after" match="modifier">{$nl}</xsl:template>
|
|
||||||
|
|
||||||
|
|
||||||
<xsl:template mode="#all" match="ERROR">[role red error.{@message}]</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="table">{$nl}[table </xsl:template>
|
|
||||||
<xsl:template mode="after" match="table">{$nl}]</xsl:template>
|
|
||||||
|
|
||||||
<!-- ASSUMPTION: table rows have either <th> or <td>, not both -->
|
|
||||||
<xsl:template mode="before" match="tr[th] | th">[</xsl:template>
|
|
||||||
<xsl:template mode="after" match="tr[th] | th">]</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="tr">{$nl} [</xsl:template>
|
|
||||||
<xsl:template mode="after" match="tr">{$nl} ]</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="td">{$nl} [</xsl:template>
|
|
||||||
<xsl:template mode="after" match="td">{$nl} ]</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="bold">[*</xsl:template>
|
|
||||||
<xsl:template mode="after" match="bold">]</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="emphasis">['</xsl:template>
|
|
||||||
<xsl:template mode="after" match="emphasis">]</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="role">[role {@class} </xsl:template>
|
|
||||||
<xsl:template mode="after" match="role">]</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="ulink">[@{@url} </xsl:template>
|
|
||||||
<xsl:template mode="after" match="ulink">]</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="after" match="itemizedlist | orderedlist">{$nl}</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="listitem">
|
|
||||||
<xsl:text>{$nl}</xsl:text>
|
|
||||||
<xsl:apply-templates mode="list-item-indent" select="."/>
|
|
||||||
<xsl:apply-templates mode="list-item-label" select=".."/>
|
|
||||||
<xsl:text> </xsl:text>
|
|
||||||
<!-- ASSUMPTION: <para> always appears as a child of list items -->
|
|
||||||
<xsl:apply-templates select="para/node()"/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<!-- TODO: verify this works as expected (find an example of a nested list) -->
|
|
||||||
<xsl:template mode="list-item-indent"
|
|
||||||
match="listitem">{ancestor::listitem ! (1 to $list-indent-width) ! ' '}</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="list-item-label" match="itemizedlist">*</xsl:template>
|
|
||||||
<xsl:template mode="list-item-label" match="orderedlist" >#</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="append" match="/page/div[1]">
|
|
||||||
<xsl:if test="$DEBUG">
|
|
||||||
<xsl:text>['</xsl:text>
|
|
||||||
<xsl:text>[role red \[Page type: [*{/*/@type}]\]] </xsl:text>
|
|
||||||
<xsl:text>[role green \[[@../../doc/html/{translate($doc-ref,'.','/')}/{
|
|
||||||
translate(/page/@id,'.','/')}.html [role green doc_build_html]]\]] </xsl:text>
|
|
||||||
<xsl:text>[@../build/xml-pages/{/page/@id}.xml [role blue [*\[doxygen_page_xml\]]]]</xsl:text>
|
|
||||||
<xsl:text>[@../build/stage1_visualized/visualized/{/page/@id}.html [role magenta ---stage1_visualized-->]]</xsl:text>
|
|
||||||
<xsl:text>[@../build/stage1_visualized/results/{ /page/@id}.xml [role blue [*\[docca_page_xml\]]]]</xsl:text>
|
|
||||||
<xsl:text>[@../build/stage2_visualized/visualized/{/page/@id}.html [role magenta ---stage2_visualized-->]]</xsl:text>
|
|
||||||
<xsl:text>[@../build/stage2_visualized/results/{ /page/@id}.txt [role blue [*\[quickbook_result\]]]]</xsl:text>
|
|
||||||
<xsl:text>]</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="para | div">{$nl}</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="sp">{' '}</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="linebreak">{$nl}{$nl}</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="br">[br]</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="before" match="programlisting">{$nl}```{$nl}</xsl:template>
|
|
||||||
<xsl:template mode="after" match="programlisting" >```{$nl}</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template mode="after" match="codeline">{$nl}</xsl:template>
|
|
||||||
|
|
||||||
<!-- Ignore whitespace-only text nodes -->
|
|
||||||
<xsl:template match="text()[not(normalize-space())]"/>
|
|
||||||
|
|
||||||
<xsl:template match="text()">
|
|
||||||
<xsl:sequence select="d:qb-escape(.)"/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<!-- Boilerplate default rules for elements -->
|
|
||||||
<!-- Convention of this stylesheet is to favor use of just "before" and "after"
|
|
||||||
and to utilize "append" (and maybe "insert") only when a distinction is needed -->
|
|
||||||
<xsl:template match="*" priority="10">
|
|
||||||
<xsl:apply-templates mode="before" select="."/>
|
|
||||||
<!-- enable if needed/desired
|
|
||||||
<xsl:apply-templates mode="insert" select="."/> -->
|
|
||||||
<xsl:next-match/>
|
|
||||||
<xsl:apply-templates mode="append" select="."/>
|
|
||||||
<xsl:apply-templates mode="after" select="."/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<!-- Default before/after/insert/append rules are to do nothing -->
|
|
||||||
<xsl:template mode="before" match="*"/>
|
|
||||||
<!-- enable if needed/desired
|
|
||||||
<xsl:template mode="insert" match="*"/> -->
|
|
||||||
<xsl:template mode="append" match="*"/>
|
|
||||||
<xsl:template mode="after" match="*"/>
|
|
||||||
|
|
||||||
|
|
||||||
<xsl:function name="d:qb-escape">
|
|
||||||
<xsl:param name="string"/>
|
|
||||||
<xsl:sequence select="$string"/>
|
|
||||||
</xsl:function>
|
|
||||||
|
|
||||||
</xsl:stylesheet>
|
|
@ -33,8 +33,6 @@
|
|||||||
[template asioreflink[id term][@boost:/doc/html/boost_asio/reference/[id].html [^boost::asio::[term]]]]
|
[template asioreflink[id term][@boost:/doc/html/boost_asio/reference/[id].html [^boost::asio::[term]]]]
|
||||||
[template beastreflink[id term][@boost:/doc/html/boost_beast/reference/[id].html [^boost::beast::[term]]]]
|
[template beastreflink[id term][@boost:/doc/html/boost_beast/reference/[id].html [^boost::beast::[term]]]]
|
||||||
[template mysqllink[id text][@https://dev.mysql.com/doc/refman/8.0/en/[id] [text]]]
|
[template mysqllink[id text][@https://dev.mysql.com/doc/refman/8.0/en/[id] [text]]]
|
||||||
[template mysqlerrlink[text][@https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html [text]]]
|
|
||||||
[template mysqlerrlink2[id text][@https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html#[id] [text]]]
|
|
||||||
|
|
||||||
[def __Stream__ [reflink2 Stream ['Stream]]]
|
[def __Stream__ [reflink2 Stream ['Stream]]]
|
||||||
[def __SocketStream__ [reflink2 SocketStream ['SocketStream]]]
|
[def __SocketStream__ [reflink2 SocketStream ['SocketStream]]]
|
||||||
|
@ -63,7 +63,7 @@ two different origins:
|
|||||||
|
|
||||||
* [*Server defined] error codes. These codes are defined by the MySQL
|
* [*Server defined] error codes. These codes are defined by the MySQL
|
||||||
server. They range between 1 and 0xffff. They are described
|
server. They range between 1 and 0xffff. They are described
|
||||||
in detail [mysqlerrlink in the MySQL error reference].
|
in detail [@https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html in the MySQL error reference].
|
||||||
* [*Client defined] error codes. These are defined by __Self__,
|
* [*Client defined] error codes. These are defined by __Self__,
|
||||||
and are always greater than 0xffff.
|
and are always greater than 0xffff.
|
||||||
|
|
||||||
|
@ -30,4 +30,13 @@
|
|||||||
|
|
||||||
<xsl:template mode="convenience-header" match="@file[contains(., 'boost/mysql')]">mysql.hpp</xsl:template>
|
<xsl:template mode="convenience-header" match="@file[contains(., 'boost/mysql')]">mysql.hpp</xsl:template>
|
||||||
|
|
||||||
|
<xsl:variable name="emphasized-template-parameter-types" select="
|
||||||
|
'CompletionToken',
|
||||||
|
'Stream',
|
||||||
|
'SocketStream',
|
||||||
|
'Executor',
|
||||||
|
'FieldLikeTuple',
|
||||||
|
'FieldViewFwdIterator'
|
||||||
|
"/>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright (c) 2019-2022 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)
|
|
||||||
-->
|
|
||||||
|
|
||||||
<xsl:stylesheet version="3.0"
|
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
||||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
||||||
exclude-result-prefixes="xs">
|
|
||||||
|
|
||||||
<xsl:variable name="emphasized-template-parameter-types" select="
|
|
||||||
'CompletionToken',
|
|
||||||
'Stream',
|
|
||||||
'SocketStream',
|
|
||||||
'Executor',
|
|
||||||
'FieldLikeTuple',
|
|
||||||
'FieldViewFwdIterator'
|
|
||||||
"/>
|
|
||||||
|
|
||||||
</xsl:stylesheet>
|
|
@ -13,8 +13,8 @@
|
|||||||
namespace boost {
|
namespace boost {
|
||||||
namespace mysql {
|
namespace mysql {
|
||||||
|
|
||||||
/// Exception type thrown when trying to access a [reflink field]
|
/// Exception type thrown when trying to access a \ref field
|
||||||
/// or [reflink field_view] with an incorrect type.
|
/// or \ref field_view with an incorrect type.
|
||||||
class bad_field_access : public std::exception
|
class bad_field_access : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -15,7 +15,6 @@ namespace mysql {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Buffer configuration parameters for a connection.
|
* \brief Buffer configuration parameters for a connection.
|
||||||
* \details See [link mysql.connparams the section on handshake parameters] for more info.
|
|
||||||
*/
|
*/
|
||||||
class buffer_params
|
class buffer_params
|
||||||
{
|
{
|
||||||
@ -25,7 +24,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* \brief Initializing constructor.
|
* \brief Initializing constructor.
|
||||||
* \param init_read_buffer_size Initial size of the read buffer. A bigger read buffer
|
* \param init_read_buffer_size Initial size of the read buffer. A bigger read buffer
|
||||||
* can increase the number of rows returned by [refmem resultset read_some].
|
* can increase the number of rows returned by \ref resultset::read_some.
|
||||||
*/
|
*/
|
||||||
constexpr buffer_params(std::size_t init_read_buffer_size = 0) noexcept
|
constexpr buffer_params(std::size_t init_read_buffer_size = 0) noexcept
|
||||||
: initial_read_buffer_size_(init_read_buffer_size)
|
: initial_read_buffer_size_(init_read_buffer_size)
|
||||||
|
@ -16,8 +16,9 @@ namespace mysql {
|
|||||||
/**
|
/**
|
||||||
* \brief A character set and a collation.
|
* \brief A character set and a collation.
|
||||||
* Names and ids for this enum correspond to the `Collation` and `Id`
|
* Names and ids for this enum correspond to the `Collation` and `Id`
|
||||||
* fields returned by MySQL
|
* fields returned by MySQL <a
|
||||||
* [mysqllink show-collation.html `SHOW COLLATION`] statement.
|
* href="https://dev.mysql.com/doc/refman/8.0/en/show-collation.html">`SHOW COLLATION`</a>
|
||||||
|
* statement.
|
||||||
*/
|
*/
|
||||||
enum class collation : std::uint16_t
|
enum class collation : std::uint16_t
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ namespace mysql {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Represents the database type of a MySQL column.
|
* \brief Represents the database type of a MySQL column.
|
||||||
* \details This represents a database type, as opposed to [reflink field_kind], which represents a
|
* \details This represents a database type, as opposed to \ref field_kind, which represents a
|
||||||
* C++ type.
|
* C++ type.
|
||||||
*
|
*
|
||||||
* Unless otherwise noted, the names in this enumeration
|
* Unless otherwise noted, the names in this enumeration
|
||||||
|
@ -28,14 +28,7 @@ namespace mysql {
|
|||||||
* \brief A connection to a MySQL server.
|
* \brief A connection to a MySQL server.
|
||||||
*
|
*
|
||||||
* \details
|
* \details
|
||||||
* Represents a connection to a MySQL server. You can find more info in the following sections:
|
* Represents a connection to a MySQL server.
|
||||||
*\n
|
|
||||||
* * [link mysql.queries Text queries].
|
|
||||||
* * [link mysql.prepared_statements Prepared statements].
|
|
||||||
* * [link mysql.overview.async Asynchronous functions and multi-threading].
|
|
||||||
* * [link mysql.connparams Connect].
|
|
||||||
* * [link mysql.other_streams.connection Handshake and quit].
|
|
||||||
* * [link mysql.reconnecting Error recovery].
|
|
||||||
*\n
|
*\n
|
||||||
* `connection` is the main I/O object that this library implements. It owns a `Stream` object that
|
* `connection` is the main I/O object that this library implements. It owns a `Stream` object that
|
||||||
* is accessed by functions involving network operations, as well as session state. You can access
|
* is accessed by functions involving network operations, as well as session state. You can access
|
||||||
@ -147,24 +140,22 @@ public:
|
|||||||
* for connections that haven't been
|
* for connections that haven't been
|
||||||
* established yet (handshake not run yet). If the handshake fails,
|
* established yet (handshake not run yet). If the handshake fails,
|
||||||
* the return value is undefined.
|
* the return value is undefined.
|
||||||
*
|
*\n
|
||||||
* This function can be used to determine
|
* This function can be used to determine whether you are using a SSL
|
||||||
* whether you are using a SSL connection or not when using
|
* connection or not when using SSL negotiation.
|
||||||
* SSL negotiation (see [link mysql.ssl.negotiation this section]).
|
|
||||||
*/
|
*/
|
||||||
bool uses_ssl() const noexcept { return get_channel().ssl_active(); }
|
bool uses_ssl() const noexcept { return get_channel().ssl_active(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Establishes a connection to a MySQL server.
|
* \brief Establishes a connection to a MySQL server.
|
||||||
* \details This function is only available if `Stream` satisfies the
|
* \details This function is only available if `Stream` satisfies the
|
||||||
* [reflink SocketStream] requirements.
|
* `SocketStream` concept.
|
||||||
*\n
|
*\n
|
||||||
* Connects the underlying stream and performs the handshake
|
* Connects the underlying stream and performs the handshake
|
||||||
* with the server. The underlying stream is closed in case of error. Prefer
|
* with the server. The underlying stream is closed in case of error. Prefer
|
||||||
* this function to \ref connection::handshake.
|
* this function to \ref connection::handshake.
|
||||||
*\n
|
*\n
|
||||||
* If using a SSL-capable stream, the SSL handshake will be performed by this function.
|
* If using a SSL-capable stream, the SSL handshake will be performed by this function.
|
||||||
* See [link mysql.ssl.handshake this section] for more info.
|
|
||||||
*\n
|
*\n
|
||||||
* This operation involves both reads and writes on the underlying stream.
|
* This operation involves both reads and writes on the underlying stream.
|
||||||
*/
|
*/
|
||||||
@ -227,7 +218,6 @@ public:
|
|||||||
* requirements, use \ref connection::connect instead of this function.
|
* requirements, use \ref connection::connect instead of this function.
|
||||||
*\n
|
*\n
|
||||||
* If using a SSL-capable stream, the SSL handshake will be performed by this function.
|
* If using a SSL-capable stream, the SSL handshake will be performed by this function.
|
||||||
* See [link mysql.ssl.handshake this section] for more info.
|
|
||||||
*\n
|
*\n
|
||||||
* This operation involves both reads and writes on the underlying stream.
|
* This operation involves both reads and writes on the underlying stream.
|
||||||
*/
|
*/
|
||||||
@ -279,8 +269,6 @@ public:
|
|||||||
* communication. Otherwise, the results are undefined.
|
* communication. Otherwise, the results are undefined.
|
||||||
*\n
|
*\n
|
||||||
* This operation involves both reads and writes on the underlying stream.
|
* This operation involves both reads and writes on the underlying stream.
|
||||||
*\n
|
|
||||||
* See [link mysql.queries this section] for more info.
|
|
||||||
*/
|
*/
|
||||||
void query(boost::string_view query_string, resultset<Stream>& result, error_code&, error_info&);
|
void query(boost::string_view query_string, resultset<Stream>& result, error_code&, error_info&);
|
||||||
|
|
||||||
@ -331,8 +319,6 @@ public:
|
|||||||
* interaction as long as I/O object references to `*this` are valid.
|
* interaction as long as I/O object references to `*this` are valid.
|
||||||
*\n
|
*\n
|
||||||
* This operation involves both reads and writes on the underlying stream.
|
* This operation involves both reads and writes on the underlying stream.
|
||||||
*\n
|
|
||||||
* See [link mysql.prepared_statements this section] for more info.
|
|
||||||
*/
|
*/
|
||||||
void prepare_statement(boost::string_view stmt, statement<Stream>& result, error_code&, error_info&);
|
void prepare_statement(boost::string_view stmt, statement<Stream>& result, error_code&, error_info&);
|
||||||
|
|
||||||
@ -379,8 +365,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* \brief Closes the connection with the server.
|
* \brief Closes the connection with the server.
|
||||||
* \details
|
* \details
|
||||||
* This function is only available if `Stream` satisfies the
|
* This function is only available if `Stream` satisfies the `SocketStream` concept.
|
||||||
* [reflink SocketStream] requirements.
|
|
||||||
*\n
|
*\n
|
||||||
* Sends a quit request, performs the TLS shutdown (if required)
|
* Sends a quit request, performs the TLS shutdown (if required)
|
||||||
* and closes the underlying stream. Prefer this function to \ref connection::quit.
|
* and closes the underlying stream. Prefer this function to \ref connection::quit.
|
||||||
|
@ -31,23 +31,23 @@ using datetime = std::chrono::time_point<std::chrono::system_clock, std::chrono:
|
|||||||
/// Type representing MySQL `__TIME__` data type.
|
/// Type representing MySQL `__TIME__` data type.
|
||||||
using time = std::chrono::microseconds;
|
using time = std::chrono::microseconds;
|
||||||
|
|
||||||
/// The minimum allowed value for [reflink date] (0000-01-01).
|
/// The minimum allowed value for \ref date (0000-01-01).
|
||||||
BOOST_CXX14_CONSTEXPR const date min_date{days(-719528)};
|
BOOST_CXX14_CONSTEXPR const date min_date{days(-719528)};
|
||||||
|
|
||||||
/// The maximum allowed value for [reflink date] (9999-12-31).
|
/// The maximum allowed value for \ref date (9999-12-31).
|
||||||
BOOST_CXX14_CONSTEXPR const date max_date{days(2932896)};
|
BOOST_CXX14_CONSTEXPR const date max_date{days(2932896)};
|
||||||
|
|
||||||
/// The minimum allowed value for [reflink datetime].
|
/// The minimum allowed value for \ref datetime.
|
||||||
BOOST_CXX14_CONSTEXPR const datetime min_datetime = min_date;
|
BOOST_CXX14_CONSTEXPR const datetime min_datetime = min_date;
|
||||||
|
|
||||||
/// The maximum allowed value for [reflink datetime].
|
/// The maximum allowed value for \ref datetime.
|
||||||
BOOST_CXX14_CONSTEXPR const datetime max_datetime =
|
BOOST_CXX14_CONSTEXPR const datetime max_datetime = max_date + std::chrono::hours(24) -
|
||||||
max_date + std::chrono::hours(24) - std::chrono::microseconds(1);
|
std::chrono::microseconds(1);
|
||||||
|
|
||||||
/// The minimum allowed value for [reflink time].
|
/// The minimum allowed value for \ref time.
|
||||||
constexpr time min_time = -std::chrono::hours(839);
|
constexpr time min_time = -std::chrono::hours(839);
|
||||||
|
|
||||||
/// The maximum allowed value for [reflink time].
|
/// The maximum allowed value for \ref time.
|
||||||
constexpr time max_time = std::chrono::hours(839);
|
constexpr time max_time = std::chrono::hours(839);
|
||||||
|
|
||||||
} // namespace mysql
|
} // namespace mysql
|
||||||
|
@ -124,7 +124,14 @@ struct com_stmt_execute_param_meta_packet
|
|||||||
// close
|
// close
|
||||||
struct com_stmt_close_packet
|
struct com_stmt_close_packet
|
||||||
{
|
{
|
||||||
std::uint32_t statement_id;
|
// MSVC 14.1 bug workaround
|
||||||
|
constexpr com_stmt_close_packet() noexcept = default;
|
||||||
|
constexpr com_stmt_close_packet(std::uint32_t statement_id) noexcept
|
||||||
|
: statement_id(statement_id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::uint32_t statement_id{};
|
||||||
|
|
||||||
static constexpr std::uint8_t command_id = 0x19;
|
static constexpr std::uint8_t command_id = 0x19;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,7 @@ namespace mysql {
|
|||||||
/// An alias for boost::system error codes.
|
/// An alias for boost::system error codes.
|
||||||
using error_code = boost::system::error_code;
|
using error_code = boost::system::error_code;
|
||||||
|
|
||||||
/// Creates an [reflink error_code] from an [reflink errc].
|
/// Creates an \ref error_code from an \ref errc.
|
||||||
inline error_code make_error_code(errc error);
|
inline error_code make_error_code(errc error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,7 @@ namespace boost {
|
|||||||
namespace mysql {
|
namespace mysql {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Additional [reflink statement] execution options.
|
* \brief Additional statement execution options.
|
||||||
* \details Placeholder for now.
|
* \details Placeholder for now.
|
||||||
*/
|
*/
|
||||||
class execute_options
|
class execute_options
|
||||||
|
@ -29,17 +29,14 @@ namespace mysql {
|
|||||||
/**
|
/**
|
||||||
* \brief Variant-like class that can represent of any of the allowed database types.
|
* \brief Variant-like class that can represent of any of the allowed database types.
|
||||||
* \details
|
* \details
|
||||||
* For an overview on how to use fields, see [link mysql.overview.rows_fields.fields this section].
|
|
||||||
* The accessors and type mappings reference is [link mysql.fields here].
|
|
||||||
* \n
|
|
||||||
* This is a regular variant-like class that can represent any of the types that MySQL allows. It
|
* This is a regular variant-like class that can represent any of the types that MySQL allows. It
|
||||||
* has value semantics (as opposed to [reflink field_view]). Instances of this class are not created
|
* has value semantics (as opposed to \ref field_view). Instances of this class are not created
|
||||||
* by the library. They should be created by the user, when the reference semantics of
|
* by the library. They should be created by the user, when the reference semantics of
|
||||||
* [reflink field_view] are not appropriate.
|
* \ref field_view are not appropriate.
|
||||||
* \n
|
* \n
|
||||||
* Like a variant, at any point, a `field` always contains a value of
|
* Like a variant, at any point, a `field` always contains a value of
|
||||||
* certain type. You can query the type using [refmem field kind] and the `is_xxx` functions
|
* certain type. You can query the type using \ref kind and the `is_xxx` functions
|
||||||
* like [refmem field is_int64]. Use `as_xxx` and `get_xxx` for checked and unchecked value
|
* like \ref is_int64. Use `as_xxx` and `get_xxx` for checked and unchecked value
|
||||||
* access, respectively. You can mutate a `field` by calling the `emplace_xxx` functions, by
|
* access, respectively. You can mutate a `field` by calling the `emplace_xxx` functions, by
|
||||||
* assigning it a different value, or using the lvalue references returned by `as_xxx` and
|
* assigning it a different value, or using the lvalue references returned by `as_xxx` and
|
||||||
* `get_xxx`.
|
* `get_xxx`.
|
||||||
|
@ -14,7 +14,7 @@ namespace boost {
|
|||||||
namespace mysql {
|
namespace mysql {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Represents the possible C++ types a [reflink field] or [reflink field_view] may have.
|
* \brief Represents the possible C++ types a \ref field or \ref field_view may have.
|
||||||
*/
|
*/
|
||||||
enum class field_kind
|
enum class field_kind
|
||||||
{
|
{
|
||||||
@ -39,13 +39,13 @@ enum class field_kind
|
|||||||
/// The field contains a `double`.
|
/// The field contains a `double`.
|
||||||
double_,
|
double_,
|
||||||
|
|
||||||
/// The field contains a [reflink date].
|
/// The field contains a \ref date.
|
||||||
date,
|
date,
|
||||||
|
|
||||||
/// The field contains a [reflink datetime].
|
/// The field contains a \ref datetime.
|
||||||
datetime,
|
datetime,
|
||||||
|
|
||||||
/// The field contains a [reflink time].
|
/// The field contains a \ref time.
|
||||||
time
|
time
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,9 +27,6 @@ namespace mysql {
|
|||||||
/**
|
/**
|
||||||
* \brief Non-owning variant-like class that can represent of any of the allowed database types.
|
* \brief Non-owning variant-like class that can represent of any of the allowed database types.
|
||||||
* \details
|
* \details
|
||||||
* For an overview on how to use fields, see [link mysql.overview.rows_fields.fields this section].
|
|
||||||
* The accessors and type mappings reference is [link mysql.fields here].
|
|
||||||
* \n
|
|
||||||
* This is a variant-like class, similar to \ref field, but semi-owning and read-only. Values
|
* This is a variant-like class, similar to \ref field, but semi-owning and read-only. Values
|
||||||
* of this type are usually created by the library, not directly by the user. It's cheap to
|
* of this type are usually created by the library, not directly by the user. It's cheap to
|
||||||
* construct and copy, and it's the main library interface when reading values from MySQL.
|
* construct and copy, and it's the main library interface when reading values from MySQL.
|
||||||
@ -178,35 +175,35 @@ public:
|
|||||||
BOOST_CXX14_CONSTEXPR bool is_time() const noexcept { return kind() == field_kind::time; }
|
BOOST_CXX14_CONSTEXPR bool is_time() const noexcept { return kind() == field_kind::time; }
|
||||||
|
|
||||||
/// \brief Retrieves the underlying value as an `int64` or throws an exception.
|
/// \brief Retrieves the underlying value as an `int64` or throws an exception.
|
||||||
/// \details If `!this->is_int64()`, throws [reflink bad_field_access].
|
/// \details If `!this->is_int64()`, throws \ref bad_field_access.
|
||||||
BOOST_CXX14_CONSTEXPR inline std::int64_t as_int64() const;
|
BOOST_CXX14_CONSTEXPR inline std::int64_t as_int64() const;
|
||||||
|
|
||||||
/// \brief Retrieves the underlying value as an `uint64` or throws an exception.
|
/// \brief Retrieves the underlying value as an `uint64` or throws an exception.
|
||||||
/// \details If `!this->is_uint64()`, throws [reflink bad_field_access].
|
/// \details If `!this->is_uint64()`, throws \ref bad_field_access.
|
||||||
BOOST_CXX14_CONSTEXPR inline std::uint64_t as_uint64() const;
|
BOOST_CXX14_CONSTEXPR inline std::uint64_t as_uint64() const;
|
||||||
|
|
||||||
/// \brief Retrieves the underlying value as a string or throws an exception.
|
/// \brief Retrieves the underlying value as a string or throws an exception.
|
||||||
/// \details If `!this->is_string()`, throws [reflink bad_field_access].
|
/// \details If `!this->is_string()`, throws \ref bad_field_access.
|
||||||
BOOST_CXX14_CONSTEXPR inline boost::string_view as_string() const;
|
BOOST_CXX14_CONSTEXPR inline boost::string_view as_string() const;
|
||||||
|
|
||||||
/// \brief Retrieves the underlying value as a `float` or throws an exception.
|
/// \brief Retrieves the underlying value as a `float` or throws an exception.
|
||||||
/// \details If `!this->is_float()`, throws [reflink bad_field_access].
|
/// \details If `!this->is_float()`, throws \ref bad_field_access.
|
||||||
BOOST_CXX14_CONSTEXPR inline float as_float() const;
|
BOOST_CXX14_CONSTEXPR inline float as_float() const;
|
||||||
|
|
||||||
/// \brief Retrieves the underlying value as a `double` or throws an exception.
|
/// \brief Retrieves the underlying value as a `double` or throws an exception.
|
||||||
/// \details If `!this->is_double()`, throws [reflink bad_field_access].
|
/// \details If `!this->is_double()`, throws \ref bad_field_access.
|
||||||
BOOST_CXX14_CONSTEXPR inline double as_double() const;
|
BOOST_CXX14_CONSTEXPR inline double as_double() const;
|
||||||
|
|
||||||
/// \brief Retrieves the underlying value as a `date` or throws an exception.
|
/// \brief Retrieves the underlying value as a `date` or throws an exception.
|
||||||
/// \details If `!this->is_date()`, throws [reflink bad_field_access].
|
/// \details If `!this->is_date()`, throws \ref bad_field_access.
|
||||||
BOOST_CXX14_CONSTEXPR inline date as_date() const;
|
BOOST_CXX14_CONSTEXPR inline date as_date() const;
|
||||||
|
|
||||||
/// \brief Retrieves the underlying value as a `datetime` or throws an exception.
|
/// \brief Retrieves the underlying value as a `datetime` or throws an exception.
|
||||||
/// \details If `!this->is_datetime()`, throws [reflink bad_field_access].
|
/// \details If `!this->is_datetime()`, throws \ref bad_field_access.
|
||||||
BOOST_CXX14_CONSTEXPR inline datetime as_datetime() const;
|
BOOST_CXX14_CONSTEXPR inline datetime as_datetime() const;
|
||||||
|
|
||||||
/// \brief Retrieves the underlying value as a `time` or throws an exception.
|
/// \brief Retrieves the underlying value as a `time` or throws an exception.
|
||||||
/// \details If `!this->is_time()`, throws [reflink bad_field_access].
|
/// \details If `!this->is_time()`, throws \ref bad_field_access.
|
||||||
BOOST_CXX14_CONSTEXPR inline time as_time() const;
|
BOOST_CXX14_CONSTEXPR inline time as_time() const;
|
||||||
|
|
||||||
/// \brief Retrieves the underlying value as an `int64` (unchecked access).
|
/// \brief Retrieves the underlying value as an `int64` (unchecked access).
|
||||||
@ -354,11 +351,10 @@ private:
|
|||||||
* \relates field_view
|
* \relates field_view
|
||||||
* \brief Streams a `field_view`.
|
* \brief Streams a `field_view`.
|
||||||
* \details The value should be in the MySQL valid range of values. Concretely,
|
* \details The value should be in the MySQL valid range of values. Concretely,
|
||||||
* if the value is a [reflink date], [reflink datetime] or
|
* if the value is a \ref date, \ref datetime or \ref time, it should be in the
|
||||||
* [reflink time], it should be in the
|
* \\[\ref min_date, \ref max_date\\],
|
||||||
* \\[[reflink min_date], [reflink max_date]\\],
|
* \\[\ref min_datetime, \ref max_datetime\\] or
|
||||||
* \\[[reflink min_datetime], [reflink max_datetime]\\] or
|
* \\[\ref min_time, \ref max_time\\], respectively.
|
||||||
* \\[[reflink min_time], [reflink max_time]\\], respectively.
|
|
||||||
* Otherwise, the results are undefined.
|
* Otherwise, the results are undefined.
|
||||||
*/
|
*/
|
||||||
inline std::ostream& operator<<(std::ostream& os, const field_view& v);
|
inline std::ostream& operator<<(std::ostream& os, const field_view& v);
|
||||||
|
@ -31,9 +31,7 @@ enum class ssl_mode
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Parameters defining how to perform the handshake
|
* \brief Parameters defining how to perform the handshake with a MySQL server.
|
||||||
* with a MySQL server. See [link mysql.connparams this section]
|
|
||||||
* for more information on each parameter.
|
|
||||||
*/
|
*/
|
||||||
class handshake_params
|
class handshake_params
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ namespace boost {
|
|||||||
namespace mysql {
|
namespace mysql {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Holds [link mysql.resultsets.metadata metadata] about a column in a SQL query.
|
* \brief Metadata about a column in a SQL query.
|
||||||
* \details This is a regular, value type. Instances of this class are not created by the user
|
* \details This is a regular, value type. Instances of this class are not created by the user
|
||||||
* directly, but by the library.
|
* directly, but by the library.
|
||||||
*/
|
*/
|
||||||
|
@ -44,8 +44,6 @@ namespace mysql {
|
|||||||
* Resultsets are default-constructible and movable, but not copyable. A default constructed or
|
* Resultsets are default-constructible and movable, but not copyable. A default constructed or
|
||||||
* closed resultset has `!this->valid()`. Calling any member function on an invalid
|
* closed resultset has `!this->valid()`. Calling any member function on an invalid
|
||||||
* resultset, other than assignment, results in undefined behavior.
|
* resultset, other than assignment, results in undefined behavior.
|
||||||
* \n
|
|
||||||
* See [link mysql.resultsets this section] for more info.
|
|
||||||
*/
|
*/
|
||||||
template <class Stream>
|
template <class Stream>
|
||||||
class resultset : public resultset_base
|
class resultset : public resultset_base
|
||||||
|
@ -139,7 +139,7 @@ public:
|
|||||||
bool complete() const noexcept { return ok_packet_.has_value(); }
|
bool complete() const noexcept { return ok_packet_.has_value(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Returns [link mysql.resultsets.metadata metadata] about the columns in the query.
|
* \brief Returns metadata about the columns in the query.
|
||||||
* \details
|
* \details
|
||||||
* The returned collection will have as many \ref metadata objects as columns retrieved by
|
* The returned collection will have as many \ref metadata objects as columns retrieved by
|
||||||
* the SQL query, and in the same order.
|
* the SQL query, and in the same order.
|
||||||
|
@ -36,8 +36,6 @@ namespace mysql {
|
|||||||
* Statements are default-constructible and movable, but not copyable. A default constructed or
|
* Statements are default-constructible and movable, but not copyable. A default constructed or
|
||||||
* closed statement has `!this->valid()`. Calling any member function on an invalid
|
* closed statement has `!this->valid()`. Calling any member function on an invalid
|
||||||
* statement, other than assignment, results in undefined behavior.
|
* statement, other than assignment, results in undefined behavior.
|
||||||
*\n
|
|
||||||
* See [link mysql.prepared_statements] for more info.
|
|
||||||
*/
|
*/
|
||||||
template <class Stream>
|
template <class Stream>
|
||||||
class statement : public statement_base
|
class statement : public statement_base
|
||||||
@ -97,11 +95,9 @@ public:
|
|||||||
* communication. Otherwise, the results are undefined.
|
* communication. Otherwise, the results are undefined.
|
||||||
*\n
|
*\n
|
||||||
* The statement actual parameters (`params`) are passed as a `std::tuple` of elements.
|
* The statement actual parameters (`params`) are passed as a `std::tuple` of elements.
|
||||||
* See the [reflink FieldLikeTuple] concept defition for more info.
|
* See the `FieldLikeTuple` concept defition for more info.
|
||||||
*\n
|
*\n
|
||||||
* This operation involves both reads and writes on the underlying stream.
|
* This operation involves both reads and writes on the underlying stream.
|
||||||
*\n
|
|
||||||
* See [link mysql.prepared_statements this section] for more info.
|
|
||||||
*/
|
*/
|
||||||
template <
|
template <
|
||||||
BOOST_MYSQL_FIELD_LIKE_TUPLE FieldLikeTuple,
|
BOOST_MYSQL_FIELD_LIKE_TUPLE FieldLikeTuple,
|
||||||
@ -257,12 +253,9 @@ public:
|
|||||||
* The statement actual parameters are passed as an iterator range. There should be
|
* The statement actual parameters are passed as an iterator range. There should be
|
||||||
* __exactly__ as many parameters as required (as given by \ref statement::num_params).
|
* __exactly__ as many parameters as required (as given by \ref statement::num_params).
|
||||||
* Dereferencing the passed iterators should yield a type convertible to \ref field_view.
|
* Dereferencing the passed iterators should yield a type convertible to \ref field_view.
|
||||||
* Both \ref field and \ref field_view satisfy this. See [reflink FieldViewFwdIterator] for
|
* Both \ref field and \ref field_view satisfy this.
|
||||||
* details.
|
|
||||||
*\n
|
*\n
|
||||||
* This operation involves both reads and writes on the underlying stream.
|
* This operation involves both reads and writes on the underlying stream.
|
||||||
*\n
|
|
||||||
* See [link mysql.prepared_statements this section] for more info.
|
|
||||||
*/
|
*/
|
||||||
template <BOOST_MYSQL_FIELD_VIEW_FORWARD_ITERATOR FieldViewFwdIterator>
|
template <BOOST_MYSQL_FIELD_VIEW_FORWARD_ITERATOR FieldViewFwdIterator>
|
||||||
void execute(
|
void execute(
|
||||||
|
22
test/cmake_b2_test/CMakeLists.txt
Normal file
22
test/cmake_b2_test/CMakeLists.txt
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2019-2022 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 is included in README.md, watch out before changing
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION VERSION 3.13.0)
|
||||||
|
|
||||||
|
project(boost_mysql_example)
|
||||||
|
|
||||||
|
find_package(Boost REQUIRED COMPONENTS headers)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
find_package(OpenSSL REQUIRED)
|
||||||
|
|
||||||
|
add_executable(main main.cpp)
|
||||||
|
target_link_libraries(main PRIVATE Boost::headers Threads::Threads OpenSSL::Crypto OpenSSL::SSL)
|
||||||
|
|
||||||
|
include(CTest)
|
||||||
|
add_test(NAME main COMMAND main)
|
18
test/cmake_b2_test/main.cpp
Normal file
18
test/cmake_b2_test/main.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2019-2022 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)
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <boost/mysql/tcp_ssl.hpp>
|
||||||
|
|
||||||
|
#include <boost/asio/ssl/context.hpp>
|
||||||
|
#include <boost/asio/system_executor.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
boost::asio::ssl::context ssl_ctx(boost::asio::ssl::context::tls_client);
|
||||||
|
boost::mysql::tcp_ssl_connection conn(boost::asio::system_executor{}, ssl_ctx);
|
||||||
|
return static_cast<int>(conn.uses_ssl()); // should be false for a non-connected connection
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2019-2020 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
|
# Copyright (c) 2019-2022 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
|
||||||
#
|
#
|
||||||
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
# 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)
|
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
@ -74,6 +74,14 @@ const flagsvec no_flags{};
|
|||||||
const flagsvec flags_unsigned{&metadata::is_unsigned};
|
const flagsvec flags_unsigned{&metadata::is_unsigned};
|
||||||
const flagsvec flags_zerofill{&metadata::is_unsigned, &metadata::is_zerofill};
|
const flagsvec flags_zerofill{&metadata::is_unsigned, &metadata::is_zerofill};
|
||||||
|
|
||||||
|
// Sets the time_zone to a well known value, so we can deterministically read TIMESTAMPs
|
||||||
|
void set_time_zone(boost::mysql::tcp_connection& conn)
|
||||||
|
{
|
||||||
|
boost::mysql::tcp_resultset result;
|
||||||
|
conn.query("SET session time_zone = '+02:00'", result);
|
||||||
|
BOOST_TEST_REQUIRE(result.complete());
|
||||||
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
// Int cases
|
// Int cases
|
||||||
void add_int_samples_helper(
|
void add_int_samples_helper(
|
||||||
@ -612,6 +620,7 @@ std::vector<database_types_sample> all_samples = make_all_samples();
|
|||||||
BOOST_FIXTURE_TEST_CASE(query, tcp_network_fixture)
|
BOOST_FIXTURE_TEST_CASE(query, tcp_network_fixture)
|
||||||
{
|
{
|
||||||
connect();
|
connect();
|
||||||
|
set_time_zone(conn);
|
||||||
|
|
||||||
for (const auto& sample : all_samples)
|
for (const auto& sample : all_samples)
|
||||||
{
|
{
|
||||||
@ -647,6 +656,7 @@ BOOST_FIXTURE_TEST_CASE(query, tcp_network_fixture)
|
|||||||
BOOST_FIXTURE_TEST_CASE(statement, tcp_network_fixture)
|
BOOST_FIXTURE_TEST_CASE(statement, tcp_network_fixture)
|
||||||
{
|
{
|
||||||
connect();
|
connect();
|
||||||
|
set_time_zone(conn);
|
||||||
|
|
||||||
for (const auto& sample : all_samples)
|
for (const auto& sample : all_samples)
|
||||||
{
|
{
|
||||||
@ -701,6 +711,7 @@ std::vector<database_types_sample> make_prepared_stmt_param_samples()
|
|||||||
BOOST_FIXTURE_TEST_CASE(prepared_statement_execute_param, tcp_network_fixture)
|
BOOST_FIXTURE_TEST_CASE(prepared_statement_execute_param, tcp_network_fixture)
|
||||||
{
|
{
|
||||||
connect();
|
connect();
|
||||||
|
set_time_zone(conn);
|
||||||
|
|
||||||
for (const auto& sample : make_prepared_stmt_param_samples())
|
for (const auto& sample : make_prepared_stmt_param_samples())
|
||||||
{
|
{
|
||||||
@ -736,6 +747,8 @@ BOOST_FIXTURE_TEST_CASE(prepared_statement_execute_param, tcp_network_fixture)
|
|||||||
BOOST_FIXTURE_TEST_CASE(aliased_table_metadata, tcp_network_fixture)
|
BOOST_FIXTURE_TEST_CASE(aliased_table_metadata, tcp_network_fixture)
|
||||||
{
|
{
|
||||||
connect();
|
connect();
|
||||||
|
set_time_zone(conn);
|
||||||
|
|
||||||
boost::mysql::tcp_resultset result;
|
boost::mysql::tcp_resultset result;
|
||||||
conn.query("SELECT field_varchar AS field_alias FROM empty_table table_alias", result);
|
conn.query("SELECT field_varchar AS field_alias FROM empty_table table_alias", result);
|
||||||
std::vector<meta_validator> validators{
|
std::vector<meta_validator> validators{
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
SET NAMES utf8;
|
SET NAMES utf8;
|
||||||
SET global max_connections = 10000;
|
SET global max_connections = 10000;
|
||||||
SET session sql_mode = ''; -- allow zero and invalid dates
|
SET session sql_mode = ''; -- allow zero and invalid dates
|
||||||
|
SET session time_zone = '+02:00'; -- arbitrary, but should match whatever we use in database_types
|
||||||
|
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ static bool contains(
|
|||||||
return std::find(flagvec.begin(), flagvec.end(), flag) != flagvec.end();
|
return std::find(flagvec.begin(), flagvec.end(), flag) != flagvec.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void meta_validator::validate(const metadata& value) const
|
void meta_validator::validate(const boost::mysql::metadata& value) const
|
||||||
{
|
{
|
||||||
// Fixed fields
|
// Fixed fields
|
||||||
BOOST_TEST(value.database() == "boost_mysql_integtests");
|
BOOST_TEST(value.database() == "boost_mysql_integtests");
|
||||||
|
@ -5,38 +5,37 @@
|
|||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "network_result.hpp"
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
|
#include "network_result.hpp"
|
||||||
#include "test_common.hpp"
|
#include "test_common.hpp"
|
||||||
|
|
||||||
|
|
||||||
using namespace boost::mysql::test;
|
using namespace boost::mysql::test;
|
||||||
|
|
||||||
// network_result_base
|
// network_result_base
|
||||||
using boost::mysql::test::network_result_base;
|
using boost::mysql::test::network_result_base;
|
||||||
|
|
||||||
static const char* get_message(
|
static const char* get_message(const boost::optional<boost::mysql::error_info>& info) noexcept
|
||||||
const boost::optional<boost::mysql::error_info>& info
|
|
||||||
) noexcept
|
|
||||||
{
|
{
|
||||||
return info ? info->message().c_str() : "<unavailable>";
|
return info ? info->message().c_str() : "<unavailable>";
|
||||||
}
|
}
|
||||||
|
|
||||||
void network_result_base::validate_no_error() const
|
void network_result_base::validate_no_error() const
|
||||||
{
|
{
|
||||||
BOOST_TEST_REQUIRE(err == error_code(),
|
BOOST_TEST_REQUIRE(
|
||||||
"with error_info= " << get_message(info) << ", error_code=" << err.message());
|
err == error_code(),
|
||||||
|
"with error_info= " << get_message(info) << ", error_code=" << err.message()
|
||||||
|
);
|
||||||
if (info)
|
if (info)
|
||||||
{
|
{
|
||||||
BOOST_TEST(*info == error_info());
|
BOOST_TEST(*info == error_info());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void network_result_base::validate_any_error(
|
void network_result_base::validate_any_error(const std::vector<std::string>& expected_msg) const
|
||||||
const std::vector<std::string>& expected_msg
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
BOOST_TEST_REQUIRE(err != error_code(),
|
BOOST_TEST_REQUIRE(err != error_code(), "with error_info= " << get_message(info));
|
||||||
"with error_info= " << get_message(info));
|
|
||||||
if (info)
|
if (info)
|
||||||
{
|
{
|
||||||
validate_string_contains(info->message(), expected_msg);
|
validate_string_contains(info->message(), expected_msg);
|
||||||
@ -44,12 +43,11 @@ void network_result_base::validate_any_error(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void network_result_base::validate_error(
|
void network_result_base::validate_error(
|
||||||
error_code expected_errc,
|
boost::mysql::error_code expected_errc,
|
||||||
const std::vector<std::string>& expected_msg
|
const std::vector<std::string>& expected_msg
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
BOOST_TEST_REQUIRE(err == expected_errc,
|
BOOST_TEST_REQUIRE(err == expected_errc, "with error_info= " << get_message(info));
|
||||||
"with error_info= " << get_message(info));
|
|
||||||
if (info)
|
if (info)
|
||||||
{
|
{
|
||||||
validate_string_contains(info->message(), expected_msg);
|
validate_string_contains(info->message(), expected_msg);
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright (c) 2019-2022 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)
|
|
||||||
#
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
MYSQL_LIB_DIR=$(pwd)
|
|
||||||
|
|
||||||
# Install the library
|
|
||||||
cp -r . /opt/boost/libs/mysql
|
|
||||||
cp tools/user-config.jam ~/
|
|
||||||
|
|
||||||
# Build docs
|
|
||||||
cd /opt/boost/
|
|
||||||
export BOOST_ROOT=$(pwd)
|
|
||||||
./b2 -j4 libs/mysql/doc//boostrelease
|
|
@ -1,29 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright (c) 2019-2022 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)
|
|
||||||
#
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Config
|
|
||||||
export SOURCE_DIR=$(pwd)
|
|
||||||
export BOOST_ROOT="$HOME/boost-root"
|
|
||||||
export PATH="$BOOST_ROOT:$PATH"
|
|
||||||
|
|
||||||
# Get Boost
|
|
||||||
./tools/install_boost.sh
|
|
||||||
cd $BOOST_ROOT
|
|
||||||
|
|
||||||
# Build
|
|
||||||
./b2 \
|
|
||||||
toolset=$B2_TOOLSET \
|
|
||||||
variant=$B2_VARIANT \
|
|
||||||
cxxstd=$B2_CXXSTD \
|
|
||||||
stdlib=$B2_STDLIB \
|
|
||||||
-j4 \
|
|
||||||
libs/mysql/test \
|
|
||||||
libs/mysql/test//boost_mysql_integrationtests \
|
|
||||||
libs/mysql/example//boost_mysql_all_examples
|
|
@ -1,128 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright (c) 2019-2022 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)
|
|
||||||
#
|
|
||||||
|
|
||||||
# cwd should be our repo
|
|
||||||
# BUILD_SHARED_LIBS: required
|
|
||||||
# USE_VALGRIND: optional, to enable valgrind
|
|
||||||
# USE_COVERAGE: optional, to enable coverage
|
|
||||||
# BOOST_MYSQL_DATABASE: optional, to disable sha256 tests
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Config
|
|
||||||
export SOURCE_DIR=$(pwd)
|
|
||||||
export BOOST_ROOT="$HOME/boost-root"
|
|
||||||
export PATH="$BOOST_ROOT:$PATH"
|
|
||||||
if [ "$BOOST_MYSQL_DATABASE" != "mysql8" ]; then
|
|
||||||
export BOOST_MYSQL_NO_SHA256_TESTS=1
|
|
||||||
fi
|
|
||||||
BOOST_B2_DISTRO=$HOME/.local/boost-b2-distro
|
|
||||||
BOOST_CMAKE_DISTRO=$HOME/.local/boost-cmake-distro
|
|
||||||
CMAKE_CXX_STANDARD=20
|
|
||||||
CMAKE_BUILD_TYPE=Debug
|
|
||||||
CMAKE_TEST_FOLDER="$BOOST_ROOT/libs/mysql/test/cmake_test"
|
|
||||||
CMAKE_GENERATOR=Ninja
|
|
||||||
export LD_LIBRARY_PATH=$BOOST_B2_DISTRO/lib:$LD_LIBRARY_PATH
|
|
||||||
|
|
||||||
# Get Boost
|
|
||||||
./tools/install_boost.sh
|
|
||||||
cd "$BOOST_ROOT"
|
|
||||||
./b2 \
|
|
||||||
--prefix=$BOOST_B2_DISTRO \
|
|
||||||
--with-system \
|
|
||||||
--with-context \
|
|
||||||
--with-coroutine \
|
|
||||||
--with-date_time \
|
|
||||||
--with-test \
|
|
||||||
-d0 \
|
|
||||||
cxxstd=$CMAKE_CXX_STANDARD \
|
|
||||||
install
|
|
||||||
|
|
||||||
# Library tests, run from the superproject
|
|
||||||
cd "$BOOST_ROOT"
|
|
||||||
mkdir -p __build_cmake_test__ && cd __build_cmake_test__
|
|
||||||
cmake \
|
|
||||||
-G "$CMAKE_GENERATOR" \
|
|
||||||
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
|
|
||||||
-DCMAKE_CXX_STANDARD=$CMAKE_CXX_STANDARD \
|
|
||||||
-DBOOST_INCLUDE_LIBRARIES=mysql \
|
|
||||||
-DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
|
|
||||||
-DBUILD_TESTING=ON \
|
|
||||||
-DBoost_VERBOSE=ON \
|
|
||||||
..
|
|
||||||
cmake --build . --target tests --config $CMAKE_BUILD_TYPE -j4
|
|
||||||
ctest --output-on-failure --build-config $CMAKE_BUILD_TYPE
|
|
||||||
|
|
||||||
# Library tests, using the b2 Boost distribution generated before
|
|
||||||
cd "$BOOST_ROOT/libs/mysql"
|
|
||||||
mkdir -p __build_standalone__ && cd __build_standalone__
|
|
||||||
cmake \
|
|
||||||
-DCMAKE_PREFIX_PATH="$BOOST_B2_DISTRO" \
|
|
||||||
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
|
|
||||||
-DCMAKE_CXX_STANDARD=$CMAKE_CXX_STANDARD \
|
|
||||||
-DBOOST_MYSQL_INTEGRATION_TESTS=ON \
|
|
||||||
$(if [ "$USE_VALGRIND" == 1 ]; then echo -DBOOST_MYSQL_VALGRIND_TESTS=ON; fi) \
|
|
||||||
$(if [ "$USE_COVERAGE" == 1 ]; then echo -DBOOST_MYSQL_COVERAGE=ON; fi) \
|
|
||||||
-G "$CMAKE_GENERATOR" \
|
|
||||||
..
|
|
||||||
cmake --build . -j 4
|
|
||||||
ctest --output-on-failure --build-config $CMAKE_BUILD_TYPE
|
|
||||||
|
|
||||||
# Subdir tests, using add_subdirectory()
|
|
||||||
cd "$CMAKE_TEST_FOLDER"
|
|
||||||
mkdir -p __build_cmake_subdir_test__ && cd __build_cmake_subdir_test__
|
|
||||||
cmake \
|
|
||||||
-G "$CMAKE_GENERATOR" \
|
|
||||||
-DBOOST_CI_INSTALL_TEST=OFF \
|
|
||||||
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
|
|
||||||
-DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
|
|
||||||
..
|
|
||||||
cmake --build . --config $CMAKE_BUILD_TYPE -j4
|
|
||||||
ctest --output-on-failure --build-config $CMAKE_BUILD_TYPE
|
|
||||||
|
|
||||||
# Install the library
|
|
||||||
cd "$BOOST_ROOT"
|
|
||||||
mkdir -p __build_cmake_install_test__ && cd __build_cmake_install_test__
|
|
||||||
cmake \
|
|
||||||
-G "$CMAKE_GENERATOR" \
|
|
||||||
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
|
|
||||||
-DBOOST_INCLUDE_LIBRARIES=mysql \
|
|
||||||
-DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
|
|
||||||
-DCMAKE_INSTALL_PREFIX="$BOOST_CMAKE_DISTRO" \
|
|
||||||
-DBoost_VERBOSE=ON \
|
|
||||||
-DBoost_DEBUG=ON \
|
|
||||||
..
|
|
||||||
cmake --build . --target install --config $CMAKE_BUILD_TYPE -j4
|
|
||||||
|
|
||||||
# TODO: re-enable this when we get openssl support in the superproject generated install files
|
|
||||||
# cd "$CMAKE_TEST_FOLDER"
|
|
||||||
# mkdir __build_cmake_install_test__ && cd __build_cmake_install_test__
|
|
||||||
# cmake \
|
|
||||||
# -G "$CMAKE_GENERATOR" \
|
|
||||||
# -DBOOST_CI_INSTALL_TEST=ON \
|
|
||||||
# -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
|
|
||||||
# -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
|
|
||||||
# -DCMAKE_PREFIX_PATH="$BOOST_CMAKE_DISTRO" \
|
|
||||||
# ..
|
|
||||||
# cmake --build . --config $CMAKE_BUILD_TYPE -j4
|
|
||||||
# ctest --output-on-failure --build-config $CMAKE_BUILD_TYPE
|
|
||||||
|
|
||||||
|
|
||||||
# Gather coverage data, if available
|
|
||||||
if [ "$USE_COVERAGE" == 1 ]; then
|
|
||||||
cd "$BOOST_ROOT/libs/mysql"
|
|
||||||
|
|
||||||
# Generate an adequate coverage.info file to upload. Codecov's
|
|
||||||
# default is to compute coverage for tests and examples, too, which
|
|
||||||
# is not correct
|
|
||||||
lcov --capture --directory . -o coverage.info
|
|
||||||
lcov -o coverage.info --extract coverage.info "**include/boost/mysql/**"
|
|
||||||
|
|
||||||
# Upload the results
|
|
||||||
codecov -Z -f coverage.info
|
|
||||||
fi
|
|
@ -1,29 +0,0 @@
|
|||||||
REM
|
|
||||||
REM Copyright (c) 2019-2022 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
|
|
||||||
REM
|
|
||||||
REM Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
REM file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
REM
|
|
||||||
|
|
||||||
REM Config
|
|
||||||
SET SOURCE_DIR="%cd%"
|
|
||||||
SET BOOST_ROOT=C:\boost-root
|
|
||||||
SET OPENSSL_ROOT=C:\openssl-%B2_ADDRESS_MODEL%
|
|
||||||
SET PATH=%BOOST_ROOT%;%PATH%
|
|
||||||
SET BOOST_MYSQL_NO_UNIX_SOCKET_TESTS=1
|
|
||||||
SET BOOST_MYSQL_SERVER_HOST=localhost
|
|
||||||
|
|
||||||
REM Get Boost
|
|
||||||
call tools\install_boost.bat
|
|
||||||
cd "%BOOST_ROOT%" || exit /b 1
|
|
||||||
|
|
||||||
REM Build
|
|
||||||
.\b2 --abbreviate-paths ^
|
|
||||||
toolset=%B2_TOOLSET% ^
|
|
||||||
cxxstd=%B2_CXXSTD% ^
|
|
||||||
address-model=%B2_ADDRESS_MODEL% ^
|
|
||||||
variant=%B2_VARIANT% ^
|
|
||||||
-j4 ^
|
|
||||||
libs/mysql/test ^
|
|
||||||
libs/mysql/test//boost_mysql_integrationtests ^
|
|
||||||
libs/mysql/example//boost_mysql_all_examples || exit /b 1
|
|
417
tools/ci.py
Normal file
417
tools/ci.py
Normal file
@ -0,0 +1,417 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
#
|
||||||
|
# Copyright (c) 2019-2022 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)
|
||||||
|
#
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import List, Union
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
import stat
|
||||||
|
from shutil import rmtree, copytree, ignore_patterns
|
||||||
|
import argparse
|
||||||
|
import sys
|
||||||
|
import enum
|
||||||
|
|
||||||
|
_is_windows = os.name == 'nt'
|
||||||
|
_boost_root = Path(os.path.expanduser('~')).joinpath('boost-root')
|
||||||
|
|
||||||
|
|
||||||
|
def _run(args: List[str]) -> None:
|
||||||
|
print('+ ', args, flush=True)
|
||||||
|
subprocess.run(args, check=True)
|
||||||
|
|
||||||
|
|
||||||
|
def _add_to_path(path: Path) -> None:
|
||||||
|
sep = ';' if _is_windows else ':'
|
||||||
|
os.environ['PATH'] = '{}{}{}'.format(path, sep, os.environ["PATH"])
|
||||||
|
|
||||||
|
|
||||||
|
def _mkdir_and_cd(path: Path) -> None:
|
||||||
|
os.makedirs(path, exist_ok=True)
|
||||||
|
os.chdir(str(path))
|
||||||
|
|
||||||
|
|
||||||
|
def _cmake_bool(value: bool) -> str:
|
||||||
|
return 'ON' if value else 'OFF'
|
||||||
|
|
||||||
|
|
||||||
|
def _common_settings(
|
||||||
|
boost_root: Path,
|
||||||
|
server_host: str = 'localhost',
|
||||||
|
is_mysql8: bool = True
|
||||||
|
) -> None:
|
||||||
|
_add_to_path(boost_root)
|
||||||
|
os.environ['BOOST_MYSQL_SERVER_HOST'] = server_host
|
||||||
|
if _is_windows:
|
||||||
|
os.environ['BOOST_MYSQL_NO_UNIX_SOCKET_TESTS'] = '1'
|
||||||
|
if not is_mysql8:
|
||||||
|
os.environ['BOOST_MYSQL_NO_SHA256_TESTS'] = '1'
|
||||||
|
|
||||||
|
|
||||||
|
def _remove_readonly(func, path, _):
|
||||||
|
os.chmod(path, stat.S_IWRITE)
|
||||||
|
func(path)
|
||||||
|
|
||||||
|
|
||||||
|
class _BoostInstallType(enum.Enum):
|
||||||
|
mysql = 0
|
||||||
|
docs = 1
|
||||||
|
|
||||||
|
|
||||||
|
def _install_boost(
|
||||||
|
boost_root: Path,
|
||||||
|
source_dir: Path,
|
||||||
|
clean: bool = False,
|
||||||
|
install_type: _BoostInstallType = _BoostInstallType.mysql
|
||||||
|
) -> None:
|
||||||
|
assert boost_root.is_absolute()
|
||||||
|
assert source_dir.is_absolute()
|
||||||
|
lib_dir = boost_root.joinpath('libs', 'mysql')
|
||||||
|
|
||||||
|
# See if target exists
|
||||||
|
if boost_root.exists() and clean:
|
||||||
|
rmtree(str(boost_root), onerror=_remove_readonly)
|
||||||
|
|
||||||
|
# Clone Boost
|
||||||
|
is_clean = not boost_root.exists()
|
||||||
|
if is_clean:
|
||||||
|
_run(['git', 'clone', '-b', 'master', '--depth', '1', 'https://github.com/boostorg/boost.git', str(boost_root)])
|
||||||
|
os.chdir(str(boost_root))
|
||||||
|
|
||||||
|
# Put our library inside boost root
|
||||||
|
if lib_dir.exists() and clean:
|
||||||
|
rmtree(str(lib_dir), onerror=_remove_readonly)
|
||||||
|
copytree(
|
||||||
|
str(source_dir),
|
||||||
|
str(lib_dir),
|
||||||
|
ignore=ignore_patterns('__build*__'),
|
||||||
|
**({ 'dirs_exist_ok': True } if sys.version_info.minor >= 8 else {})
|
||||||
|
)
|
||||||
|
|
||||||
|
# Install Boost dependencies
|
||||||
|
if is_clean:
|
||||||
|
_run(["git", "config", "submodule.fetchJobs", "8"])
|
||||||
|
if install_type == _BoostInstallType.mysql:
|
||||||
|
submodules = ['tools/boostdep']
|
||||||
|
else:
|
||||||
|
submodules = [
|
||||||
|
'libs/context',
|
||||||
|
'tools/boostdep',
|
||||||
|
'tools/boostbook',
|
||||||
|
'tools/docca',
|
||||||
|
'tools/quickbook'
|
||||||
|
]
|
||||||
|
for subm in submodules:
|
||||||
|
_run(["git", "submodule", "update", "-q", "--init", subm])
|
||||||
|
if install_type == _BoostInstallType.mysql:
|
||||||
|
_run(["python", "tools/boostdep/depinst/depinst.py", "--include", "example", "mysql"])
|
||||||
|
else:
|
||||||
|
_run(['python', 'tools/boostdep/depinst/depinst.py', '../tools/quickbook'])
|
||||||
|
|
||||||
|
# Bootstrap
|
||||||
|
if is_clean:
|
||||||
|
if _is_windows:
|
||||||
|
_run(['cmd', '/q', '/c', 'bootstrap.bat'])
|
||||||
|
else:
|
||||||
|
_run(['bash', 'bootstrap.sh'])
|
||||||
|
_run(['b2', 'headers'])
|
||||||
|
|
||||||
|
|
||||||
|
def _doc_build(
|
||||||
|
source_dir: Path
|
||||||
|
):
|
||||||
|
# Get Boost. This leaves us inside boost root
|
||||||
|
_install_boost(
|
||||||
|
_boost_root,
|
||||||
|
source_dir=source_dir,
|
||||||
|
install_type=_BoostInstallType.docs
|
||||||
|
)
|
||||||
|
|
||||||
|
# Write the config file
|
||||||
|
config_path = os.path.expanduser('~/user-config.jam')
|
||||||
|
with open(config_path, 'wt') as f:
|
||||||
|
f.writelines(['using doxygen ;\n', 'using boostbook ;\n', 'using saxonhe ;\n'])
|
||||||
|
|
||||||
|
# Run b2
|
||||||
|
_run(['b2', '-j4', 'cxxstd=17', 'libs/mysql/doc//boostrelease'])
|
||||||
|
|
||||||
|
# Copy the resulting docs into a well-known path
|
||||||
|
output_dir = source_dir.joinpath('doc', 'html')
|
||||||
|
if output_dir.exists():
|
||||||
|
rmtree(output_dir)
|
||||||
|
copytree(_boost_root.joinpath('libs', 'mysql', 'doc', 'html'), output_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def _b2_build(
|
||||||
|
source_dir: Path,
|
||||||
|
toolset: str,
|
||||||
|
cxxstd: str,
|
||||||
|
variant: str,
|
||||||
|
stdlib: str = 'native',
|
||||||
|
address_model: str = '64',
|
||||||
|
clean: bool = False
|
||||||
|
) -> None:
|
||||||
|
# Config
|
||||||
|
if _is_windows:
|
||||||
|
os.environ['OPENSSL_ROOT'] = 'C:\\openssl-{}'.format(address_model)
|
||||||
|
|
||||||
|
# Get Boost. This leaves us inside boost root
|
||||||
|
_install_boost(
|
||||||
|
_boost_root,
|
||||||
|
source_dir=source_dir,
|
||||||
|
clean=clean
|
||||||
|
)
|
||||||
|
|
||||||
|
# Invoke b2
|
||||||
|
_run([
|
||||||
|
'b2',
|
||||||
|
'--abbreviate-paths',
|
||||||
|
'toolset={}'.format(toolset),
|
||||||
|
'cxxstd={}'.format(cxxstd),
|
||||||
|
'address-model={}'.format(address_model),
|
||||||
|
'variant={}'.format(variant),
|
||||||
|
'stdlib={}'.format(stdlib),
|
||||||
|
'-j4',
|
||||||
|
'libs/mysql/test',
|
||||||
|
'libs/mysql/test//boost_mysql_integrationtests',
|
||||||
|
'libs/mysql/example//boost_mysql_all_examples'
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def _build_prefix_path(*paths: Union[str, Path]) -> str:
|
||||||
|
return ';'.join(str(p) for p in paths)
|
||||||
|
|
||||||
|
|
||||||
|
def _cmake_build(
|
||||||
|
source_dir: Path,
|
||||||
|
generator: str = 'Ninja',
|
||||||
|
build_shared_libs: bool = True,
|
||||||
|
valgrind: bool = False,
|
||||||
|
coverage: bool = False,
|
||||||
|
clean: bool = False,
|
||||||
|
standalone_tests: bool = True
|
||||||
|
) -> None:
|
||||||
|
# Config
|
||||||
|
home = Path(os.path.expanduser('~'))
|
||||||
|
b2_distro = home.joinpath('b2-distro')
|
||||||
|
cmake_distro = home.joinpath('cmake-distro')
|
||||||
|
cxxstd = '20'
|
||||||
|
build_type = 'Debug'
|
||||||
|
test_folder = _boost_root.joinpath('libs', 'mysql', 'test', 'cmake_test')
|
||||||
|
if _is_windows:
|
||||||
|
cmake_prefix_path = ['C:\\openssl-64']
|
||||||
|
else:
|
||||||
|
cmake_prefix_path = []
|
||||||
|
old_ld_libpath = os.environ.get("LD_LIBRARY_PATH", "")
|
||||||
|
os.environ['LD_LIBRARY_PATH'] = '{}/lib:{}'.format(b2_distro, old_ld_libpath)
|
||||||
|
|
||||||
|
# Get Boost
|
||||||
|
_install_boost(
|
||||||
|
_boost_root,
|
||||||
|
source_dir,
|
||||||
|
clean=clean
|
||||||
|
)
|
||||||
|
|
||||||
|
# Generate "pre-built" b2 distro
|
||||||
|
if standalone_tests:
|
||||||
|
_run([
|
||||||
|
'b2',
|
||||||
|
'--prefix={}'.format(b2_distro),
|
||||||
|
'--with-system',
|
||||||
|
'--with-context',
|
||||||
|
'--with-coroutine',
|
||||||
|
'--with-date_time',
|
||||||
|
'--with-test',
|
||||||
|
'-d0',
|
||||||
|
'cxxstd={}'.format(cxxstd),
|
||||||
|
'install'
|
||||||
|
])
|
||||||
|
|
||||||
|
# Don't include our library, as this confuses coverage reports
|
||||||
|
if coverage:
|
||||||
|
rmtree(b2_distro.joinpath('include', 'boost', 'mysql'))
|
||||||
|
|
||||||
|
# Library tests, run from the superproject
|
||||||
|
_mkdir_and_cd(_boost_root.joinpath('__build_cmake_test__'))
|
||||||
|
_run([
|
||||||
|
'cmake',
|
||||||
|
'-G',
|
||||||
|
generator,
|
||||||
|
'-DCMAKE_PREFIX_PATH={}'.format(_build_prefix_path(*cmake_prefix_path)),
|
||||||
|
'-DCMAKE_BUILD_TYPE={}'.format(build_type),
|
||||||
|
'-DCMAKE_CXX_STANDARD={}'.format(cxxstd),
|
||||||
|
'-DBOOST_INCLUDE_LIBRARIES=mysql',
|
||||||
|
'-DBUILD_SHARED_LIBS={}'.format(_cmake_bool(build_shared_libs)),
|
||||||
|
'-DBUILD_TESTING=ON',
|
||||||
|
'-DBoost_VERBOSE=ON',
|
||||||
|
'..'
|
||||||
|
])
|
||||||
|
_run(['cmake', '--build', '.', '--target', 'tests', '--config', build_type, '-j4'])
|
||||||
|
_run(['ctest', '--output-on-failure', '--build-config', build_type])
|
||||||
|
|
||||||
|
# Library tests, using the b2 Boost distribution generated before
|
||||||
|
if standalone_tests:
|
||||||
|
_mkdir_and_cd(_boost_root.joinpath('libs', 'mysql', '__build_standalone__'))
|
||||||
|
_run([
|
||||||
|
'cmake',
|
||||||
|
'-DCMAKE_PREFIX_PATH={}'.format(_build_prefix_path(b2_distro, *cmake_prefix_path)),
|
||||||
|
'-DCMAKE_BUILD_TYPE={}'.format(build_type),
|
||||||
|
'-DCMAKE_CXX_STANDARD={}'.format(cxxstd),
|
||||||
|
'-DBOOST_MYSQL_INTEGRATION_TESTS=ON',
|
||||||
|
'-DBOOST_MYSQL_VALGRIND_TESTS={}'.format(_cmake_bool(valgrind)),
|
||||||
|
'-DBOOST_MYSQL_COVERAGE={}'.format(_cmake_bool(coverage)),
|
||||||
|
'-G',
|
||||||
|
generator,
|
||||||
|
'..'
|
||||||
|
])
|
||||||
|
_run(['cmake', '--build', '.', '-j4'])
|
||||||
|
_run(['ctest', '--output-on-failure', '--build-config', build_type])
|
||||||
|
|
||||||
|
|
||||||
|
# Subdir tests, using add_subdirectory()
|
||||||
|
_mkdir_and_cd(test_folder.joinpath('__build_cmake_subdir_test__'))
|
||||||
|
_run([
|
||||||
|
'cmake',
|
||||||
|
'-G',
|
||||||
|
generator,
|
||||||
|
'-DCMAKE_PREFIX_PATH={}'.format(_build_prefix_path(*cmake_prefix_path)),
|
||||||
|
'-DBOOST_CI_INSTALL_TEST=OFF',
|
||||||
|
'-DCMAKE_BUILD_TYPE={}'.format(build_type),
|
||||||
|
'-DBUILD_SHARED_LIBS={}'.format(_cmake_bool(build_shared_libs)),
|
||||||
|
'..'
|
||||||
|
])
|
||||||
|
_run(['cmake', '--build', '.', '--config', build_type, '-j4'])
|
||||||
|
_run(['ctest', '--output-on-failure', '--build-config', build_type])
|
||||||
|
|
||||||
|
# Install the library
|
||||||
|
_mkdir_and_cd(_boost_root.joinpath('__build_cmake_install_test__'))
|
||||||
|
_run([
|
||||||
|
'cmake',
|
||||||
|
'-G',
|
||||||
|
generator,
|
||||||
|
'-DCMAKE_PREFIX_PATH={}'.format(_build_prefix_path(*cmake_prefix_path)),
|
||||||
|
'-DCMAKE_BUILD_TYPE={}'.format(build_type),
|
||||||
|
'-DBOOST_INCLUDE_LIBRARIES=mysql',
|
||||||
|
'-DBUILD_SHARED_LIBS={}'.format(_cmake_bool(build_shared_libs)),
|
||||||
|
'-DCMAKE_INSTALL_PREFIX={}'.format(cmake_distro),
|
||||||
|
'-DBoost_VERBOSE=ON',
|
||||||
|
'-DBoost_DEBUG=ON',
|
||||||
|
'-DCMAKE_INSTALL_MESSAGE=NEVER',
|
||||||
|
'..'
|
||||||
|
])
|
||||||
|
_run(['cmake', '--build', '.', '--target', 'install', '--config', build_type, '-j4'])
|
||||||
|
|
||||||
|
# TODO: re-enable this when we get openssl support in the superproject generated install files
|
||||||
|
# _mkdir_and_cd(test_folder.joinpath('__build_cmake_install_test__'))
|
||||||
|
# _run([
|
||||||
|
# 'cmake',
|
||||||
|
# '-G',
|
||||||
|
# generator,
|
||||||
|
# '-DBOOST_CI_INSTALL_TEST=ON',
|
||||||
|
# '-DCMAKE_BUILD_TYPE={}'.format(build_type),
|
||||||
|
# '-DBUILD_SHARED_LIBS={}'.format(_cmake_bool(build_shared_libs)),
|
||||||
|
# '-DCMAKE_PREFIX_PATH={}'.format(_build_prefix_path(cmake_distro, *cmake_prefix_path)),
|
||||||
|
# '..'
|
||||||
|
# ])
|
||||||
|
# _run(['cmake', '--build', '.', '--config', build_type, '-j4'])
|
||||||
|
# _run(['ctest', '--output-on-failure', '--build-config', build_type])
|
||||||
|
|
||||||
|
# Subdir tests, using find_package with the b2 distribution.
|
||||||
|
# These are incompatible with coverage builds (we rmtree include/boost/mysql)
|
||||||
|
if standalone_tests and not coverage:
|
||||||
|
_mkdir_and_cd(_boost_root.joinpath('libs', 'mysql', 'test', 'cmake_b2_test', '__build_cmake_b2_test__'))
|
||||||
|
_run([
|
||||||
|
'cmake',
|
||||||
|
'-G',
|
||||||
|
generator,
|
||||||
|
'-DCMAKE_PREFIX_PATH={}'.format(_build_prefix_path(*cmake_prefix_path, b2_distro)),
|
||||||
|
'-DCMAKE_BUILD_TYPE={}'.format(build_type),
|
||||||
|
'-DBUILD_TESTING=ON',
|
||||||
|
'..'
|
||||||
|
])
|
||||||
|
_run(['cmake', '--build', '.', '--config', build_type, '-j4'])
|
||||||
|
_run(['ctest', '--output-on-failure', '--build-config', build_type])
|
||||||
|
|
||||||
|
# Gather coverage data, if available
|
||||||
|
if coverage:
|
||||||
|
lib_dir = str(_boost_root.joinpath('libs', 'mysql'))
|
||||||
|
os.chdir(lib_dir)
|
||||||
|
|
||||||
|
# Generate an adequate coverage.info file to upload. Codecov's
|
||||||
|
# default is to compute coverage for tests and examples, too, which
|
||||||
|
# is not correct
|
||||||
|
_run(['lcov', '--capture', '--no-external', '--directory', '.', '-o', 'coverage.info'])
|
||||||
|
_run(['lcov', '-o', 'coverage.info', '--extract', 'coverage.info', '**include/boost/mysql/**'])
|
||||||
|
|
||||||
|
# Make all file parts rooted at $BOOST_ROOT/libs/mysql (required by codecov)
|
||||||
|
with open('coverage.info', 'rt') as f:
|
||||||
|
lines = [l.replace('SF:{}'.format(lib_dir), 'SF:') for l in f]
|
||||||
|
with open('coverage.info', 'wt') as f:
|
||||||
|
f.writelines(lines)
|
||||||
|
|
||||||
|
# Upload the results
|
||||||
|
_run(['codecov', '-Z', '-f', 'coverage.info'])
|
||||||
|
|
||||||
|
|
||||||
|
def _str2bool(v: Union[bool, str]) -> bool:
|
||||||
|
if isinstance(v, bool):
|
||||||
|
return v
|
||||||
|
elif v == '1':
|
||||||
|
return True
|
||||||
|
elif v == '0':
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
raise argparse.ArgumentTypeError('Boolean value expected.')
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('--build-kind', choices=['b2', 'cmake', 'docs'], required=True)
|
||||||
|
parser.add_argument('--source-dir', type=Path, required=True)
|
||||||
|
parser.add_argument('--generator', default='Ninja')
|
||||||
|
parser.add_argument('--build-shared-libs', type=_str2bool, default=True)
|
||||||
|
parser.add_argument('--valgrind', type=_str2bool, default=False)
|
||||||
|
parser.add_argument('--coverage', type=_str2bool, default=False)
|
||||||
|
parser.add_argument('--clean', type=_str2bool, default=False)
|
||||||
|
parser.add_argument('--is-mysql8', type=_str2bool, default=True)
|
||||||
|
parser.add_argument('--cmake-standalone-tests', type=_str2bool, default=True)
|
||||||
|
parser.add_argument('--toolset', default='clang')
|
||||||
|
parser.add_argument('--cxxstd', default='20')
|
||||||
|
parser.add_argument('--variant', default='release')
|
||||||
|
parser.add_argument('--stdlib', choices=['native', 'libc++'], default='native')
|
||||||
|
parser.add_argument('--address-model', choices=['32', '64'], default='64')
|
||||||
|
parser.add_argument('--server-host', default='localhost')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
_common_settings(_boost_root, args.server_host, is_mysql8=args.is_mysql8)
|
||||||
|
if args.build_kind == 'b2':
|
||||||
|
_b2_build(
|
||||||
|
source_dir=args.source_dir,
|
||||||
|
toolset=args.toolset,
|
||||||
|
cxxstd=args.cxxstd,
|
||||||
|
variant=args.variant,
|
||||||
|
stdlib=args.stdlib,
|
||||||
|
address_model=args.address_model,
|
||||||
|
clean=args.clean
|
||||||
|
)
|
||||||
|
elif args.build_kind == 'cmake':
|
||||||
|
_cmake_build(
|
||||||
|
source_dir=args.source_dir,
|
||||||
|
generator=args.generator,
|
||||||
|
build_shared_libs=args.build_shared_libs,
|
||||||
|
valgrind=args.valgrind,
|
||||||
|
coverage=args.coverage,
|
||||||
|
clean=args.clean,
|
||||||
|
standalone_tests=args.cmake_standalone_tests
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
_doc_build(source_dir=args.source_dir)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
@ -14,7 +14,8 @@ RUN \
|
|||||||
clang-11 \
|
clang-11 \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
git \
|
git \
|
||||||
python && \
|
python3 \
|
||||||
|
python-is-python3 && \
|
||||||
ln -s /usr/bin/clang++-11 /usr/bin/clang++ && \
|
ln -s /usr/bin/clang++-11 /usr/bin/clang++ && \
|
||||||
ln -s /usr/bin/clang-11 /usr/bin/clang
|
ln -s /usr/bin/clang-11 /usr/bin/clang
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ RUN \
|
|||||||
ca-certificates \
|
ca-certificates \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
git \
|
git \
|
||||||
python && \
|
python3 && \
|
||||||
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
|
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
|
||||||
apt-get --no-install-recommends -y install clang-3.6 && \
|
apt-get --no-install-recommends -y install clang-3.6 && \
|
||||||
ln -s /usr/bin/clang++-3.6 /usr/bin/clang++ && \
|
ln -s /usr/bin/clang++-3.6 /usr/bin/clang++ && \
|
||||||
ln -s /usr/bin/clang-3.6 /usr/bin/clang
|
ln -s /usr/bin/clang-3.6 /usr/bin/clang && \
|
||||||
|
ln -s /usr/bin/python3 /usr/bin/python
|
||||||
|
@ -14,7 +14,8 @@ RUN \
|
|||||||
clang-7 \
|
clang-7 \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
git \
|
git \
|
||||||
python && \
|
python3 \
|
||||||
|
python-is-python3 && \
|
||||||
ln -s /usr/bin/clang++-7 /usr/bin/clang++ && \
|
ln -s /usr/bin/clang++-7 /usr/bin/clang++ && \
|
||||||
ln -s /usr/bin/clang-7 /usr/bin/clang
|
ln -s /usr/bin/clang-7 /usr/bin/clang
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@ RUN \
|
|||||||
g++-10 \
|
g++-10 \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
git \
|
git \
|
||||||
python && \
|
python3 \
|
||||||
|
python-is-python3 && \
|
||||||
ln -s /usr/bin/g++-10 /usr/bin/g++ && \
|
ln -s /usr/bin/g++-10 /usr/bin/g++ && \
|
||||||
ln -s /usr/bin/gcc-10 /usr/bin/gcc
|
ln -s /usr/bin/gcc-10 /usr/bin/gcc
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ RUN \
|
|||||||
ca-certificates \
|
ca-certificates \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
git \
|
git \
|
||||||
python && \
|
python3 && \
|
||||||
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
|
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
|
||||||
apt-get --no-install-recommends -y install gcc-5 g++-5 && \
|
apt-get --no-install-recommends -y install gcc-5 g++-5 && \
|
||||||
ln -s /usr/bin/g++-5 /usr/bin/g++ && \
|
ln -s /usr/bin/g++-5 /usr/bin/g++ && \
|
||||||
ln -s /usr/bin/gcc-5 /usr/bin/gcc
|
ln -s /usr/bin/gcc-5 /usr/bin/gcc && \
|
||||||
|
ln -s /usr/bin/python3 /usr/bin/python
|
||||||
|
@ -14,9 +14,10 @@ RUN \
|
|||||||
ca-certificates \
|
ca-certificates \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
git \
|
git \
|
||||||
python && \
|
python3 && \
|
||||||
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
|
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
|
||||||
apt-get --no-install-recommends -y install gcc-6 g++-6 && \
|
apt-get --no-install-recommends -y install gcc-6 g++-6 && \
|
||||||
ln -s /usr/bin/g++-6 /usr/bin/g++ && \
|
ln -s /usr/bin/g++-6 /usr/bin/g++ && \
|
||||||
ln -s /usr/bin/gcc-6 /usr/bin/gcc
|
ln -s /usr/bin/gcc-6 /usr/bin/gcc && \
|
||||||
|
ln -s /usr/bin/python3 /usr/bin/python
|
||||||
|
|
||||||
|
@ -17,7 +17,8 @@ apt-get install --no-install-recommends -y \
|
|||||||
wget \
|
wget \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
clang-11 \
|
clang-11 \
|
||||||
python \
|
python3 \
|
||||||
|
python-is-python3 \
|
||||||
rsync
|
rsync
|
||||||
ln -s /usr/bin/clang++-11 /usr/bin/clang++
|
ln -s /usr/bin/clang++-11 /usr/bin/clang++
|
||||||
ln -s /usr/bin/clang-11 /usr/bin/clang
|
ln -s /usr/bin/clang-11 /usr/bin/clang
|
||||||
@ -47,16 +48,3 @@ cd $DOCBOOK_DTD_DIR
|
|||||||
wget -q http://www.oasis-open.org/docbook/xml/4.2/docbook-xml-4.2.zip
|
wget -q http://www.oasis-open.org/docbook/xml/4.2/docbook-xml-4.2.zip
|
||||||
unzip -o -qq docbook-xml-4.2.zip
|
unzip -o -qq docbook-xml-4.2.zip
|
||||||
rm docbook-xml-4.2.zip
|
rm docbook-xml-4.2.zip
|
||||||
|
|
||||||
# Install and initialize Boost
|
|
||||||
git clone --branch boost-1.78.0 https://github.com/boostorg/boost.git /opt/boost --depth 1
|
|
||||||
cd /opt/boost
|
|
||||||
export BOOST_ROOT=$(pwd)
|
|
||||||
git config submodule.fetchJobs 8
|
|
||||||
git submodule update --init libs/context
|
|
||||||
git submodule update --init tools/boostbook
|
|
||||||
git submodule update --init tools/boostdep
|
|
||||||
git submodule update --init tools/docca
|
|
||||||
git submodule update --init tools/quickbook
|
|
||||||
python tools/boostdep/depinst/depinst.py ../tools/quickbook
|
|
||||||
./bootstrap.sh
|
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
REM
|
|
||||||
REM Copyright (c) 2019-2022 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
|
|
||||||
|
|
||||||
REM BOOST_ROOT: required, directory where boost should be located
|
|
||||||
REM SOURCE_DIR: required, path to our library
|
|
||||||
REM USE_SYMLINK: optional, whether to copy mysql or use symlinks
|
|
||||||
|
|
||||||
@echo off
|
|
||||||
if not exist %BOOST_ROOT% (
|
|
||||||
|
|
||||||
REM Clone Boost
|
|
||||||
git clone -b master --depth 1 https://github.com/boostorg/boost.git %BOOST_ROOT% || exit /b 1
|
|
||||||
cd %BOOST_ROOT% || exit /b 1
|
|
||||||
|
|
||||||
REM Put our library inside boost root. Symlinks are used during local development
|
|
||||||
if "%USE_SYMLINK%" == "1" (
|
|
||||||
mklink /d %BOOST_ROOT%\libs\mysql %SOURCE_DIR% || exit /b 1
|
|
||||||
) else (
|
|
||||||
mkdir libs\mysql || exit /b 1
|
|
||||||
xcopy /s /e /q /I %SOURCE_DIR%\* %BOOST_ROOT%\libs\mysql\ || exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
REM Install Boost dependencies
|
|
||||||
git config submodule.fetchJobs 8 || exit /b 1 REM If supported, this will accelerate depinst
|
|
||||||
git submodule update -q --init tools/boostdep || exit /b 1
|
|
||||||
python tools/boostdep/depinst/depinst.py --include example mysql || exit /b 1
|
|
||||||
|
|
||||||
REM Booststrap
|
|
||||||
.\bootstrap.bat || exit /b 1
|
|
||||||
.\b2 headers || exit /b 1
|
|
||||||
|
|
||||||
)
|
|
@ -1,38 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright (c) 2019-2022 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)
|
|
||||||
#
|
|
||||||
|
|
||||||
# BOOST_ROOT: required, directory where boost should be located
|
|
||||||
# SOURCE_DIR: required, path to our library
|
|
||||||
# USE_SYMLINK: optional, whether to copy mysql or use symlinks
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ ! -d $BOOST_ROOT ]; then
|
|
||||||
|
|
||||||
# Clone Boost
|
|
||||||
git clone -b master --depth 1 https://github.com/boostorg/boost.git $BOOST_ROOT
|
|
||||||
cd $BOOST_ROOT
|
|
||||||
|
|
||||||
# Put our library inside boost root. Symlinks are used during local development
|
|
||||||
if [ "$USE_SYMLINK" == "1" ]; then
|
|
||||||
ln -s $SOURCE_DIR $BOOST_ROOT/libs/mysql
|
|
||||||
else
|
|
||||||
mkdir -p libs/mysql
|
|
||||||
cp -rf $SOURCE_DIR/* $BOOST_ROOT/libs/mysql/
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install Boost dependencies
|
|
||||||
git config submodule.fetchJobs 8 # If supported, this will accelerate depinst
|
|
||||||
git submodule update -q --init tools/boostdep
|
|
||||||
python tools/boostdep/depinst/depinst.py --include example mysql
|
|
||||||
|
|
||||||
# Booststrap
|
|
||||||
./bootstrap.sh
|
|
||||||
./b2 headers
|
|
||||||
|
|
||||||
fi
|
|
@ -1,12 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright (c) 2019-2022 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)
|
|
||||||
#
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
docker start docbuilder || docker run -dit --name docbuilder -v ~/workspace/mysql:/opt/boost/libs/mysql anarthal-containers/build-docs
|
|
||||||
docker exec docbuilder /opt/boost/libs/mysql/tools/scripts/build_docs_local_docker.sh
|
|
@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright (c) 2019-2022 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)
|
|
||||||
#
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
cd /opt/boost/
|
|
||||||
export BOOST_ROOT=$(pwd)
|
|
||||||
cp libs/mysql/tools/user-config.jam ~/
|
|
||||||
rm -rf bin.v2/libs/mysql
|
|
||||||
./b2 -j4 libs/mysql/doc//boostrelease
|
|
@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright (c) 2019-2022 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)
|
|
||||||
#
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
export B2_VARIANT=debug
|
|
||||||
export B2_CXXSTD=20
|
|
||||||
export B2_STDLIB=libc++
|
|
||||||
export B2_TOOLSET=clang-14
|
|
||||||
export BOOST_MYSQL_SERVER_HOST=mysql
|
|
||||||
export USE_SYMLINK=1
|
|
||||||
|
|
||||||
# The CI script expect us to be in the source directory
|
|
||||||
cd /opt/boost-mysql
|
|
||||||
|
|
||||||
# rm -rf ~/boost-root
|
|
||||||
./tools/build_unix_b2.sh
|
|
@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright (c) 2019-2022 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)
|
|
||||||
#
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
export BUILD_SHARED_LIBS=OFF
|
|
||||||
export USE_VALGRIND=0
|
|
||||||
export USE_COVERAGE=0
|
|
||||||
export BOOST_MYSQL_DATABASE=mysql8
|
|
||||||
export BOOST_MYSQL_SERVER_HOST=mysql
|
|
||||||
export USE_SYMLINK=0 # subdir tests don't like symlinks
|
|
||||||
|
|
||||||
# The CI script expect us to be in the source directory
|
|
||||||
cd /opt/boost-mysql
|
|
||||||
|
|
||||||
# rm -rf ~/boost-root
|
|
||||||
./tools/build_unix_cmake.sh
|
|
@ -8,13 +8,24 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
IMAGE=build-clang14
|
IMAGE=build-docs
|
||||||
TYPE=cmake
|
|
||||||
# TYPE=b2
|
|
||||||
|
|
||||||
CONTAINER=builder-$IMAGE
|
CONTAINER=builder-$IMAGE
|
||||||
|
FULL_IMAGE=ghcr.io/anarthal-containers/$IMAGE
|
||||||
|
|
||||||
docker start mysql
|
docker start mysql
|
||||||
docker start $CONTAINER || docker run -dit --name $CONTAINER -v ~/workspace/mysql:/opt/boost-mysql -v /var/run/mysqld:/var/run/mysqld ghcr.io/anarthal-containers/$IMAGE
|
docker start $CONTAINER || docker run -dit \
|
||||||
|
--name $CONTAINER \
|
||||||
|
-v ~/workspace/mysql:/opt/boost-mysql \
|
||||||
|
-v /var/run/mysqld:/var/run/mysqld \
|
||||||
|
$FULL_IMAGE
|
||||||
docker network connect my-net $CONTAINER || echo "Network already connected"
|
docker network connect my-net $CONTAINER || echo "Network already connected"
|
||||||
docker exec $CONTAINER /opt/boost-mysql/tools/scripts/build_unix_${TYPE}_local_docker.sh
|
docker exec $CONTAINER python /opt/boost-mysql/tools/ci.py --source-dir=/opt/boost-mysql --server-host=mysql \
|
||||||
|
--build-kind=docs \
|
||||||
|
--build-shared-libs=1 \
|
||||||
|
--valgrind=0 \
|
||||||
|
--coverage=0 \
|
||||||
|
--clean=0 \
|
||||||
|
--toolset=clang \
|
||||||
|
--cxxstd=20 \
|
||||||
|
--variant=debug \
|
||||||
|
--stdlib=native
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2019-2022 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)
|
|
||||||
#
|
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
$Env:B2_TOOLSET = "msvc"
|
|
||||||
$Env:B2_CXXSTD = "11,14,17"
|
|
||||||
$Env:B2_ADDRESS_MODEL = "32"
|
|
||||||
$Env:B2_VARIANT = "debug,release"
|
|
||||||
$Env:USE_SYMLINK = "1"
|
|
||||||
|
|
||||||
# The CI script expect us to be in the source directory
|
|
||||||
cd "C:\boost-mysql"
|
|
||||||
|
|
||||||
# Symlink handling
|
|
||||||
# if (Test-Path "C:\boost-root\libs\mysql") {
|
|
||||||
# (Get-Item "C:\boost-root\libs\mysql").Delete()
|
|
||||||
# }
|
|
||||||
# if (Test-Path "C:\boost-root") {
|
|
||||||
# Remove-Item -Recurse -Force "C:\boost-root"
|
|
||||||
# }
|
|
||||||
cmd /q /c tools\build_windows_b2.bat
|
|
@ -1,22 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2019-2022 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)
|
|
||||||
#
|
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
$Env:BUILD_SHARED_LIBS = "ON"
|
|
||||||
|
|
||||||
# The CI script expect us to be in the source directory
|
|
||||||
cd "C:\boost-mysql"
|
|
||||||
|
|
||||||
# # Symlink handling
|
|
||||||
# if (Test-Path "C:\boost-root\libs\mysql") {
|
|
||||||
# (Get-Item "C:\boost-root\libs\mysql").Delete()
|
|
||||||
# }
|
|
||||||
# if (Test-Path "C:\boost-root") {
|
|
||||||
# Remove-Item -Recurse -Force "C:\boost-root"
|
|
||||||
# }
|
|
||||||
cmd /q /c tools\build_windows_cmake.bat
|
|
@ -1,17 +1,21 @@
|
|||||||
REM
|
@REM
|
||||||
REM Copyright (c) 2019-2022 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
|
@REM Copyright (c) 2019-2022 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
|
||||||
REM
|
@REM
|
||||||
REM Distributed under the Boost Software License, Version 1.0. (See accompanying
|
@REM Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
REM file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
@REM file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
REM
|
@REM
|
||||||
|
|
||||||
SETLOCAL
|
|
||||||
SET IMAGE=build-msvc14_3
|
SET IMAGE=build-msvc14_3
|
||||||
SET TYPE=cmake
|
SET IMAGE_TAG=4e726c8dd2c8b4f9589a5c3ea892301e7e4a285f
|
||||||
@REM SET TYPE=b2
|
|
||||||
|
|
||||||
SET CONTAINER="builder-%IMAGE%"
|
SET CONTAINER="builder-%IMAGE%"
|
||||||
docker start %CONTAINER% || docker run -dit --name %CONTAINER% -v "%USERPROFILE%\mysql:C:\boost-mysql" "ghcr.io/anarthal-containers/%IMAGE%" || exit /b 1
|
docker start %CONTAINER% || docker run -dit --name %CONTAINER% -v "%USERPROFILE%\mysql:C:\boost-mysql" "ghcr.io/anarthal-containers/%IMAGE%:%IMAGE_TAG%" || exit /b 1
|
||||||
docker exec %CONTAINER% powershell.exe "C:\boost-mysql\tools\scripts\build_windows_%TYPE%_local_docker.ps1" || exit /b 1
|
docker exec %CONTAINER% python.exe "C:\boost-mysql\tools\ci.py" --source-dir=C:\boost-mysql --toolset=msvc ^
|
||||||
|
--build-kind=cmake ^
|
||||||
ENDLOCAL
|
"--generator=Visual Studio 17 2022" ^
|
||||||
|
--build-shared-libs=1 ^
|
||||||
|
--clean=1 ^
|
||||||
|
--cmake-standalone-tests=0 ^
|
||||||
|
--cxxstd=20 ^
|
||||||
|
--variant=debug ^
|
||||||
|
--address-model=32 || exit /b 1
|
||||||
|
@ -132,7 +132,7 @@ sql_processor = NormalProcessor('sql', gen_header('--'))
|
|||||||
cpp_processor = NormalProcessor('cpp', gen_header('//'))
|
cpp_processor = NormalProcessor('cpp', gen_header('//'))
|
||||||
py_processor = NormalProcessor('py', gen_header('#', shebang='#!/usr/bin/python3'))
|
py_processor = NormalProcessor('py', gen_header('#', shebang='#!/usr/bin/python3'))
|
||||||
bash_processor = NormalProcessor('bash', gen_header('#', shebang='#!/bin/bash'))
|
bash_processor = NormalProcessor('bash', gen_header('#', shebang='#!/bin/bash'))
|
||||||
bat_processor = NormalProcessor('bat', gen_header('REM'))
|
bat_processor = NormalProcessor('bat', gen_header('@REM'))
|
||||||
|
|
||||||
FILE_PROCESSORS = [
|
FILE_PROCESSORS = [
|
||||||
('docca-base-stage2-noescape.xsl', IgnoreProcessor()),
|
('docca-base-stage2-noescape.xsl', IgnoreProcessor()),
|
||||||
@ -197,7 +197,7 @@ namespace mysql {{
|
|||||||
* \\details Some error codes are defined by the client library, and others
|
* \\details Some error codes are defined by the client library, and others
|
||||||
* are returned from the server. For the latter, the numeric value and
|
* are returned from the server. For the latter, the numeric value and
|
||||||
* string descriptions match the ones described in the MySQL documentation.
|
* string descriptions match the ones described in the MySQL documentation.
|
||||||
* See [mysqlerrlink the MySQL error reference]
|
* See <a href="https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html">the MySQL error reference</a>
|
||||||
* for more info on server errors.
|
* for more info on server errors.
|
||||||
*/
|
*/
|
||||||
enum class errc : int
|
enum class errc : int
|
||||||
@ -247,7 +247,7 @@ constexpr error_entry all_errors [] = {{
|
|||||||
def generate_errc_entry(err):
|
def generate_errc_entry(err):
|
||||||
if err.is_server:
|
if err.is_server:
|
||||||
doc = ('Server error. Error number: {}, symbol: ' + \
|
doc = ('Server error. Error number: {}, symbol: ' + \
|
||||||
'[mysqlerrlink2 error_er_{} ER_{}].').format(
|
'<a href="https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_{}">ER_{}</a>.').format(
|
||||||
err.number, err.symbol, err.symbol.upper())
|
err.number, err.symbol, err.symbol.upper())
|
||||||
else:
|
else:
|
||||||
if err.number == 0:
|
if err.number == 0:
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2019-2022 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)
|
|
||||||
#
|
|
||||||
|
|
||||||
using doxygen ;
|
|
||||||
using boostbook ;
|
|
||||||
using saxonhe ;
|
|
Loading…
x
Reference in New Issue
Block a user