removed Qt v5 support since TinyORM v0.38.0 🎉🕺🙌

Removed Qt v5.15 support since TinyORM v0.38.0, finally.

Minimum required Qt version is now v6.2!

Day of celebration is today. 😁

 - removed all #if QT_VERSION macro checks
 - updated docs
 - workflows removed Qt v5 related pipelines
 - updated all comments
 - vcpkg removed tinyorm-qt5 port
 - updated Gentoo build
 - updated README.md Qt v5 badges
 - tools removed Qt v5 related scripts
 - tools updated deploy.ps1 script
This commit is contained in:
silverqx
2024-06-28 14:57:59 +02:00
parent 5b8ff7542f
commit eda9df9f9e
79 changed files with 127 additions and 2152 deletions
+4 -13
View File
@@ -4,7 +4,7 @@
# This /ccache_vcpkg folder is common for analyzers.yml and vcpkg-linux.yml workflows
# vcpkg-linux.yml takes 205M and analyzers.yml takes 155M
name: Clang-Tidy and Clazy Qt5.15/6.7
name: Clang-Tidy and Clazy 6.7
# Invoke manually from the command-line using the gh command, eg.:
# gh workflow run --ref silverqx-develop
@@ -36,11 +36,8 @@ jobs:
# Clang Tidy can't be executed on Release builds, it's designed to be run on Debug builds only
strategy:
matrix:
# Leaving here this matrix for future versions
qt:
- key: qt5
name: Qt5
version: 5.15.2
- key: qt6
name: Qt6
version: 6.7.2
@@ -159,15 +156,9 @@ jobs:
ccache --zero-stats
# CMAKE_DISABLE_PRECOMPILE_HEADERS=ON is correct (Clazy is failing with OFF)
# TinyDrivers are disabled for Qt v5.15
- name: TinyORM cmake configure (${{ env.TinyORMBuildName }})
working-directory: ${{ env.TinyORMPath }}
run: >-
[[ '${{ matrix.qt.key }}' == 'qt6' ]] && tinyBuildDrivers='ON' || tinyBuildDrivers='OFF'
[[ '${{ matrix.qt.key }}' == 'qt6' ]] &&
tinyDriversType='-D DRIVERS_TYPE:STRING=Loadable' || tinyDriversType=''
cmake --log-level=DEBUG --log-context
-S .
-B "$TinyORMBuildTree"
@@ -190,8 +181,8 @@ jobs:
-D ORM:BOOL=ON
-D TOM:BOOL=ON
-D TOM_EXAMPLE:BOOL=ON
-D BUILD_DRIVERS:BOOL=$tinyBuildDrivers
$tinyDriversType
-D BUILD_DRIVERS:BOOL=ON
-D DRIVERS_TYPE:STRING=Loadable
- name: TinyORM cmake build ✨ (${{ env.TinyORMBuildName }})
working-directory: ${{ env.TinyORMBuildTree }}
-413
View File
@@ -1,413 +0,0 @@
# MySQL and PostgreSQL
# ---
# Both use the default unencrypted database connections.
name: Linux GCC/Clang Qt5.15
on:
workflow_dispatch:
push:
branches:
- main
- gh-actions
jobs:
build:
name: cmake build / ctest
runs-on: ubuntu-24.04
env:
# Settings (constant variables)
# This number must also be changed in the matrix as env context can't be used in the matrix
TINY_LLVM_VERSION: 18
TINY_LLVM_APT_NAME: noble
# First value is a compressed data size
# gcc: ~ 115 * 3 + 100 ; clang: ~ 90 * 3 + 100
TINY_CCACHE_MAX_SIZE_GCC: 450M
TINY_CCACHE_MAX_SIZE_CLANG: 380M
# Clang and vcpkg use $(nproc) (max. available cores)
TINY_PARALLEL_GCC: 2
strategy:
matrix:
compiler:
- key: clang
name: clang18
apt: [ clang-18, lld-18 ]
command: clang++-18
- key: gcc
name: gcc12
apt: [ g++-12 ]
command: g++-12
steps:
- uses: actions/checkout@v4
- name: TinyORM prepare environment
run: |
runnerWorkPath=$(realpath "$RUNNER_WORKSPACE/..")
echo "TinyRunnerWorkPath=$runnerWorkPath" >> $GITHUB_ENV
sqlitePath="$runnerWorkPath/SQLite/$DB_SQLITE_DATABASE"
echo "TinySQLitePath=$sqlitePath" >> $GITHUB_ENV
[[ '${{ matrix.compiler.key }}' == 'gcc' ]] && ccacheMaxSize="$TINY_CCACHE_MAX_SIZE_GCC" \
|| ccacheMaxSize="$TINY_CCACHE_MAX_SIZE_CLANG"
echo "TinyCcacheMaxSize=$ccacheMaxSize" >> $GITHUB_ENV
[[ '${{ matrix.compiler.key }}' == 'gcc' ]] && parallel=$TINY_PARALLEL_GCC \
|| parallel=$(nproc)
echo "TinyParallel=$parallel" >> $GITHUB_ENV
echo "TinyParallelVcpkg=$(nproc)" >> $GITHUB_ENV
tinyormBuildName='${{ matrix.compiler.name }}-cmake-debug'
echo "TinyORMBuildName=$tinyormBuildName" >> $GITHUB_ENV
tinyormBuildTree="$RUNNER_WORKSPACE/TinyORM-builds-cmake/build-$tinyormBuildName"
echo "TinyORMBuildTree=$tinyormBuildTree" >> $GITHUB_ENV
env:
DB_SQLITE_DATABASE: ${{ secrets.DB_SQLITE_DATABASE }}
- name: PostgreSQL service start
run: |
sudo systemctl start postgresql.service
- name: PostgreSQL service check status
run: |
sudo systemctl status postgresql.service
pg_isready
- name: PostgreSQL create TinyORM user
run: >-
sudo --user=postgres --
psql --command="create user \"$DB_PGSQL_USERNAME\"
with createdb password '$DB_PGSQL_PASSWORD';"
env:
DB_PGSQL_PASSWORD: ${{ secrets.DB_PGSQL_PASSWORD }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
- name: PostgreSQL create TinyORM database
run: |
sudo --user=postgres -- createdb --owner=$DB_PGSQL_USERNAME $DB_PGSQL_DATABASE
env:
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
- name: MySQL initialize crystal_mysqld.cnf configuration
working-directory: .github/resources/linux
run: |
sudo mv --target-directory=/etc/mysql/mysql.conf.d/ ./crystal_mysqld.cnf
- name: MySQL initialize crystal_client.cnf configuration (global)
working-directory: .github/resources/linux
run: >-
cat ./crystal_client.template.cnf |
sed "s/{MYSQL_HOST}/$DB_MYSQL_HOST/" |
sudo tee /etc/mysql/conf.d/crystal_client.cnf > /dev/null
env:
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST }}
- name: MySQL service start
run: |
sudo systemctl start mysql.service
- name: MySQL change ${{ secrets.DB_MYSQL_ROOT_USERNAME }} password
run: >-
echo "
alter user '$DB_MYSQL_ROOT_USERNAME'@'localhost'
identified with caching_sha2_password by '$DB_MYSQL_ROOT_PASSWORD';" |
mysql --user="$DB_MYSQL_ROOT_USERNAME" --password="$DB_MYSQL_ROOT_PASSWORD_DEFAULT"
env:
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_PASSWORD_DEFAULT: ${{ secrets.DB_MYSQL_ROOT_PASSWORD_DEFAULT }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
- name: MySQL populate time zone tables 👌
run: >-
mysql_tzinfo_to_sql /usr/share/zoneinfo |
mysql --user="$DB_MYSQL_ROOT_USERNAME" --password="$DB_MYSQL_ROOT_PASSWORD" mysql
sudo systemctl restart mysql.service
env:
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
- name: MySQL service check status
run: |
echo '::group::Service status'
systemctl status mysql.service
echo '::endgroup::'
echo '::group::Service is-active check'
systemctl is-active --quiet mysql.service
echo '::endgroup::'
echo '::group::Ping'
mysqladmin --user="$DB_MYSQL_ROOT_USERNAME" --password="$DB_MYSQL_ROOT_PASSWORD" ping
echo '::endgroup::'
env:
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
- name: MySQL create TinyORM database
run: >-
echo "
create database if not exists \`$DB_MYSQL_DATABASE\`
default character set $DB_MYSQL_CHARSET
default collate $DB_MYSQL_COLLATION;" |
mysql --user="$DB_MYSQL_ROOT_USERNAME" --password="$DB_MYSQL_ROOT_PASSWORD"
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_COLLATION }}
DB_MYSQL_DATABASE: ${{ secrets.DB_MYSQL_DATABASE }}
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
- name: MySQL create TinyORM user
run: >-
echo "
create user '$DB_MYSQL_USERNAME'@'%'
identified with caching_sha2_password by '$DB_MYSQL_PASSWORD';
grant all privileges on \`tinyorm\\_%\`.* to '$DB_MYSQL_USERNAME'@'%';
grant select on \`mysql\`.\`time_zone_name\` to '$DB_MYSQL_USERNAME'@'%';
flush privileges;" |
mysql --user="$DB_MYSQL_ROOT_USERNAME" --password="$DB_MYSQL_ROOT_PASSWORD"
env:
DB_MYSQL_PASSWORD: ${{ secrets.DB_MYSQL_PASSWORD }}
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
DB_MYSQL_USERNAME: ${{ secrets.DB_MYSQL_USERNAME }}
- name: SQLite create TinyORM database
run: |
mkdir --parents "$(dirname "$TinySQLitePath")"
touch "$TinySQLitePath"
- name: Print MySQL, PostgreSQL, and SQLite database versions
run: |
echo '::group::MySQL version'
mysql --version
echo '::endgroup::'
echo '::group::PostgreSQL version'
pg_config --version
echo '::endgroup::'
echo '::group::SQLite version'
sqlite3 --version
echo '::endgroup::'
- name: add-apt-repository Clang ${{ env.TINY_LLVM_VERSION }}
if: matrix.compiler.key == 'clang'
run: >-
wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key |
sudo tee /etc/apt/trusted.gpg.d/llvm-${{ env.TINY_LLVM_VERSION }}.asc > /dev/null
sudo add-apt-repository --yes
--sourceslist 'deb http://apt.llvm.org/${{ env.TINY_LLVM_APT_NAME }}/
llvm-toolchain-${{ env.TINY_LLVM_APT_NAME }}-${{ env.TINY_LLVM_VERSION }} main'
- name: apt update
run: |
sudo apt update
- name: apt install ${{ join(matrix.compiler.apt, ', ') }}, Qt 5.15 base, and ccache
run: >-
sudo apt install --yes ${{ join(matrix.compiler.apt, ' ') }}
qtbase5-dev libqt5sql5-mysql libqt5sql5-sqlite libqt5sql5-psql ccache
# No need to use lukka/get-cmake, these images always have latest version
- name: Ninja install latest version
uses: seanmiddleditch/gha-setup-ninja@master
with:
destination: ${{ env.TinyRunnerWorkPath }}/ninja-build
- name: Ccache initialize
id: ccache-initialize-cache
run: |
cachePath=$(ccache --get-config cache_dir)
echo "CachePath=$cachePath" >> $GITHUB_OUTPUT
echo "ImageOS=$ImageOS" >> $GITHUB_OUTPUT
- name: Ccache restore cache 🕺
uses: actions/cache@v4
with:
path: ${{ env.cache_path }}
key: ${{ runner.os }}-${{ env.image_os }}-ccache-${{ env.cache_name }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-${{ env.image_os }}-ccache-${{ env.cache_name }}-
env:
cache_name: ${{ matrix.compiler.name }}-qt5
cache_path: ${{ steps.ccache-initialize-cache.outputs.CachePath }}
image_os: ${{ steps.ccache-initialize-cache.outputs.ImageOS }}
- name: Ccache prepare configuration 🥳
run: |
ccache --set-config max_size="$TinyCcacheMaxSize"
ccache --set-config sloppiness=pch_defines,time_macros
ccache --show-config
- name: Ccache print version and configuration
run: |
echo '::group::Print version'
ccache --version
echo '::endgroup::'
echo '::group::Print ccache config'
ccache --show-config
echo '::endgroup::'
- name: vcpkg prepare environment
run: |
echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
echo 'VCPKG_DEFAULT_TRIPLET=x64-linux-dynamic' >> $GITHUB_ENV
echo "VCPKG_MAX_CONCURRENCY=$TinyParallelVcpkg" >> $GITHUB_ENV
- name: CMake print version
run: |
cmake --version
- name: Ccache clear statistics
run: |
ccache --zero-stats
- name: TinyORM cmake configure (${{ env.TinyORMBuildName }})
run: >-
cmake --log-level=DEBUG --log-context
-S .
-B "$TinyORMBuildTree"
-G Ninja
-D CMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=ccache
-D CMAKE_CXX_COMPILER:FILEPATH=${{ matrix.compiler.command }}
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
-D CMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON
-D CMAKE_EXPORT_PACKAGE_REGISTRY:BOOL=OFF
-D CMAKE_BUILD_TYPE:STRING=Debug
-D CMAKE_CXX_SCAN_FOR_MODULES:BOOL=OFF
-D VCPKG_APPLOCAL_DEPS:BOOL=OFF
-D VERBOSE_CONFIGURE:BOOL=ON
-D BUILD_TREE_DEPLOY:BOOL=OFF
-D MATCH_EQUAL_EXPORTED_BUILDTREE:BOOL=OFF
-D STRICT_MODE:BOOL=OFF
-D MYSQL_PING:BOOL=ON
-D BUILD_TESTS:BOOL=ON
-D ORM:BOOL=ON
-D TOM:BOOL=ON
-D TOM_EXAMPLE:BOOL=ON
-D BUILD_DRIVERS:BOOL=OFF
- name: TinyORM cmake build ✨ (${{ env.TinyORMBuildName }})
working-directory: ${{ env.TinyORMBuildTree }}
run: |
cmake --build . --target all --parallel $TinyParallel
- name: Ccache print statistics
run: |
ccache --show-stats --verbose
- name: TinyORM add on the $LD_LIBRARY_PATH
run: |
echo "LD_LIBRARY_PATH=$TinyORMBuildTree${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" >> $env:GITHUB_ENV
- name: Create and Seed tables for unit tests 🎉
working-directory: ${{ env.TinyORMBuildTree }}/tests/testdata_tom
run: >-
./tom_testdata migrate
--database=tinyorm_testdata_tom_mysql,tinyorm_testdata_tom_postgres,tinyorm_testdata_tom_sqlite
--seed --no-ansi
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_COLLATION }}
DB_MYSQL_DATABASE: ${{ secrets.DB_MYSQL_DATABASE }}
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST }}
DB_MYSQL_PASSWORD: ${{ secrets.DB_MYSQL_PASSWORD }}
DB_MYSQL_USERNAME: ${{ secrets.DB_MYSQL_USERNAME }}
DB_PGSQL_CHARSET: ${{ secrets.DB_PGSQL_CHARSET }}
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_HOST: ${{ secrets.DB_PGSQL_HOST }}
DB_PGSQL_PASSWORD: ${{ secrets.DB_PGSQL_PASSWORD }}
DB_PGSQL_SEARCHPATH: ${{ secrets.DB_PGSQL_SEARCHPATH }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
DB_SQLITE_DATABASE: ${{ env.TinySQLitePath }}
TOM_TESTDATA_ENV: ${{ vars.TOM_TESTDATA_ENV }}
- name: TinyORM execute ctest 🔥
working-directory: ${{ env.TinyORMBuildTree }}
run: |
ctest --output-on-failure --parallel $(($TinyParallel + $(nproc) / 2))
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_COLLATION }}
DB_MYSQL_DATABASE: ${{ secrets.DB_MYSQL_DATABASE }}
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST }}
DB_MYSQL_PASSWORD: ${{ secrets.DB_MYSQL_PASSWORD }}
DB_MYSQL_USERNAME: ${{ secrets.DB_MYSQL_USERNAME }}
DB_PGSQL_CHARSET: ${{ secrets.DB_PGSQL_CHARSET }}
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_HOST: ${{ secrets.DB_PGSQL_HOST }}
DB_PGSQL_PASSWORD: ${{ secrets.DB_PGSQL_PASSWORD }}
DB_PGSQL_SEARCHPATH: ${{ secrets.DB_PGSQL_SEARCHPATH }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
DB_SQLITE_DATABASE: ${{ env.TinySQLitePath }}
TOM_TESTS_ENV: ${{ vars.TOM_TESTS_ENV }}
- name: Tom example test some commands (MySQL) 🚀
working-directory: ${{ env.TinyORMBuildTree }}/examples/tom
run: |
./tom migrate:fresh --database=tinyorm_tom_mysql --no-ansi
./tom migrate:uninstall --reset --database=tinyorm_tom_mysql --no-ansi
./tom migrate:install --database=tinyorm_tom_mysql --no-ansi
./tom migrate --database=tinyorm_tom_mysql --seed --no-ansi
./tom migrate:status --database=tinyorm_tom_mysql --no-ansi
./tom migrate:refresh --database=tinyorm_tom_mysql --seed --no-ansi
./tom migrate:reset --database=tinyorm_tom_mysql --no-ansi
./tom migrate:uninstall --database=tinyorm_tom_mysql --no-ansi
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_COLLATION }}
DB_MYSQL_DATABASE: ${{ secrets.DB_MYSQL_DATABASE }}
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST }}
DB_MYSQL_PASSWORD: ${{ secrets.DB_MYSQL_PASSWORD }}
DB_MYSQL_USERNAME: ${{ secrets.DB_MYSQL_USERNAME }}
TOM_EXAMPLE_ENV: ${{ vars.TOM_EXAMPLE_ENV }}
- name: Tom example test some commands (PostgreSQL) 🙌
working-directory: ${{ env.TinyORMBuildTree }}/examples/tom
run: |
./tom migrate:fresh --database=tinyorm_tom_postgres --no-ansi
./tom migrate:uninstall --reset --database=tinyorm_tom_postgres --no-ansi
./tom migrate:install --database=tinyorm_tom_postgres --no-ansi
./tom migrate --database=tinyorm_tom_postgres --seed --no-ansi
./tom migrate:status --database=tinyorm_tom_postgres --no-ansi
./tom migrate:refresh --database=tinyorm_tom_postgres --seed --no-ansi
./tom migrate:reset --database=tinyorm_tom_postgres --no-ansi
./tom migrate:uninstall --database=tinyorm_tom_postgres --no-ansi
env:
DB_PGSQL_CHARSET: ${{ secrets.DB_PGSQL_CHARSET }}
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_HOST: ${{ secrets.DB_PGSQL_HOST }}
DB_PGSQL_PASSWORD: ${{ secrets.DB_PGSQL_PASSWORD }}
DB_PGSQL_SEARCHPATH: ${{ secrets.DB_PGSQL_SEARCHPATH }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
TOM_EXAMPLE_ENV: ${{ vars.TOM_EXAMPLE_ENV }}
- name: Tom example test some commands (SQLite) 🏁
working-directory: ${{ env.TinyORMBuildTree }}/examples/tom
run: |
./tom migrate:fresh --database=tinyorm_tom_sqlite --no-ansi
./tom migrate:uninstall --reset --database=tinyorm_tom_sqlite --no-ansi
./tom migrate:install --database=tinyorm_tom_sqlite --no-ansi
./tom migrate --database=tinyorm_tom_sqlite --seed --no-ansi
./tom migrate:status --database=tinyorm_tom_sqlite --no-ansi
./tom migrate:refresh --database=tinyorm_tom_sqlite --seed --no-ansi
./tom migrate:reset --database=tinyorm_tom_sqlite --no-ansi
./tom migrate:uninstall --database=tinyorm_tom_sqlite --no-ansi
env:
DB_SQLITE_DATABASE: ${{ env.TinySQLitePath }}
TOM_EXAMPLE_ENV: ${{ vars.TOM_EXAMPLE_ENV }}
-578
View File
@@ -1,578 +0,0 @@
# MySQL and PostgreSQL
# ---
# Both use the default unencrypted database connections.
name: MSVC2019 Qt5.15
on:
workflow_dispatch:
push:
branches:
- main
- gh-actions
jobs:
build:
name: cmake build / ctest
runs-on: windows-2019
env:
# Settings (constant variables)
TINY_QT_VERSION: 5.15.2
TINY_QT_SPEC: win64_msvc2019_64
# First value is a compressed data size
# ~ 175 * 3 + 100
TINY_CCACHE_MAX_SIZE: 650M
TINY_MYSQL_SERVICE: MySQL
TINY_POSTGRES_SERVICE: postgresql-x64-14
steps:
- uses: actions/checkout@v4
- name: TinyORM prepare environment
run: |
$runnerWorkPath = Resolve-Path -Path "$env:RUNNER_WORKSPACE/.."
"TinyRunnerWorkPath=$runnerWorkPath" >> $env:GITHUB_ENV
$sqlitePath = Join-Path -Path $runnerWorkPath -ChildPath "SQLite/$env:DB_SQLITE_DATABASE"
"TinySQLitePath=$sqlitePath" >> $env:GITHUB_ENV
$mysqlExePath = (Get-Command -Name mysql.exe).Source
$mysqlInstallationPath = Split-Path -Parent -Path (Split-Path -Parent -Path $mysqlExePath)
"TinyMySQLInstallationPath=$mysqlInstallationPath" >> $env:GITHUB_ENV
$mysqlDataPath = Join-Path -Path $runnerWorkPath -ChildPath 'mysql/data'
"TinyMySQLDataPath=$mysqlDataPath" >> $env:GITHUB_ENV
"TinyParallel=$env:NUMBER_OF_PROCESSORS" >> $env:GITHUB_ENV
$tinyormBuildName = 'msvc-cmake-debug'
"TinyORMBuildName=$tinyormBuildName" >> $env:GITHUB_ENV
$tinyormBuildTree = Join-Path -Path $env:RUNNER_WORKSPACE TinyORM-builds-cmake `
"build-$tinyormBuildName"
"TinyORMBuildTree=$tinyormBuildTree" >> $env:GITHUB_ENV
env:
DB_SQLITE_DATABASE: ${{ secrets.DB_SQLITE_DATABASE }}
- name: PostgreSQL add PGBIN on the $env:Path
run: |
$env:PGBIN >> $env:GITHUB_PATH
- name: PostgreSQL service start
run: |
Set-Service -Name $env:TINY_POSTGRES_SERVICE -StartupType Manual
Start-Service $env:TINY_POSTGRES_SERVICE
- name: PostgreSQL service check status
run: |
Write-Output '::group::Get-Service'
$pgsqlService = Get-Service $env:TINY_POSTGRES_SERVICE
Write-Output $pgsqlService
Write-Output '::endgroup::'
Write-Output '::group::Service running check'
$pgsqlService.status.ToString() -ceq 'Running' -or `
$(throw "$env:TINY_POSTGRES_SERVICE service is not running") > $null
Write-Output '::endgroup::'
Write-Output '::group::pg_isready'
pg_isready.exe
Write-Output '::endgroup::'
- name: PostgreSQL create TinyORM user
run: >-
"create user `"$env:DB_PGSQL_USERNAME`"
with createdb password '$env:DB_PGSQL_PASSWORD';" | psql.exe
env:
DB_PGSQL_PASSWORD: ${{ secrets.DB_PGSQL_PASSWORD }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
- name: PostgreSQL create TinyORM database
run: |
createdb.exe --owner=$env:DB_PGSQL_USERNAME $env:DB_PGSQL_DATABASE
env:
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
- name: MySQL create data folder
run: |
New-Item -Type Directory $env:TinyMySQLDataPath
- name: MySQL initialize my.ini configuration
working-directory: .github/resources/windows
run: >-
(Get-Content -Path ./my_5.template.ini) -creplace
'\{MYSQL_DATADIR\}', $env:TinyMySQLDataPath -creplace
'\{MYSQL_HOST\}', $env:DB_MYSQL_HOST |
Set-Content -Path "$env:TinyMySQLInstallationPath/my.ini"
env:
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST }}
# The ConvertFrom-SecureString must be called on the [SecureString] instance to be able to
# store it in the environment or output variable
- name: MySQL initialize data directory
id: initializes-initialize-mysql-data-folder
run: >-
$regEx = '(?:\[Note\] A temporary password is generated for \w+@localhost: )(?<password>.+)'
$securedPassword = (mysqld.exe --initialize --console 2>&1 |
Select-String -Pattern $regEx).Matches[0].Groups['password'].Value |
ConvertTo-SecureString -AsPlainText | ConvertFrom-SecureString
"SecuredPassword=$securedPassword" >> $env:GITHUB_OUTPUT
- name: MySQL service install/start
run: |
mysqld.exe --install $env:TINY_MYSQL_SERVICE
Start-Service $env:TINY_MYSQL_SERVICE
# The secured_password is store in the string form so we have to re-create the [SecureString]
# from this encrypted string and then it can be decrypted as normally would 😬
- name: MySQL change ${{ secrets.DB_MYSQL_ROOT_USERNAME }} password
run: >-
"alter user '$env:DB_MYSQL_ROOT_USERNAME'@'localhost'
identified by '$env:DB_MYSQL_ROOT_PASSWORD';" |
mysql.exe --user=$env:DB_MYSQL_ROOT_USERNAME
--password=$($env:secured_password | ConvertTo-SecureString |
ConvertFrom-SecureString -AsPlainText)
--connect-expired-password
env:
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
secured_password: ${{ steps.initializes-initialize-mysql-data-folder.outputs.SecuredPassword }}
- name: MySQL time zone POSIX tables initialize download
id: downloads-initialize-mysql-timezone-tables
run: |
$filename = (Split-Path -Path $env:URL_MYSQL_TIMEZONE_TABLES -Leaf)
"Filename=$filename" >> $env:GITHUB_OUTPUT
$filepath = Join-Path -Path $env:RUNNER_TEMP -ChildPath $filename
"Filepath=$filepath" >> $env:GITHUB_OUTPUT
$basename = Split-Path -Path $filename -LeafBase
$extractedFolder = Join-Path -Path $env:RUNNER_TEMP -ChildPath $basename
"ExtractedFolder=$extractedFolder" >> $env:GITHUB_OUTPUT
"Hash=$basename" >> $env:GITHUB_OUTPUT
env:
URL_MYSQL_TIMEZONE_TABLES: ${{ secrets.URL_MYSQL_TIMEZONE_TABLES }}
- name: MySQL time zone POSIX tables restore cache (download)
uses: actions/cache@v4
id: downloads-cache-mysql-timezone-tables
with:
path: ${{ env.extracted_folder }}
key: ${{ runner.os }}-databases-${{ env.cache_name }}-${{ env.cache_hash }}
env:
cache_hash: ${{ steps.downloads-initialize-mysql-timezone-tables.outputs.Hash }}
cache_name: mysql-timezone-tables
extracted_folder: ${{ steps.downloads-initialize-mysql-timezone-tables.outputs.ExtractedFolder }}
- name: MySQL time zone POSIX tables download
if: steps.downloads-cache-mysql-timezone-tables.outputs.cache-hit != 'true'
run: >-
Invoke-WebRequest -Uri $env:URL_MYSQL_TIMEZONE_TABLES -HttpVersion 2.0
-MaximumRetryCount 3 -RetryIntervalSec 10 |
Select-Object -ExpandProperty Content |
Set-Content -Path $env:archive_filepath -AsByteStream
7z.exe x -y -o"$env:RUNNER_TEMP" "$env:archive_filepath"
env:
archive_filepath: ${{ steps.downloads-initialize-mysql-timezone-tables.outputs.Filepath }}
URL_MYSQL_TIMEZONE_TABLES: ${{ secrets.URL_MYSQL_TIMEZONE_TABLES }}
- name: MySQL populate time zone tables 👌
run: >-
$filepath = Join-Path -Path $env:extracted_folder -ChildPath 'timezone_posix.sql'
# source path can't be quoted, it works correctly even with spaces
"source $filepath" |
mysql.exe --user=$env:DB_MYSQL_ROOT_USERNAME --password=$env:DB_MYSQL_ROOT_PASSWORD mysql
Restart-Service $env:TINY_MYSQL_SERVICE
env:
extracted_folder: ${{ steps.downloads-initialize-mysql-timezone-tables.outputs.ExtractedFolder }}
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
- name: MySQL service check status
run: |
Write-Output '::group::Get-Service'
$mysqlService = Get-Service $env:TINY_MYSQL_SERVICE
Write-Output $mysqlService
Write-Output '::endgroup::'
Write-Output '::group::Service running check'
$mysqlService.status.ToString() -ceq 'Running' -or `
$(throw "$env:TINY_MYSQL_SERVICE service is not running") > $null
Write-Output '::endgroup::'
Write-Output '::group::Ping'
mysqladmin.exe --user=$env:DB_MYSQL_ROOT_USERNAME `
--password=$env:DB_MYSQL_ROOT_PASSWORD ping
Write-Output '::endgroup::'
env:
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
- name: MySQL create TinyORM database
run: >-
"create database if not exists ``$env:DB_MYSQL_DATABASE``
default character set $env:DB_MYSQL_CHARSET
default collate $env:DB_MYSQL_COLLATION;" |
mysql.exe --user=$env:DB_MYSQL_ROOT_USERNAME --password=$env:DB_MYSQL_ROOT_PASSWORD
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_57_COLLATION }}
DB_MYSQL_DATABASE: ${{ secrets.DB_MYSQL_DATABASE }}
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
# I had to assign the SUPER privilege to be able set global `max_allowed_packet` for tst_blobs,
# it looks like it's only needed for MySQL v5.7, on MySQL v8 isn't needed, also, the SUPER
# privilege can't be assigned to the table eg. tinyorm_% because it's a global privilege so
# * have to be used.
- name: MySQL create TinyORM user
run: >-
"create user '$env:DB_MYSQL_USERNAME'@'%'
identified by '$env:DB_MYSQL_PASSWORD';
grant all privileges on ``tinyorm\_%``.* to '$env:DB_MYSQL_USERNAME'@'%';
grant super on *.* to '$env:DB_MYSQL_USERNAME'@'%';
grant select on ``mysql``.``time_zone_name`` to '$env:DB_MYSQL_USERNAME'@'%';
flush privileges;" |
mysql.exe --user=$env:DB_MYSQL_ROOT_USERNAME --password=$env:DB_MYSQL_ROOT_PASSWORD
env:
DB_MYSQL_PASSWORD: ${{ secrets.DB_MYSQL_PASSWORD }}
DB_MYSQL_ROOT_PASSWORD: ${{ secrets.DB_MYSQL_ROOT_PASSWORD }}
DB_MYSQL_ROOT_USERNAME: ${{ secrets.DB_MYSQL_ROOT_USERNAME }}
DB_MYSQL_USERNAME: ${{ secrets.DB_MYSQL_USERNAME }}
- name: MySQL add libmysql.dll on the $env:Path, INCLUDE, and LIB
run: |
"$env:TinyMySQLInstallationPath\lib" >> $env:GITHUB_PATH
# Needed by the lastest FindMySQL.cmake module, it stopped working without this
"INCLUDE=$env:TinyMySQLInstallationPath\include" >> $env:GITHUB_ENV
"LIB=$env:TinyMySQLInstallationPath\lib" >> $env:GITHUB_ENV
- name: SQLite create TinyORM database
run: |
New-Item -Type Directory (Split-Path -Path $env:TinySQLitePath -Parent)
New-Item -Type File -Path $env:TinySQLitePath
# Windows github hosted runners don't contain sqlite3 executable
- name: Print MySQL and PostgreSQL database versions
run: |
Write-Output '::group::MySQL version'
mysql.exe --version
Write-Output '::endgroup::'
Write-Output '::group::PostgreSQL version'
postgres.exe --version
Write-Output '::endgroup::'
- name: Qt ${{ env.TINY_QT_VERSION }} install base components
uses: jurplel/install-qt-action@v3
with:
archives: qtbase
version: ${{ env.TINY_QT_VERSION }}
arch: ${{ env.TINY_QT_SPEC }}
cache: true
setup-python: false
extra: --external 7z.exe
dir: ${{ env.TinyRunnerWorkPath }}
- name: QMYSQL driver dlls initialize download (Qt ${{ env.TINY_QT_VERSION }})
id: downloads-initialize-qmysql-dlls
run: |
$filename = (Split-Path -Path $env:URL_QMYSQL_DLLS_MSVC_X64_QT_5 -Leaf)
"Filename=$filename" >> $env:GITHUB_OUTPUT
$filepath = Join-Path -Path $env:RUNNER_TEMP -ChildPath $filename
"Filepath=$filepath" >> $env:GITHUB_OUTPUT
$response = Invoke-WebRequest -Uri $env:URL_CACHE_HASH_WINDOWS
"Hash=$($response.Content)" >> $env:GITHUB_OUTPUT
env:
URL_QMYSQL_DLLS_MSVC_X64_QT_5: ${{ secrets.URL_QMYSQL_DLLS_MSVC_X64_QT_5 }}
URL_CACHE_HASH_WINDOWS: ${{ secrets.URL_CACHE_HASH_WINDOWS }}
- name: QMYSQL driver dlls restore cache (download)
uses: actions/cache@v4
id: downloads-cache-qmysql-dlls
with:
path: ${{ env.archive_filepath }}
key: ${{ runner.os }}-drivers-${{ env.cache_name }}-${{ env.cache_hash }}
env:
archive_filepath: ${{ steps.downloads-initialize-qmysql-dlls.outputs.Filepath }}
cache_hash: ${{ steps.downloads-initialize-qmysql-dlls.outputs.Hash }}
cache_name: qmysql-dlls-qt5
- name: QMYSQL driver dlls download (Qt ${{ env.TINY_QT_VERSION }})
if: steps.downloads-cache-qmysql-dlls.outputs.cache-hit != 'true'
run: >-
$response = Invoke-WebRequest -Uri $env:URL_QMYSQL_DLLS_MSVC_X64_QT_5
$response | Select-Object -ExpandProperty Content |
Set-Content -Path $env:archive_filepath -AsByteStream
env:
archive_filepath: ${{ steps.downloads-initialize-qmysql-dlls.outputs.Filepath }}
URL_QMYSQL_DLLS_MSVC_X64_QT_5: ${{ secrets.URL_QMYSQL_DLLS_MSVC_X64_QT_5 }}
- name: QMYSQL driver dlls install (Qt ${{ env.TINY_QT_VERSION }})
run: |
7z.exe x -y -o"$env:QT_PLUGIN_PATH/sqldrivers" $env:archive_filepath
env:
archive_filepath: ${{ steps.downloads-initialize-qmysql-dlls.outputs.Filepath }}
- name: MySQL 8 libmysql.dll initialize download (Qt ${{ env.TINY_QT_VERSION }})
id: downloads-initialize-mysql_8-libmysql-dll
run: |
$filename = (Split-Path -Path $env:URL_LIBMYSQL_DLL_MYSQL_8_MSVC_X64_QT_5 -Leaf)
"Filename=$filename" >> $env:GITHUB_OUTPUT
$filepath = Join-Path -Path $env:RUNNER_TEMP -ChildPath $filename
"Filepath=$filepath" >> $env:GITHUB_OUTPUT
$response = Invoke-WebRequest -Uri $env:URL_CACHE_HASH_WINDOWS
"Hash=$($response.Content)" >> $env:GITHUB_OUTPUT
env:
URL_LIBMYSQL_DLL_MYSQL_8_MSVC_X64_QT_5: ${{ secrets.URL_LIBMYSQL_DLL_MYSQL_8_MSVC_X64_QT_5 }}
URL_CACHE_HASH_WINDOWS: ${{ secrets.URL_CACHE_HASH_WINDOWS }}
- name: MySQL 8 libmysql.dll restore cache
uses: actions/cache@v4
id: downloads-cache-mysql_8-libmysql-dll
with:
path: ${{ env.archive_filepath }}
key: ${{ runner.os }}-drivers-${{ env.cache_name }}-${{ env.cache_hash }}
env:
archive_filepath: ${{ steps.downloads-initialize-mysql_8-libmysql-dll.outputs.Filepath }}
cache_hash: ${{ steps.downloads-initialize-mysql_8-libmysql-dll.outputs.Hash }}
cache_name: mysql_8-libmysql-dll
- name: MySQL 8 libmysql.dll download (Qt ${{ env.TINY_QT_VERSION }})
if: steps.downloads-cache-mysql_8-libmysql-dll.outputs.cache-hit != 'true'
run: |
$response = Invoke-WebRequest -Uri $env:URL_LIBMYSQL_DLL_MYSQL_8_MSVC_X64_QT_5
$response | Select-Object -ExpandProperty Content |
Set-Content -Path $env:archive_filepath -AsByteStream
env:
archive_filepath: ${{ steps.downloads-initialize-mysql_8-libmysql-dll.outputs.Filepath }}
URL_LIBMYSQL_DLL_MYSQL_8_MSVC_X64_QT_5: ${{ secrets.URL_LIBMYSQL_DLL_MYSQL_8_MSVC_X64_QT_5 }}
- name: MySQL 8 libmysql.dll install (Qt ${{ env.TINY_QT_VERSION }})
run: |
7z.exe x -y -o"$env:TinyRunnerWorkPath/TinyORM-bin" $env:archive_filepath
env:
archive_filepath: ${{ steps.downloads-initialize-mysql_8-libmysql-dll.outputs.Filepath }}
- name: MySQL 8 libmysql.dll add on the $env:Path
run: |
"$env:TinyRunnerWorkPath\TinyORM-bin" >> $env:GITHUB_PATH
- name: Ccache initialize
id: ccache-initialize-cache
run: |
Write-Output '::group::Install'
choco.exe install ccache --yes
Write-Output '::endgroup::'
Write-Output '::group::get-config cache_dir'
$cachePath = ccache.exe --get-config cache_dir
"CachePath=$cachePath" >> $env:GITHUB_OUTPUT
"ImageOS=$env:ImageOS" >> $env:GITHUB_OUTPUT
Write-Output '::endgroup::'
- name: Ccache restore cache 🕺
uses: actions/cache@v4
with:
path: ${{ env.cache_path }}
key: ${{ runner.os }}-${{ env.image_os }}-ccache-${{ env.cache_name }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-${{ env.image_os }}-ccache-${{ env.cache_name }}-
env:
cache_name: msvc2019-qt5
cache_path: ${{ steps.ccache-initialize-cache.outputs.CachePath }}
image_os: ${{ steps.ccache-initialize-cache.outputs.ImageOS }}
- name: Ccache prepare configuration 🥳
run: |
ccache.exe --set-config max_size=$env:TINY_CCACHE_MAX_SIZE
ccache.exe --set-config sloppiness=pch_defines,time_macros
ccache.exe --set-config depend_mode=true
ccache.exe --set-config inode_cache=true
- name: Ccache print version and configuration
run: |
Write-Output '::group::Print version'
ccache.exe --version
Write-Output '::endgroup::'
Write-Output '::group::Print ccache config'
ccache.exe --show-config
Write-Output '::endgroup::'
- name: Visual Studio 2019 pwsh shell setup
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
# Must be after the ilammy/msvc-dev-cmd@v1 because vcvars64 overrides the VCPKG_ROOT
- name: vcpkg prepare environment
run: |
"VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" >> $env:GITHUB_ENV
'VCPKG_DEFAULT_TRIPLET=x64-windows' >> $env:GITHUB_ENV
"VCPKG_MAX_CONCURRENCY=$env:TinyParallel" >> $env:GITHUB_ENV
- name: CMake print version
run: |
cmake.exe --version
- name: Ccache clear statistics
run: |
ccache.exe --zero-stats
- name: TinyORM cmake configure (${{ env.TinyORMBuildName }})
run: >-
cmake.exe --log-level=DEBUG --log-context
-S .
-B $env:TinyORMBuildTree
-G Ninja
-D CMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=ccache.exe
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
-D CMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON
-D CMAKE_EXPORT_PACKAGE_REGISTRY:BOOL=OFF
-D CMAKE_BUILD_TYPE:STRING=Debug
-D CMAKE_CXX_SCAN_FOR_MODULES:BOOL=OFF
-D VCPKG_APPLOCAL_DEPS:BOOL=OFF
-D VERBOSE_CONFIGURE:BOOL=ON
-D BUILD_TREE_DEPLOY:BOOL=OFF
-D MATCH_EQUAL_EXPORTED_BUILDTREE:BOOL=OFF
-D STRICT_MODE:BOOL=OFF
-D MYSQL_PING:BOOL=ON
-D BUILD_TESTS:BOOL=ON
-D ORM:BOOL=ON
-D TOM:BOOL=ON
-D TOM_EXAMPLE:BOOL=ON
-D BUILD_DRIVERS:BOOL=OFF
- name: TinyORM cmake build ✨ (${{ env.TinyORMBuildName }})
working-directory: ${{ env.TinyORMBuildTree }}
run: |
cmake.exe --build . --target all --parallel $env:TinyParallel
- name: Ccache print statistics
run: |
ccache.exe --show-stats --verbose
- name: TinyORM add on the $env:Path
run: |
$env:TinyORMBuildTree >> $env:GITHUB_PATH
- name: Create and Seed tables for unit tests 🎉
working-directory: ${{ env.TinyORMBuildTree }}/tests/testdata_tom
run: >-
.\tom_testdata.exe migrate
--database=tinyorm_testdata_tom_mysql,tinyorm_testdata_tom_postgres,tinyorm_testdata_tom_sqlite
--seed --no-ansi
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_57_COLLATION }}
DB_MYSQL_DATABASE: ${{ secrets.DB_MYSQL_DATABASE }}
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST }}
DB_MYSQL_PASSWORD: ${{ secrets.DB_MYSQL_PASSWORD }}
DB_MYSQL_USERNAME: ${{ secrets.DB_MYSQL_USERNAME }}
DB_PGSQL_CHARSET: ${{ secrets.DB_PGSQL_CHARSET }}
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_HOST: ${{ secrets.DB_PGSQL_HOST }}
DB_PGSQL_PASSWORD: ${{ secrets.DB_PGSQL_PASSWORD }}
DB_PGSQL_SEARCHPATH: ${{ secrets.DB_PGSQL_SEARCHPATH }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
DB_SQLITE_DATABASE: ${{ env.TinySQLitePath }}
TOM_TESTDATA_ENV: ${{ vars.TOM_TESTDATA_ENV }}
# $env:NUMBER_OF_PROCESSORS / 2 : rounds down
- name: TinyORM execute ctest 🔥
working-directory: ${{ env.TinyORMBuildTree }}
run: >-
ctest.exe --output-on-failure
--parallel ([int] $env:TinyParallel + $env:NUMBER_OF_PROCESSORS / 2)
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_57_COLLATION }}
DB_MYSQL_DATABASE: ${{ secrets.DB_MYSQL_DATABASE }}
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST }}
DB_MYSQL_PASSWORD: ${{ secrets.DB_MYSQL_PASSWORD }}
DB_MYSQL_USERNAME: ${{ secrets.DB_MYSQL_USERNAME }}
DB_PGSQL_CHARSET: ${{ secrets.DB_PGSQL_CHARSET }}
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_HOST: ${{ secrets.DB_PGSQL_HOST }}
DB_PGSQL_PASSWORD: ${{ secrets.DB_PGSQL_PASSWORD }}
DB_PGSQL_SEARCHPATH: ${{ secrets.DB_PGSQL_SEARCHPATH }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
DB_SQLITE_DATABASE: ${{ env.TinySQLitePath }}
TOM_TESTS_ENV: ${{ vars.TOM_TESTS_ENV }}
- name: Tom example test some commands (MySQL) 🚀
working-directory: ${{ env.TinyORMBuildTree }}/examples/tom
run: |
.\tom.exe migrate:fresh --database=tinyorm_tom_mysql --no-ansi
.\tom.exe migrate:uninstall --reset --database=tinyorm_tom_mysql --no-ansi
.\tom.exe migrate:install --database=tinyorm_tom_mysql --no-ansi
.\tom.exe migrate --database=tinyorm_tom_mysql --seed --no-ansi
.\tom.exe migrate:status --database=tinyorm_tom_mysql --no-ansi
.\tom.exe migrate:refresh --database=tinyorm_tom_mysql --seed --no-ansi
.\tom.exe migrate:reset --database=tinyorm_tom_mysql --no-ansi
.\tom.exe migrate:uninstall --database=tinyorm_tom_mysql --no-ansi
env:
DB_MYSQL_CHARSET: ${{ secrets.DB_MYSQL_CHARSET }}
DB_MYSQL_COLLATION: ${{ secrets.DB_MYSQL_57_COLLATION }}
DB_MYSQL_DATABASE: ${{ secrets.DB_MYSQL_DATABASE }}
DB_MYSQL_HOST: ${{ secrets.DB_MYSQL_HOST }}
DB_MYSQL_PASSWORD: ${{ secrets.DB_MYSQL_PASSWORD }}
DB_MYSQL_USERNAME: ${{ secrets.DB_MYSQL_USERNAME }}
TOM_EXAMPLE_ENV: ${{ vars.TOM_EXAMPLE_ENV }}
- name: Tom example test some commands (PostgreSQL) 🙌
working-directory: ${{ env.TinyORMBuildTree }}/examples/tom
run: |
.\tom.exe migrate:fresh --database=tinyorm_tom_postgres --no-ansi
.\tom.exe migrate:uninstall --reset --database=tinyorm_tom_postgres --no-ansi
.\tom.exe migrate:install --database=tinyorm_tom_postgres --no-ansi
.\tom.exe migrate --database=tinyorm_tom_postgres --seed --no-ansi
.\tom.exe migrate:status --database=tinyorm_tom_postgres --no-ansi
.\tom.exe migrate:refresh --database=tinyorm_tom_postgres --seed --no-ansi
.\tom.exe migrate:reset --database=tinyorm_tom_postgres --no-ansi
.\tom.exe migrate:uninstall --database=tinyorm_tom_postgres --no-ansi
env:
DB_PGSQL_CHARSET: ${{ secrets.DB_PGSQL_CHARSET }}
DB_PGSQL_DATABASE: ${{ secrets.DB_PGSQL_DATABASE }}
DB_PGSQL_HOST: ${{ secrets.DB_PGSQL_HOST }}
DB_PGSQL_PASSWORD: ${{ secrets.DB_PGSQL_PASSWORD }}
DB_PGSQL_SEARCHPATH: ${{ secrets.DB_PGSQL_SEARCHPATH }}
DB_PGSQL_USERNAME: ${{ secrets.DB_PGSQL_USERNAME }}
TOM_EXAMPLE_ENV: ${{ vars.TOM_EXAMPLE_ENV }}
- name: Tom example test some commands (SQLite) 🏁
working-directory: ${{ env.TinyORMBuildTree }}/examples/tom
run: |
.\tom.exe migrate:fresh --database=tinyorm_tom_sqlite --no-ansi
.\tom.exe migrate:uninstall --reset --database=tinyorm_tom_sqlite --no-ansi
.\tom.exe migrate:install --database=tinyorm_tom_sqlite --no-ansi
.\tom.exe migrate --database=tinyorm_tom_sqlite --seed --no-ansi
.\tom.exe migrate:status --database=tinyorm_tom_sqlite --no-ansi
.\tom.exe migrate:refresh --database=tinyorm_tom_sqlite --seed --no-ansi
.\tom.exe migrate:reset --database=tinyorm_tom_sqlite --no-ansi
.\tom.exe migrate:uninstall --database=tinyorm_tom_sqlite --no-ansi
env:
DB_SQLITE_DATABASE: ${{ env.TinySQLitePath }}
TOM_EXAMPLE_ENV: ${{ vars.TOM_EXAMPLE_ENV }}
+2 -4
View File
@@ -45,15 +45,13 @@ jobs:
command: clang++.exe
# GitHub Free Plan is not enough for this (no money 💵)
# Qt5 and Qt6 with g++ is causing exhausted memory even with -j1
# Qt6 with g++ is causing exhausted memory even with -j1
# - key: gcc
# pacboy: [ 'gcc:u' ]
# command: g++.exe
# Leaving here this matrix for future versions
qt:
- key: qt5
pacboy: qt5-base:u
- key: qt6
pacboy: qt6-base:u
+1 -13
View File
@@ -53,16 +53,6 @@ jobs:
name: Release
qt:
# - key: qt5
# name: Qt5
# version: 5.15.2
# apt: [ qtbase5-dev ]
# # For vcpkg classic mode (install tests)
# vcpkg-qt: qt5-base
# vcpkg-qt-features: qt5-base[core]
# vcpkg-tinyorm: tinyorm-qt5
# vcpkg-tinyorm-features: tinyorm-qt5[core]
- key: qt6
name: Qt6
version: 6.7.2
@@ -173,12 +163,10 @@ jobs:
. ./tools/private/Common-Deploy.ps1
$portfileQt6Path = Resolve-Path -Path './cmake/vcpkg/ports/tinyorm/portfile.cmake'
$portfileQt5Path = Resolve-Path -Path './cmake/vcpkg/ports/tinyorm-qt5/portfile.cmake'
$vcpkgRef = $env:GITHUB_SHA
Edit-VcpkgRefAndHash -Project $env:GITHUB_REPOSITORY -Ref $vcpkgRef `
-PortFile $portfileQt6Path, $portfileQt5Path `
-EnableRetries
-PortFile $portfileQt6Path -EnableRetries
# The following two steps (vcpkg install) are not needed below they only test if the vcpkg
# classic mode works correctly. The Release and Debug build types are build at once so invoke
+3 -26
View File
@@ -42,16 +42,6 @@ jobs:
name: Release
qt:
# GitHub Free Plan is not enough for this (no money 💵)
# - key: qt5
# name: Qt5
# version: 5.15.2
# # For vcpkg classic mode (install tests)
# vcpkg-qt: qt5-base
# vcpkg-qt-features: qt5-base[core]
# vcpkg-tinyorm: tinyorm-qt5
# vcpkg-tinyorm-features: tinyorm-qt5[core,tom-example]
- key: qt6
name: Qt6
version: 6.7.2
@@ -171,12 +161,10 @@ jobs:
. ./tools/private/Common-Deploy.ps1
$portfileQt6Path = Resolve-Path -Path './cmake/vcpkg/ports/tinyorm/portfile.cmake'
$portfileQt5Path = Resolve-Path -Path './cmake/vcpkg/ports/tinyorm-qt5/portfile.cmake'
$vcpkgRef = $env:GITHUB_SHA
Edit-VcpkgRefAndHash -Project $env:GITHUB_REPOSITORY -Ref $vcpkgRef `
-PortFile $portfileQt6Path, $portfileQt5Path `
-EnableRetries
-PortFile $portfileQt6Path -EnableRetries
# The following two steps (vcpkg install) are not needed below they only test if the vcpkg
# classic mode works correctly. The Release and Debug build types are build at once so invoke
@@ -260,30 +248,19 @@ jobs:
# Related issue: https://github.com/microsoft/vcpkg/issues/33539
- name: HelloWorld finish VCPKG_APPLOCAL_DEPS (Debug)
if: matrix.qt.key == 'qt6' && matrix.build-type.key == 'debug'
if: matrix.build-type.key == 'debug'
working-directory: ${{ env.HelloWorldVcpkManifestBuildTree }}
run: |
Copy-Item -Path ./vcpkg_installed/x64-windows/debug/bin/sqlite3.dll -Destination .
Copy-Item -Path ./vcpkg_installed/x64-windows/debug/Qt6 -Destination . -Recurse -Force
- name: HelloWorld finish VCPKG_APPLOCAL_DEPS (Release)
if: matrix.qt.key == 'qt6' && matrix.build-type.key == 'release'
if: matrix.build-type.key == 'release'
working-directory: ${{ env.HelloWorldVcpkManifestBuildTree }}
run: |
Copy-Item -Path ./vcpkg_installed/x64-windows/bin/sqlite3.dll -Destination .
Copy-Item -Path ./vcpkg_installed/x64-windows/Qt6 -Destination . -Recurse -Force
# Qt5 has a problem too, it's deployed but to the wrong folder, the Release build is ok
- name: HelloWorld finish VCPKG_APPLOCAL_DEPS (Debug)
if: matrix.qt.key == 'qt5' && matrix.build-type.key == 'debug'
working-directory: ${{ env.HelloWorldVcpkManifestBuildTree }}
run: |
if (-not (Test-Path ./debug)) {
New-Item -type Directory ./debug
}
Copy-Item -Path ./plugins -Destination ./debug -Recurse -Force
- name: HelloWorld execute (SQLite) 🏁
working-directory: ${{ env.HelloWorldVcpkManifestBuildTree }}
run: |
+6 -2
View File
@@ -59,7 +59,7 @@ set(minRecGCCVersion 10.2)
set(minRecClangVersion 12)
set(minReqClangClVersion 14.0.3)
# Packages
set(minQtVersion 5.15.2)
set(minQtVersion 6.2)
# Unused
# As the range-v3 uses exact version policy in the package config file so passing version
# makes real problems on CI pipelines where different OS images can have installed
@@ -395,7 +395,9 @@ tiny_resource_and_manifest(${TinyOrm_target}
# 'WINVER' macro redefined [-Wmacro-redefined]
# Look also to the TinyCommon for conditional WINVER definition
# TinyQtComponentsRequired: Core and Sql (if NOT BUILD_DRIVERS)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS ${TinyQtComponentsRequired})
# Leaving this find_package(QT NAMES) search pattern even if the Qt v5 support was removed
# because I like it and can be used with future Qt version
find_package(QT NAMES Qt6 REQUIRED COMPONENTS ${TinyQtComponentsRequired})
tiny_find_package(Qt${QT_VERSION_MAJOR} ${minQtVersion} CONFIG
REQUIRED COMPONENTS ${TinyQtComponentsRequired}
)
@@ -411,6 +413,8 @@ tiny_common(${CommonConfig_target}
# Unconditional dependencies
target_link_libraries(${TinyOrm_target}
PUBLIC
# Never use versionless Qt targets (as QT_NO_CREATE_VERSIONLESS_TARGETS might be
# defined)
Qt${QT_VERSION_MAJOR}::Core
range-v3::range-v3
)
+11 -19
View File
@@ -29,10 +29,9 @@ tom/include/tom/version.hpp
README.md
docs/README.md
- vcpkg ports version number
- vcpkg port version number
cmake/vcpkg/ports/tinyorm/vcpkg.json
cmake/vcpkg/ports/tinyorm-qt5/vcpkg.json
- versions in docs
@@ -56,13 +55,6 @@ sudo emerge --update --newuse --deep --quiet-build -a @world
Number of Unit tests:
---------------------
- Qt5 has 14 unit tests less; the QSQLITE driver tests are excluded in the tst_migrate;
Not SKIPPED but excluded using preprocessor macros!
Testing of the Qt 5 QSQLITE driver is excluded because it doesn't support
ALTER TABLE DROP COLUMN, support for dropping columns was added
in the SQLite v3.35.0.
- Linux has 3 unit tests less and 3 SKIPPED unit tests more;
checking exe properties are excluded in the tst_versions;
They are SKIPPED!
@@ -70,7 +62,7 @@ in the SQLite v3.35.0.
Linux doesn't have exe properties like version, description, ...
How to updated vcpkg tinyorm and tinyorm-qt5 ports:
How to updated vcpkg tinyorm port:
---------------------------------------------------
Everything needed is in the tools/deploy.ps1 script so I write only a small summary.
@@ -468,7 +460,6 @@ Common:
- overflow : add check code, eg when size_t to int conversion
- perf : performance
- production : check before deploy to production
- qt5 remove : code to remove after the Qt v5 support will dropped
- regex : mark regex-es, try to avoid them
- reliability : make things more robust and reliable
- repeat : tasks that should I make from time to time
@@ -972,7 +963,7 @@ pwsh -NoLogo -NoProfile -File InvokeXTimes.ps1 100
Powershell Clang analyzers:
---------------------------
qa-lint-tinyorm-qt5.ps1 is tailor-made for TinyORM project.
qa-lint-tinyorm-qt6.ps1 is tailor-made for TinyORM project.
qa-clang-tidy.ps1, qa-clazy-standalone.ps1, qa-clazy-standalone-st.ps1 are more general, they can be used with any project, "-st" script calls raw clazy-standalone.exe.
@@ -993,7 +984,7 @@ select -ExpandProperty FullName > b.txt
cat .\compile_commands.json | sls '"file":' > a.txt
And use regex-es from analyzers-qt5/6.yml, eg.:
And use regex-es from analyzers.yml, eg.:
Get-Content .\a.txt | sls -Pattern '[\\\/]+(?:drivers|examples|orm|src|tests|tom)[\\\/]+.+?[\\\/]+(?!mocs_)[\w\d_\-\+]+\.cpp' | measure
@@ -1088,8 +1079,8 @@ cmake -LA .
cmake.exe -S E:/c/qMedia/TinyORM/TinyORM -B E:/c/qMedia/TinyORM/TinyORM-builds-cmake/build-cmake -GNinja `
"-DCMAKE_BUILD_TYPE:STRING=Debug" `
"-DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=E:/Qt/Tools/QtCreator/share/qtcreator/package-manager/auto-setup.cmake" `
"-DQT_QMAKE_EXECUTABLE:STRING=E:/Qt/5.15.2/msvc2019_64/bin/qmake.exe" `
"-DCMAKE_PREFIX_PATH:STRING=E:/Qt/5.15.2/msvc2019_64" `
"-DQT_QMAKE_EXECUTABLE:STRING=E:/Qt/6.7.2/msvc2019_64/bin/qmake.exe" `
"-DCMAKE_PREFIX_PATH:STRING=E:/Qt/6.7.2/msvc2019_64" `
"-DCMAKE_C_COMPILER:STRING=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/HostX64/x64/cl.exe" `
"-DCMAKE_CXX_COMPILER:STRING=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/HostX64/x64/cl.exe" ` "-DCMAKE_TOOLCHAIN_FILE:PATH=E:/c_libs/vcpkg/scripts/buildsystems/vcpkg.cmake"
@@ -1387,9 +1378,8 @@ TinyORM vcpkg testing (CMake build):
Don't install it to the main vcpkg installation because it can happened that whole qtbase will be
installed and it pulls in many boost packages or mysql client library pulls in much more in.
I have created the svcpkg_tinyorm_port_qt5/qt6_testing.ps1 scripts so execute it and
I have created the svcpkg_tinyorm_port_qt6_testing.ps1 script so execute it and
use the installation at:
O:\Code\c_libs\vcpkg-tinyorm-port-qt5\
O:\Code\c_libs\vcpkg-tinyorm-port-qt6\
To install only the necessary minimum use:
@@ -3206,8 +3196,8 @@ Searching packages:
./MaintenanceTool --type package --filter-packages "DisplayName=Desktop" search qt.qt6.670.linux_gcc_64
Install packages:
./MaintenanceTool install qt.qt5.5152.gcc_64
./MaintenanceTool --mirror https://qt-mirror.dannhauer.de install qt.qt5.5152.gcc_64
./MaintenanceTool install qt.qt6.672.linux_gcc_64
./MaintenanceTool --mirror https://qt-mirror.dannhauer.de install qt.qt6.672.linux_gcc_64
Removing packages:
./MaintenanceTool remove qt.tools.cmake qt.tools.ninja qt.tools.qtcreator_gui qt.tools.qtdesignstudio
@@ -3345,6 +3335,8 @@ The following are most used cases which I corrected during the static_cast<> rev
Building QtSql5 MySQL drivers for Qt5:
--------------------------------------
note: don't remove even after Qt v5 support was removed
---
QtSql5 isn't able to build against the MySQL >=8.3 server, it must be built against
the MySQL v8.0.x branch. Reason are mysql_list_fields() and mysql_ssl_set() functions that
+3 -9
View File
@@ -1,12 +1,10 @@
<h1><img src="https://github.com/silverqx/TinyORM/blob/main/resources/icons/logo-optim.svg" width="34" height="34" alt="TinyORM Logo" align="center">&nbsp;TinyORM</h1>
[![MSVC2019 Qt5.15][action-msvc2019-qt5-badge]][action-msvc2019-qt5]
[![MSVC2022 Qt6.7][action-msvc2022-qt6-badge]][action-msvc2022-qt6]
[![Linux GCC/Clang Qt5.15][action-linux-qt5-badge]][action-linux-qt5]
[![Linux GCC/Clang Qt6.4][action-linux-qt6-badge]][action-linux-qt6]
[![MSYS2 UCRT64 GCC/Clang][action-mingw-badge]][action-mingw]
[![clang-cl MSVC2022][action-clang-cl-badge]][action-clang-cl]
[![Clang-Tidy/Clazy Qt5.15/6.7][action-analyzers-qt5-qt6-badge]][action-analyzers-qt5-qt6]
[![Clang-Tidy/Clazy 6.7][action-analyzers-qt6-badge]][action-analyzers-qt6]
[![Vcpkg Windows][action-vcpkg-windows-badge]][action-vcpkg-windows]
[![Vcpkg Linux][action-vcpkg-linux-badge]][action-vcpkg-linux]
[![MSVC2022 Qt6.7 TinyDrivers][action-msvc2022-qt6-drivers-badge]][action-msvc2022-qt6-drivers]
@@ -134,20 +132,16 @@ The following list fastly summarizes all the `TinyORM` features.
###### TinyOrmPlayground multi-threaded
![Invoked TinyOrmPlayground multi-threaded](/docs/assets/img/features-summary/tinyormplayground-multi-threaded.png)
[action-msvc2019-qt5]: https://github.com/silverqx/TinyORM/actions/workflows/msvc2019-qt5.yml
[action-msvc2019-qt5-badge]: https://github.com/silverqx/TinyORM/actions/workflows/msvc2019-qt5.yml/badge.svg
[action-msvc2022-qt6]: https://github.com/silverqx/TinyORM/actions/workflows/msvc2022-qt6.yml
[action-msvc2022-qt6-badge]: https://github.com/silverqx/TinyORM/actions/workflows/msvc2022-qt6.yml/badge.svg
[action-linux-qt5]: https://github.com/silverqx/TinyORM/actions/workflows/linux-qt5.yml
[action-linux-qt5-badge]: https://github.com/silverqx/TinyORM/actions/workflows/linux-qt5.yml/badge.svg
[action-linux-qt6]: https://github.com/silverqx/TinyORM/actions/workflows/linux-qt6.yml
[action-linux-qt6-badge]: https://github.com/silverqx/TinyORM/actions/workflows/linux-qt6.yml/badge.svg
[action-mingw]: https://github.com/silverqx/TinyORM/actions/workflows/msys2-ucrt64.yml
[action-mingw-badge]: https://github.com/silverqx/TinyORM/actions/workflows/msys2-ucrt64.yml/badge.svg
[action-clang-cl]: https://github.com/silverqx/TinyORM/actions/workflows/clang-cl-qt6.yml
[action-clang-cl-badge]: https://github.com/silverqx/TinyORM/actions/workflows/clang-cl-qt6.yml/badge.svg
[action-analyzers-qt5-qt6]: https://github.com/silverqx/TinyORM/actions/workflows/analyzers.yml
[action-analyzers-qt5-qt6-badge]: https://github.com/silverqx/TinyORM/actions/workflows/analyzers.yml/badge.svg
[action-analyzers-qt6]: https://github.com/silverqx/TinyORM/actions/workflows/analyzers.yml
[action-analyzers-qt6-badge]: https://github.com/silverqx/TinyORM/actions/workflows/analyzers.yml/badge.svg
[action-vcpkg-windows]: https://github.com/silverqx/TinyORM/actions/workflows/vcpkg-windows.yml
[action-vcpkg-windows-badge]: https://github.com/silverqx/TinyORM/actions/workflows/vcpkg-windows.yml/badge.svg
[action-vcpkg-linux]: https://github.com/silverqx/TinyORM/actions/workflows/vcpkg-linux.yml
+1 -1
View File
@@ -11,7 +11,7 @@ tinyMinReqMsvc = 19.29
tinyMinReqClangCl = 14.0.3
tinyMinRecClang = 12
tinyMinRecGCC = 10.2
tinyMinRecQt = 5.15.2
tinyMinRecQt = 6.2
# Unused
#tinyMinRangeV3Version = 0.12.0
#tinyMinTabulateVersion = 1.5.0
+3 -9
View File
@@ -26,14 +26,8 @@ ${TINY_UNPARSED_ARGUMENTS}")
# ---
# Disable deprecated APIs up to the given Qt version
# TODO qt5 remove silverqx
if(QT_VERSION_MAJOR GREATER_EQUAL 6)
# Disable all the APIs deprecated up to Qt v6.9.0 (including)
target_compile_definitions(${target} INTERFACE QT_DISABLE_DEPRECATED_UP_TO=0x060900)
else()
# Disable all the APIs deprecated up to Qt v6.0.0 (including)
target_compile_definitions(${target} INTERFACE QT_DISABLE_DEPRECATED_BEFORE=0x060000)
endif()
# Disable all the APIs deprecated up to Qt v6.9.0 (including)
target_compile_definitions(${target} INTERFACE QT_DISABLE_DEPRECATED_UP_TO=0x060900)
target_compile_definitions(${target}
INTERFACE
@@ -157,7 +151,7 @@ ${TINY_UNPARSED_ARGUMENTS}")
# TODO cmake this will not work with clang-cl problem is that CMAKE_CXX_SIMULATE_VERSION reports only short version like 19.40, so I can't fix it easily silverqx
# Needed to suppress this because lot of new warnings on latest MSVC, also doesn't
# matter too much because TinyORM compiles even without it with Qt v6, warnings were
# only on Qt5
# only on Qt v5
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.38.32914.95")
target_compile_definitions(${target} INTERFACE
_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING
+1 -1
View File
@@ -183,7 +183,7 @@ list(APPEND CMAKE_MODULE_PATH \"\${CMAKE_CURRENT_LIST_DIR}/Modules\")")
"cmake/TinyOrmConfig.cmake.in"
"${TINY_BUILD_INSTALLTREEDIR}/TinyOrmConfig.cmake"
INSTALL_DESTINATION "${tiny_config_package_dir}"
# TODO future, do this like Qt is doing it, I'm missing Qt5Core_COMPILE_DEFINITIONS, Qt5Core_DEFINITIONS, Qt5Core_INCLUDE_DIRS, Qt5Core_LIBRARIES, also do the same for the build tree silverqx
# TODO future, do this like Qt is doing it, I'm missing Qt6Core_COMPILE_DEFINITIONS, Qt6Core_DEFINITIONS, Qt6Core_INCLUDE_DIRS, Qt6Core_LIBRARIES, also do the same for the build tree silverqx
PATH_VARS
BIN_INSTALL_DIR CONFIG_INSTALL_DIR DOC_INSTALL_DIR INCLUDE_INSTALL_DIR
LIB_INSTALL_DIR
-11
View File
@@ -2,8 +2,6 @@
The TinyORM vcpkg ports are officially committed to the vcpkg package manager. You can install them using the following commands.
The `Qt v5` port isn't commit to the official vcpkg repository.
The `Qt latest` port differs from the port in the official vcpkg repository, it additionally contains the `build-mysql-driver` feature which isn't allowed and can't be committed to the official vcpkg repository as it violates the [Maintainer guide: Do not use features to implement alternatives](https://learn.microsoft.com/en-us/vcpkg/contributing/maintainer-guide#do-not-use-features-to-implement-alternatives).
These ports are supposed to be used as [overlay ports](https://learn.microsoft.com/en-us/vcpkg/concepts/overlay-ports) eg. using the `VCPKG_OVERLAY_PORTS` environment variable.
@@ -30,12 +28,3 @@ vcpkg install tinyorm[core,sqlite] qtbase[core,sql-sqlite] --dry-run
vcpkg install tinyorm
vcpkg install tinyorm[core,tom-example]
vcpkg install tinyorm[core,sql-psql]
#### Qt v5
vcpkg install tinyorm-qt5[core] qt5-base --dry-run
vcpkg install tinyorm-qt5[core] qt5-base[core,sql-sqlite] --dry-run
vcpkg install tinyorm-qt5
vcpkg install tinyorm-qt5[core,tom-example]
vcpkg install tinyorm-qt5[core,sql-psql]
@@ -1,45 +0,0 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO silverqx/TinyORM
REF "v${VERSION}"
SHA512 f82702d712f845624698f799c7f5d2b30b7d2138f6c4c15e7ca50b316254b55b6606f60ce4356d7156b615b636a6b16e2d1923901825759e54ab60499c4f04cd
HEAD_REF main
)
# STL4043 _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING already defined, see:
# https://github.com/silverqx/TinyORM/blob/main/cmake/CommonModules/TinyCommon.cmake#L122
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
PREFIX TINYORM
FEATURES
disable-thread-local DISABLE_THREAD_LOCAL
inline-constants INLINE_CONSTANTS
mysql-ping MYSQL_PING
orm ORM
strict-mode STRICT_MODE
tom TOM
tom-example TOM_EXAMPLE
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DCMAKE_CXX_SCAN_FOR_MODULES:BOOL=OFF
-DCMAKE_EXPORT_PACKAGE_REGISTRY:BOOL=OFF
-DBUILD_TESTS:BOOL=OFF
-DTINY_PORT:STRING=${PORT}
-DTINY_VCPKG:BOOL=ON
-DVERBOSE_CONFIGURE:BOOL=ON
${FEATURE_OPTIONS}
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup()
if(TINYORM_TOM_EXAMPLE)
vcpkg_copy_tools(TOOL_NAMES tom AUTO_CLEAN)
endif()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
-85
View File
@@ -1,85 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "tinyorm-qt5",
"version-semver": "0.37.3",
"maintainers": "Silver Zachara <silver.zachara@gmail.com>",
"description": "Modern C++ ORM library for Qt framework",
"homepage": "https://github.com/silverqx/TinyORM",
"documentation": "https://www.tinyorm.org",
"license": "MIT",
"supports": "!(uwp | arm | android | emscripten | osx | ios | xbox | freebsd | openbsd | wasm32)",
"dependencies": [
"qt5-base",
"range-v3",
"tabulate",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
"orm",
"tom"
],
"features": {
"disable-thread-local": {
"description": "Remove all thread_local storage duration specifiers (disables multi-threading support)"
},
"inline-constants": {
"description": "Use inline constants instead of extern constants in shared builds"
},
"mysql-ping": {
"description": "Install MySQL C client library (libmysql) to support the mysql_ping()",
"dependencies": [
"libmysql"
]
},
"orm": {
"description": "Enable ORM-related source code (without it only the query builder is compiled)"
},
"sql-mysql": {
"description": "Build Qt SQL Driver for MySQL",
"dependencies": [
{
"name": "qt5-base",
"features": [
"mysqlplugin"
]
}
]
},
"sql-psql": {
"description": "Build Qt SQL Driver for PostgreSQL",
"dependencies": [
{
"name": "qt5-base",
"features": [
"postgresqlplugin"
]
}
]
},
"strict-mode": {
"description": "Propagate strict compiler/linker options and Qt definitions"
},
"tom": {
"description": "Enable Tom-related source code (command-line interface)"
},
"tom-example": {
"description": "Build Tom command-line application example",
"dependencies": [
{
"name": "tinyorm-qt5",
"default-features": false,
"features": [
"tom"
]
}
]
}
}
}
+4 -4
View File
@@ -237,7 +237,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)\n
add_executable(HelloWorld
main.cpp
)\n
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(QT NAMES Qt6 COMPONENTS Core REQUIRED)
find_package(Qt\${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
find_package(TinyOrm 0.37.3 CONFIG REQUIRED)\n
target_link_libraries(HelloWorld
@@ -259,7 +259,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)\n
add_executable(HelloWorld
main.cpp
)\n
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(QT NAMES Qt6 COMPONENTS Core REQUIRED)
find_package(Qt\${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
find_package(TinyOrm 0.37.3 CONFIG REQUIRED)\n
target_link_libraries(HelloWorld
@@ -315,7 +315,7 @@ set(TOM_EXAMPLE ON)\n
add_executable(HelloWorld
main.cpp
)\n
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(QT NAMES Qt6 COMPONENTS Core REQUIRED)
find_package(Qt\${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
find_package(TinyOrm 0.37.3 CONFIG REQUIRED)\n
target_link_libraries(HelloWorld
@@ -345,7 +345,7 @@ set(TOM_EXAMPLE ON)\n
add_executable(HelloWorld
main.cpp
)\n
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(QT NAMES Qt6 COMPONENTS Core REQUIRED)
find_package(Qt\${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
find_package(TinyOrm 0.37.3 CONFIG REQUIRED)\n
target_link_libraries(HelloWorld
+2 -1
View File
@@ -497,13 +497,14 @@ tiny_resource_and_manifest(${Tom_target}
# Resolve and link dependencies
# ---
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(QT NAMES Qt6 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
find_package(TinyOrm 0.37.3 CONFIG REQUIRED)
# Unconditional dependencies
target_link_libraries(${Tom_target}
PRIVATE
# Never use versionless Qt targets
Qt${QT_VERSION_MAJOR}::Core
TinyOrm::TinyOrm
)
+10 -48
View File
@@ -74,12 +74,12 @@ The `Visual Studio` does not provide `vcvars` scripts for `pwsh`, you can use [`
The same is true for the `Qt Framework`, it doesn't provide `qtenv` scripts for `pwsh` too. You can create your own script, place it on the `$env:Path` user/system path and it will be available system-wide.
Here is one simple example for `pwsh`.
Here is one simple example for `pwsh` and `bash` on `Linux`.
<Tabs groupId={shell}>
<TabItem value='qtenv6.ps1' label='qtenv6.ps1'>
<TabItem value={pwsh} label={pwsh_label}>
```powershell
```powershell title='qtenv6.ps1'
#!/usr/bin/env pwsh
Set-StrictMode -Version 3.0
@@ -95,33 +95,9 @@ $env:Path = "$Script:QtRoot\6.7.2\msvc2019_64\bin;" + $env:Path
```
</TabItem>
<TabItem value='qtenv5.ps1' label='qtenv5.ps1'>
<TabItem value={bash} label={bash_label}>
```powershell
#!/usr/bin/env pwsh
Set-StrictMode -Version 3.0
Write-Host 'Setting up environment for Qt 5.15.2 usage...' -ForegroundColor Magenta
Write-Host
$Script:QtRoot = $env:TINY_QT_ROOT ?? 'C:\Qt'
$env:Path = "$Script:QtRoot\5.15.2\msvc2019_64\bin;" + $env:Path
. vcvars64.ps1
```
</TabItem>
</Tabs>
And here for `Linux`.
<Tabs groupId={shell}>
<TabItem value='qtenv6' label='qtenv6'>
```bash
```bash title='qtenv6'
#!/usr/bin/env sh
echo 'Setting up environment for Qt 6.7.2 usage...'
@@ -132,20 +108,6 @@ export PATH="$QtRoot/6.7.2/gcc_64/bin"${PATH:+:}$PATH
export LD_LIBRARY_PATH="$QtRoot/6.7.2/gcc_64/lib"${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
```
</TabItem>
<TabItem value='qtenv5' label='qtenv5'>
```bash
#!/usr/bin/env sh
echo 'Setting up environment for Qt 5.15.2 usage...'
QtRoot="${TINY_QT_ROOT:-/opt/Qt}"
export PATH="$QtRoot/5.15.2/gcc_64/bin"${PATH:+:}$PATH
export LD_LIBRARY_PATH="$QtRoot/5.15.2/gcc_64/lib"${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
```
</TabItem>
</Tabs>
@@ -196,8 +158,8 @@ You can set the root and application folder paths in the form below and they wil
│ | │ └── build-clang-debug/
│ | └── TinyORM-builds-qmake/
│ | ├── build-debug/
│ | ├── build-TinyORM-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug/
│ | └── build-TinyORM-Desktop_Qt_5_15_2_MSYS2_UCRT64_64bit-Release/
│ | ├── build-TinyORM-Desktop_Qt_6_7_2_MSVC2019_64bit-Debug/
│ | └── build-TinyORM-Desktop_Qt_6_7_2_MSYS2_UCRT64_64bit-Release/
│ └── tom/
│ ├── tom/
│ │ └── database/
@@ -208,7 +170,7 @@ You can set the root and application folder paths in the form below and they wil
│ ├── tom-builds-cmake/
│ │ └── build-TinyORM-Desktop_Qt_6_7_2_MSVC2019_64bit-Debug/
│ └── tom-builds-qmake/
│ ├── build-TinyORM-Desktop_Qt_5_15_3_MSYS2_UCRT64_64bit-Release/
│ ├── build-TinyORM-Desktop_Qt_6_7_2_MSYS2_UCRT64_64bit-Release/
│ └── build-TinyORM-Desktop_Qt_6_7_2_MSVC2019_64bit-Debug/
├── tmp/
└── vcpkg/
@@ -241,8 +203,8 @@ You can set the root and application folder paths in the form below and they wil
│ | │ └── build-clang-debug/
│ | └── TinyORM-builds-qmake/
│ | ├── build-debug/
│ | ├── build-TinyORM-Desktop_Qt_5_15_2_GCC_64bit-Debug/
│ | └── build-TinyORM-Desktop_Qt_5_15_2_clang18_64bit_ccache-Release/
│ | ├── build-TinyORM-Desktop_Qt_6_7_2_GCC_64bit-Debug/
│ | └── build-TinyORM-Desktop_Qt_6_7_2_clang18_64bit_ccache-Release/
│ └── tom/
│ ├── tom/
│ │ └── database/
+1 -1
View File
@@ -50,7 +50,7 @@ The TinyORM query builder uses `QSqlQuery` parameter binding to protect your app
:::
:::danger
The `QMYSQL` Qt driver contains a bug, if your table contains a `json` column type, then you must explicitly name columns other than `json` columns instead of the `*` shorthand, otherwise, you will get an empty result, or all column values will be invalid QVariant-s, or it may even return half of the columns. The `QPSQL` driver returns correct results and doesn't have problem with `json` columns. It was fixed in the Qt 5.15.12, 6.2.7, 6.5.0 [QTBUG-101680](https://bugreports.qt.io/browse/QTBUG-101680).
The `QMYSQL` Qt driver contains a bug, if your table contains a `json` column type, then you must explicitly name columns other than `json` columns instead of the `*` shorthand, otherwise, you will get an empty result, or all column values will be invalid QVariant-s, or it may even return half of the columns. The `QPSQL` driver returns correct results and doesn't have problem with `json` columns. It was fixed in the Qt ~5.15.12~, 6.2.7, 6.5.0 [QTBUG-101680](https://bugreports.qt.io/browse/QTBUG-101680).
:::
## Running Database Queries
+6 -3
View File
@@ -11,18 +11,21 @@ import Link from '@docusaurus/Link'
# Dependencies
The code was developed on MSVC 16.9-16.11, MSVC 17.2-17.9, GCC 10.2-14.1, and Clang 11-18, so may be assumed it will work on future releases of these compilers. Minimum required ISO C++ standard is C++20.
The Qt framework version used during development was 5.15.2 and >=6.2.
The Qt framework version used during development was ~5.15.2~ and >=6.2.
##### Required
- minimum ISO C++ standard is C++20
- &gt;= [Qt Framework 5.15.2](https://www.qt.io/download-qt-installer) - [`QtCore`](https://doc.qt.io/qt-5/qtcore-module.html) and [`QtSql`](https://doc.qt.io/qt-5/qtsql-index.html) modules
- &gt;= [Qt Framework 6.2](https://www.qt.io/download-qt-installer) - [`QtCore`](https://doc.qt.io/qt-6/qtcore-module.html) and [`QtSql`](https://doc.qt.io/qt-6/qtsql-index.html) modules
- &gt;= [range-v3 0.11.0](https://github.com/ericniebler/range-v3)
- [tabulate](https://github.com/p-ranav/tabulate)
:::warning
Be aware that the standard support for the last release of the __Qt 5__ series ended on __26. May 2023__. [[1](https://endoflife.date/qt)][[2](https://www.qt.io/blog/qt-5.15-support-ends)]
Be aware that the standard support for the last release of the __Qt v5__ series ended on __26. May 2023__. [[1](https://endoflife.date/qt)][[2](https://www.qt.io/blog/qt-5.15-support-ends)]
:::
:::danger
Support for __Qt v5.15__ was removed since __TinyORM v0.38.0__.
:::
##### Optional
-4
View File
@@ -35,10 +35,6 @@ It was designed to drop the `QtSql` dependency while maintaining backward compat
Currently, only the `MySQL` database driver is supported and finished.
:::
:::info
`TinyDrivers` can only be built with `Qt v6`, `Qt v5.15` isn't supported.
:::
:::note
`TinyDrivers` library supports both build systems `qmake` and also `CMake`.
:::
+4 -2
View File
@@ -193,7 +193,9 @@ tiny_resource_and_manifest(${TinyDrivers_target}
# Must be before the TinyCommon, to exclude WINVER for the MSYS2 Qt6 builds to avoid:
# 'WINVER' macro redefined [-Wmacro-redefined]
# Look also to the TinyCommon for conditional WINVER definition
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
# Leaving this find_package(QT NAMES) search pattern even if the Qt v5 support was removed
# because I like it and can be used with future Qt version
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
if(QT_VERSION_MAJOR LESS 6)
message(FATAL_ERROR "TinyDrivers library is not supported with Qt version <6.")
endif()
@@ -202,7 +204,7 @@ find_package(Qt${QT_VERSION_MAJOR} ${minQtVersion} CONFIG
REQUIRED COMPONENTS Core
)
# Unconditional dependencies
# Unconditional dependencies # Never use versionless Qt targets
target_link_libraries(${TinyDrivers_target} PUBLIC Qt${QT_VERSION_MAJOR}::Core)
# Conditional dependencies
+4 -1
View File
@@ -149,7 +149,9 @@ tiny_resource_and_manifest(${TinyMySql_target}
# Must be before the TinyCommon, to exclude WINVER for the MSYS2 Qt6 builds to avoid:
# 'WINVER' macro redefined [-Wmacro-redefined]
# Look also to the TinyCommon for conditional WINVER definition
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
# Leaving this find_package(QT NAMES) search pattern even if the Qt v5 support was removed
# because I like it and can be used with future Qt version
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
if(QT_VERSION_MAJOR LESS 6)
message(FATAL_ERROR "TinyMySql library is not supported with Qt version <6.")
endif()
@@ -162,6 +164,7 @@ tiny_find_package(MySQL REQUIRED)
# Unconditional dependencies
target_link_libraries(${TinyMySql_target}
PRIVATE
# Never use versionless Qt targets
Qt${QT_VERSION_MAJOR}::Core
MySQL::MySQL
${TinyOrm_ns}::${CommonConfig_target}
-4
View File
@@ -100,10 +100,6 @@ namespace Concerns
void logQueryInternal(TSqlQuery &query, std::optional<qint64> elapsed,
const QString &type) const;
/*! Convert a named bindings map to the positional bindings vector. */
static QVector<QVariant>
convertNamedToPositionalBindings(QVariantMap &&bindings);
/*! Dynamic cast *this to the DatabaseConnection & derived type. */
const DatabaseConnection &databaseConnection() const;
-5
View File
@@ -400,11 +400,6 @@ namespace Query
/*! Throw an exception if DatabaseManager instance already exists. */
static void checkInstance();
/*! Call QMetaType's register functions needed by the Qt 5. */
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
static void registerQMetaTypesForQt5();
#endif
/*! Database configuration. */
Configuration m_configuration {};
/*! Active database connection instances for the current thread. */
-3
View File
@@ -88,9 +88,6 @@ namespace Query
std::convertible_to<T, std::set<QString>> ||
std::convertible_to<T, std::deque<QString>> ||
std::convertible_to<T, std::vector<QString>> ||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
std::convertible_to<T, QList<QStringView>> ||
#endif
std::convertible_to<T, QVector<QStringView>> ||
std::convertible_to<T, QSet<QString>>;
+2 -12
View File
@@ -187,8 +187,8 @@ namespace Query
#endif
};
/* The TTimeZone alias can be used on Qt v5, Qt <v6.5, and also Qt >=v6.5.
It helps to support all Qt versions still. */
/* The TTimeZone alias can be used on Qt <v6.5 and also Qt >=v6.5.
It helps to support both Qt versions still. */
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
/*! Alias for QTimeZone::Initialization. */
using TTimeZone = QTimeZone::Initialization;
@@ -251,14 +251,4 @@ namespace Query
TINYORM_END_COMMON_NAMESPACE
// Register custom QVariant types for Qt 5
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Q_DECLARE_METATYPE(QTimeZone) // NOLINT(performance-no-int-to-ptr, misc-no-recursion)
Q_DECLARE_METATYPE(Qt::TimeSpec) // NOLINT(performance-no-int-to-ptr, misc-no-recursion)
Q_DECLARE_METATYPE(TINYORM_PREPEND_NAMESPACE(Orm::WhereConditionItem)) // NOLINT(performance-no-int-to-ptr, misc-no-recursion)
Q_DECLARE_METATYPE(TINYORM_PREPEND_NAMESPACE(Orm::QtTimeZoneConfig)) // NOLINT(performance-no-int-to-ptr, misc-no-recursion)
Q_DECLARE_METATYPE(TINYORM_PREPEND_NAMESPACE(Orm::QtTimeZoneType)) // NOLINT(performance-no-int-to-ptr, misc-no-recursion)
#endif
#endif // ORM_ORMTYPES_HPP
-5
View File
@@ -78,9 +78,4 @@ namespace Orm::Query
TINYORM_END_COMMON_NAMESPACE
// Register custom QVariant types for Qt 5
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Q_DECLARE_METATYPE(TINYORM_PREPEND_NAMESPACE(Orm::Query::Expression)) // NOLINT(performance-no-int-to-ptr, misc-no-recursion)
#endif
#endif // ORM_QUERY_EXPRESSION_HPP
-8
View File
@@ -21,11 +21,7 @@ namespace Orm::Support
/*! Concept for a bindings type used in the replaceBindingsInSql(). */
template<typename T>
concept BindingsConcept = std::convertible_to<T, QVector<QVariant>> ||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
std::convertible_to<T, QVariantList>;
#else
std::convertible_to<T, QVariantMap>;
#endif
/*! Library class for replace placeholders in SQL queries. */
class ReplaceBindings
@@ -112,11 +108,7 @@ namespace Orm::Support
queryString.replace(queryString.indexOf(QLatin1Char('?')), 1, bindingValue);
if (simpleBindings)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
simpleBindingsList << std::move(bindingValue); // clazy:exclude=reserve-candidates
#else
simpleBindingsList << bindingValue; // clazy:exclude=reserve-candidates
#endif
}
return {std::move(queryString), std::move(simpleBindingsList)};
@@ -165,11 +165,7 @@ namespace Concerns
{
ModelsCollection<Model> result;
// Reserve the first page, it can help reallocations at the beginning
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
result.reserve(count);
#else
result.reserve(static_cast<decltype (result)::size_type>(count));
#endif
chunk(count, [&result, &callback]
(ModelsCollection<Model> &&models, const qint64 /*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
@@ -191,11 +187,7 @@ namespace Concerns
{
QVector<T> result;
// Reserve the first page, it can help reallocations at the beginning
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
result.reserve(count);
#else
result.reserve(static_cast<decltype (result)::size_type>(count));
#endif
chunk(count, [&result, &callback]
(ModelsCollection<Model> &&models, const qint64 /*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
+10 -66
View File
@@ -484,26 +484,14 @@ namespace Orm::Tiny::Concerns
const QString &attribute, const QString &functionName);
/* Casting Attributes */
/* QMetaType isn't trivially copyable in Qt5, so const-lvalue reference needed. */
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
/*! QMetaType used in a function declaration. */
using QMetaTypeDecl = QMetaType;
/*! QMetaType used in a function definition. */
using QMetaTypeDef = const QMetaType;
#else
/*! QMetaType used in a function declaration. */
using QMetaTypeDecl = std::add_lvalue_reference_t<const QMetaType>;
/*! QMetaType used in a function definition. */
using QMetaTypeDef = QMetaTypeDecl;
#endif
/*! Throw if the given attribute can not be converted to the given cast type. */
static void throwIfCanNotCastAttribute(
const QString &key, CastType castType, QMetaTypeDecl metaType,
const QString &key, CastType castType, QMetaType metaType,
const QVariant &value, const QString &functionName);
#ifdef TINYORM_DEBUG
/*! Log if the QVariant::convert() for the given attribute failed. */
static void logIfConvertAttributeFailed(
const QString &key, CastType castType, QMetaTypeDecl metaType,
const QString &key, CastType castType, QMetaType metaType,
const QString &functionName);
#endif
@@ -1382,11 +1370,7 @@ namespace Orm::Tiny::Concerns
as these attributes are not really in the attributes vector, but are run
when we need to serialize or JSON the model for convenience to the coder. */
for (const auto &key : getSerializableAppends())
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
attributes.emplaceBack(key, mutateAccessorAttribute(key));
#else
attributes.append({key, mutateAccessorAttribute(key)});
#endif
return attributes;
}
@@ -1974,29 +1958,23 @@ namespace Orm::Tiny::Concerns
/*! Convert the QVariant value of a attribute. */
const auto convertAttribute = [&key, &value_, castType]
(QMetaTypeDef metaType)
(const QMetaType metaType)
{
// Throw if the given attribute can not be converted to the given cast type
throwIfCanNotCastAttribute(key, castType, metaType, value_,
QLatin1String("HasAttributes::castAttribute"));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const auto &metaTypeId = metaType;
#else
const auto metaTypeId = metaType.id();
#endif
#ifdef TINYORM_DEBUG
/* Still check for the false value and log to the debug stream, but not if
the value_ is null, because converting null QVariant will always return
false and the QVariant type will be changed anyway. */
if (!value_.convert(metaTypeId) && !value_.isNull())
if (!value_.convert(metaType) && !value_.isNull())
// Log if the QVariant::convert() for the given attribute failed
logIfConvertAttributeFailed(
key, castType, metaType,
QLatin1String("HasAttributes::castAttribute"));
#else
value_.convert(metaTypeId);
value_.convert(metaType);
#endif
return value_;
@@ -2041,12 +2019,8 @@ namespace Orm::Tiny::Concerns
return convertAttribute(QMetaType(QMetaType::Bool));
// Int 16-bit
case CastType::Short:
/* Qt5 QVariant doesn't define the short int type QVariant::Short, but
it can be bypassed using the QMetaType. */
return convertAttribute(QMetaType(QMetaType::Short));
case CastType::UShort:
/* Qt5 QVariant doesn't define the short int type QVariant::Short, but
it can be bypassed using the QMetaType. */
return convertAttribute(QMetaType(QMetaType::UShort));
// Float
case CastType::Real:
@@ -2062,15 +2036,8 @@ namespace Orm::Tiny::Concerns
auto converted = convertAttribute(QMetaType(QMetaType::Double));
const auto &modifier = castItem.modifier();
/* This is pure for the performance reasons, in the Qt6 the isNull()
internally also checks if isValid(). In the Qt5 the logic is different. */
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (modifier.isNull() || converted.isNull()
#else
if (!modifier.isValid() || modifier.isNull() ||
!converted.isValid() || converted.isNull()
#endif
)
// The isNull() internally also checks if isValid() (from Qt6)
if (modifier.isNull() || converted.isNull())
return converted;
return roundDecimals(converted, modifier);
@@ -2369,11 +2336,8 @@ namespace Orm::Tiny::Concerns
// Cache the get mutator (accessor) value
if (attribute.withCaching()) T_UNLIKELY
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_attributeMutatorsCache.emplace(key, value);
#else
m_attributeMutatorsCache.insert(key, value);
#endif
// Remove the get mutator (accessor) from the cache if caching is disabled
else T_LIKELY
m_attributeMutatorsCache.remove(key);
@@ -2449,14 +2413,10 @@ namespace Orm::Tiny::Concerns
template<typename Derived, AllRelationsConcept ...AllRelations>
void HasAttributes<Derived, AllRelations...>::throwIfCanNotCastAttribute(
const QString &key, const CastType castType, QMetaTypeDef metaType,
const QString &key, const CastType castType, const QMetaType metaType,
const QVariant &value, const QString &functionName)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (value.canConvert(metaType))
#else
if (value.canConvert(metaType.id()))
#endif
return;
throw Orm::Exceptions::InvalidArgumentError(
@@ -2471,7 +2431,7 @@ namespace Orm::Tiny::Concerns
#ifdef TINYORM_DEBUG
template<typename Derived, AllRelationsConcept ...AllRelations>
void HasAttributes<Derived, AllRelations...>::logIfConvertAttributeFailed(
const QString &key, const CastType castType, QMetaTypeDef metaType,
const QString &key, const CastType castType, const QMetaType metaType,
const QString &functionName)
{
/* This should not happen because the QVariant::canConvert() is called before
@@ -2584,18 +2544,10 @@ namespace Orm::Tiny::Concerns
if (appendKeys.empty())
return;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
attributes.removeIf([&appendKeys](const AttributeItem &attribute)
{
return appendKeys.contains(attribute.key);
});
#else
for (auto it = attributes.begin(); it != attributes.end(); /*unused*/)
if (appendKeys.contains(it->key)) T_UNLIKELY
it = attributes.erase(it);
else T_LIKELY
++it;
#endif
}
template<typename Derived, AllRelationsConcept ...AllRelations>
@@ -2674,11 +2626,7 @@ namespace Orm::Tiny::Concerns
// QVector<AttributeItem>
else
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
serializableAttributes.emplaceBack(key, value);
#else
serializableAttributes.append({key, value});
#endif
}
return serializableAttributes;
@@ -2736,11 +2684,7 @@ namespace Orm::Tiny::Concerns
for (auto &&[key, value] : attributes)
if (!hiddenKeys.contains(key))
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
serializableAttributes.emplaceBack(std::move(key), std::move(value));
#else
serializableAttributes.append({std::move(key), std::move(value)});
#endif
return serializableAttributes;
}
@@ -734,11 +734,7 @@ namespace Concerns
Derived &
HasRelationships<Derived, AllRelations...>::addTouch(const QString &touch)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
basemodel().getUserTouches().emplaceBack(touch);
#else
basemodel().getUserTouches().append(touch);
#endif
return model();
}
@@ -747,11 +743,7 @@ namespace Concerns
Derived &
HasRelationships<Derived, AllRelations...>::addTouch(QString &&touch)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
basemodel().getUserTouches().emplaceBack(std::move(touch));
#else
basemodel().getUserTouches().append(std::move(touch));
#endif
return model();
}
@@ -1555,12 +1547,8 @@ namespace Concerns
QVector<AttributeItem> &attributes, QString &&relation,
QVariant &&relationSerialized)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
attributes.emplaceBack(std::move(relation),
std::move(relationSerialized));
#else
attributes.append({std::move(relation), std::move(relationSerialized)});
#endif
}
/* Serialization - HidesAttributes */
+4 -9
View File
@@ -278,14 +278,9 @@ namespace Orm::Tiny::Relations
/*! Build model dictionary keyed by the parent's primary key. */
for (auto &&result : results)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
dictionary.emplace(
#else
dictionary.insert(
#endif
result.getAttribute(m_ownerKey)
.template value<typename Model::KeyType>(),
std::move(result));
dictionary.emplace(result.getAttribute(m_ownerKey)
.template value<typename Model::KeyType>(),
std::move(result));
return dictionary;
}
@@ -335,7 +330,7 @@ namespace Orm::Tiny::Relations
Model &BelongsTo<Model, Related>::dissociate() const
{
// TEST Model::save with null key silverqx
// FEATURE dilemma primarykey, Model::KeyType vs QVariant, set to null, will be different for Qt5 (QVariant(QVariant::Type(qMetaTypeId<Model::KeyType>()))) and Qt6 (QVariant(QMetaType(qMetaTypeId<Model::KeyType>())))) ; ALSO current problem is, that I check that foreignKey !isValid || isNull, but when QVariant with type (Model::KeyType) and also with null is created by the above commands, then it is still null (isNull == true), but is considered as !!VALID!! (isValid == true) silverqx
// FEATURE dilemma primarykey, Model::KeyType vs QVariant, set to null, for Qt6 it will be (QVariant(QMetaType(qMetaTypeId<Model::KeyType>())))) ; ALSO current problem is, that I check that foreignKey !isValid || isNull, but when QVariant with type (Model::KeyType) and also with null is created by the above commands, then it is still null (isNull == true), but is considered as !!VALID!! (isValid == true) silverqx
m_child->setAttribute(m_foreignKey, {});
// TEST operations that are related on the Model::m_relation data member how they behave, when m_relations value contains the std::nullopt value silverqx
@@ -1031,11 +1031,7 @@ namespace Orm::Tiny::Relations
{
ModelsCollection<Related> result;
// Reserve the first page, it can help reallocations at the beginning
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
result.reserve(count);
#else
result.reserve(static_cast<decltype (result)::size_type>(count));
#endif
chunk(count, [&result, &callback]
(ModelsCollection<Related> &&models, const qint64 /*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
@@ -1057,11 +1053,7 @@ namespace Orm::Tiny::Relations
{
QVector<T> result;
// Reserve the first page, it can help reallocations at the beginning
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
result.reserve(count);
#else
result.reserve(static_cast<decltype (result)::size_type>(count));
#endif
chunk(count, [&result, &callback]
(ModelsCollection<Related> &&models, const qint64 /*unused*/) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
@@ -1497,13 +1489,8 @@ namespace Orm::Tiny::Relations
begin with "pivot_" and add those to this vector, as well as unsetting
them from the parent's models since they exist in a different table. */
if (attribute.key.startsWith(QStringLiteral("pivot_"))) {
// Remove the 'pivot_' part from an attribute key
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
values.append({attribute.key.sliced(6), attribute.value});
#else
values.append({attribute.key.mid(6), attribute.value});
#endif
model.unsetAttribute(attribute);
}
@@ -418,11 +418,7 @@ namespace Orm::Tiny::Relations
else
// Move to the std::optional
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
dictionary.emplace(foreignKey, std::move(result));
#else
dictionary.insert(foreignKey, std::move(result));
#endif
return dictionary;
}
+1 -13
View File
@@ -422,11 +422,7 @@ namespace Orm::Tiny
column_ = std::get<QString>(column);
if (column_.contains(DOT))
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
column_ = column_.sliced(column_.lastIndexOf(DOT) + 1);
#else
column_ = column_.mid(column_.lastIndexOf(DOT) + 1);
#endif
return model->getAttribute(column_);
}
@@ -445,11 +441,7 @@ namespace Orm::Tiny
column_ = std::get<QString>(column);
if (column_.contains(DOT))
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
column_ = column_.sliced(column_.lastIndexOf(DOT) + 1);
#else
column_ = column_.mid(column_.lastIndexOf(DOT) + 1);
#endif
return model.getAttribute(column_);
}
@@ -1376,11 +1368,7 @@ namespace Orm::Tiny
progress.reserve(names.size());
for (auto &&segment : names) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
progress << std::move(segment);
#else
progress << segment;
#endif
auto last = progress.join(DOT);
const auto containsRelation = [&last](const auto &relation)
@@ -1438,7 +1426,7 @@ namespace Orm::Tiny
that start with the given top relations and add them to our vector. */
for (const auto &[relationName, constraints] : m_eagerLoad)
if (isNestedUnder(topRelationName, relationName))
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) || (defined(__clang__) && __clang_major__ < 16)
#if defined(__clang__) && __clang_major__ < 16
nested.append({relationName.mid(topRelationName.size() + 1),
constraints});
#else
-5
View File
@@ -64,13 +64,8 @@ namespace Orm::Tiny
{
typename C::size_type;
// Good enough, I won't invest more effort into this 🙃
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
requires std::same_as<typename C::size_type, std::size_t> ||
std::same_as<typename C::size_type, qsizetype>;
#else
requires std::same_as<typename C::size_type, std::size_t> ||
std::same_as<typename C::size_type, int>;
#endif
{ c.reserve(typename C::size_type()) } -> std::same_as<void>;
};
-5
View File
@@ -219,9 +219,4 @@ namespace Concerns
TINYORM_END_COMMON_NAMESPACE
// Register custom QVariant types for Qt 5
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Q_DECLARE_METATYPE(TINYORM_PREPEND_NAMESPACE(Orm::Tiny::AttributeItem)) // NOLINT(performance-no-int-to-ptr, misc-no-recursion)
#endif
#endif // ORM_TINY_TINYTYPES_HPP
-111
View File
@@ -102,12 +102,7 @@ namespace Types
using ConstModelLoopType = std::conditional_t<std::is_pointer_v<Model>,
const ModelRawType *const,
const ModelRawType &>;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
using parameter_type = typename StorageType::parameter_type;
#else
using parameter_type = std::conditional_t<std::is_pointer_v<Model>,
ModelRawType *, const ModelRawType &>;
#endif
/* Iterators related */
using iterator = typename StorageType::iterator;
@@ -165,7 +160,6 @@ namespace Types
requires std::is_pointer_v<Model>;
/* Redeclared overridden methods from the base class */
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
/*! Returns a reference to the first model in the collection. */
inline Model &first();
/*! Returns a reference to the first model in the collection. */
@@ -186,22 +180,6 @@ namespace Types
inline Model value(size_type index) const;
/*! Returns the value at index position i in the collection. */
inline Model value(size_type index, parameter_type defaultValue) const;
#else
/*! Returns a reference to the first model in the collection. */
inline Model &first();
/*! Returns a reference to the first model in the collection. */
inline const Model &first() const;
/*! Returns a reference to the last model in the collection. */
inline Model &last();
/*! Returns a reference to the last model in the collection. */
inline const Model &last() const;
/*! Returns the value at index position i in the collection. */
inline Model value(size_type index) const;
/*! Returns the value at index position i in the collection. */
inline Model value(size_type index, parameter_type defaultValue) const;
#endif
/* BaseCollection */
/*! Run a filter over each of the models in the collection. */
@@ -789,7 +767,6 @@ namespace Types
/* Redeclared overridden methods from the base class */
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
template<DerivedCollectionModel Model>
Model &
ModelsCollection<Model>::first()
@@ -846,50 +823,6 @@ namespace Types
{
return StorageType::value(index, defaultValue);
}
#else
template<DerivedCollectionModel Model>
Model &
ModelsCollection<Model>::first()
{
return StorageType::first();
}
template<DerivedCollectionModel Model>
const Model &
ModelsCollection<Model>::first() const
{
return StorageType::first();
}
template<DerivedCollectionModel Model>
Model &
ModelsCollection<Model>::last()
{
return StorageType::last();
}
template<DerivedCollectionModel Model>
const Model &
ModelsCollection<Model>::last() const
{
return StorageType::last();
}
template<DerivedCollectionModel Model>
Model
ModelsCollection<Model>::value(const size_type index) const
{
return StorageType::value(index);
}
template<DerivedCollectionModel Model>
Model
ModelsCollection<Model>::value(const size_type index,
parameter_type defaultValue) const
{
return StorageType::value(index, defaultValue);
}
#endif
/* BaseCollection */
@@ -1096,14 +1029,9 @@ namespace Types
result.reserve(size);
for (size_type index = 0; index < size; ++index)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
result.emplaceBack(
std::invoke(callback, getModelCopy(this->operator[](index)),
index));
#else
result.append(std::invoke(callback, getModelCopy(this->operator[](index)),
index));
#endif
return result;
}
@@ -1120,11 +1048,7 @@ namespace Types
result.reserve(size);
for (auto &&model : *this)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
result.emplaceBack(std::invoke(callback, getModelCopy(model)));
#else
result.append(std::invoke(callback, getModelCopy(model)));
#endif
return result;
}
@@ -1870,28 +1794,10 @@ namespace Types
QVariantList
ModelsCollection<Model>::toVectorVariantList() const
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return map<QVariant>([](ModelRawType &&model) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
{
return QVariant::fromValue(model.template toVector<PivotType>());
});
#else
/* The map<>() returns the QVector but the QJson module needs the QVariantList
to correctly serialize relations, I will not add a new map<> overload. */
QVariantList result;
result.reserve(this->size());
for (ConstModelLoopType model : *this)
/* The getModelCopy() wouldn't be needed here for Qt5 but I would have to
make this method non-const, it's a small price to call the getModelCopy()
to avoid ABI compatibility breakage in the future because the Qt5 support
will be removed in the near future and the original map<> is also doing
a model copy. */
result << QVariant::fromValue(
getModelCopy(model).template toVector<PivotType>());
return result;
#endif
}
template<DerivedCollectionModel Model>
@@ -1899,27 +1805,10 @@ namespace Types
QVariantList
ModelsCollection<Model>::toMapVariantList() const
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return map<QVariant>([](ModelRawType &&model) -> QVariant // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
{
return model.template toMap<PivotType>();
});
#else
/* The map<>() returns the QVector but the QJson module needs the QVariantList
to correctly serialize relations, I will not add a new map<> overload. */
QVariantList result;
result.reserve(this->size());
for (ConstModelLoopType model : *this)
/* The getModelCopy() wouldn't be needed here for Qt5 but I would have to
make this method non-const, it's a small price to call the getModelCopy()
to avoid ABI compatibility breakage in the future because the Qt5 support
will be removed in the near future and the original map<> is also doing
a model copy. */
result << getModelCopy(model).template toMap<PivotType>();
return result;
#endif
}
template<DerivedCollectionModel Model>
-4
View File
@@ -61,11 +61,7 @@ namespace Private
{
/* The std::div returns both, integer after division operation (quot) and also
the remainder (rem). */
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const auto groupSeparatorDiv = std::lldiv(numberSize, groupWidth);
#else
const auto groupSeparatorDiv = std::div(numberSize, groupWidth);
#endif
/* -1 is for pure mathematic reasons, try to call lldiv with different numberSize
and 3 for groupWith to see how it works. */
+1 -7
View File
@@ -6,7 +6,6 @@ load(private/tiny_dotenv)
# Common Configuration ( also for tests )
# ---
# TODO qt5 remove silverqx
versionAtLeast(QT_VERSION, 6.2.4): \
CONFIG *= c++20
else: \
@@ -22,12 +21,7 @@ CONFIG -= c++11 app_bundle
# Disable deprecated APIs up to the given Qt version
# Disable all the APIs deprecated up to Qt v6.9.0 (including)
# TODO qt5 remove silverqx
versionAtLeast(QT_VERSION, 6): \
DEFINES *= QT_DISABLE_DEPRECATED_UP_TO=0x060900
# Disable all the APIs deprecated up to Qt v6.0.0 (including)
else: \
DEFINES *= QT_DISABLE_DEPRECATED_BEFORE=0x060000
DEFINES *= QT_DISABLE_DEPRECATED_UP_TO=0x060900
#DEFINES *= QT_NO_DEPRECATED_WARNINGS
#DEFINES *= QT_WARN_DEPRECATED_UP_TO=0x060900
+2 -1
View File
@@ -23,7 +23,8 @@ DEFINES *= NOMINMAX
# TODO qmake this will not work with clang-cl problem is that CMAKE_CXX_SIMULATE_VERSION reports only short version like 19.40, so I can't fix it easily silverqx
# Needed to suppress this because lot of new warnings on latest MSVC, also doesn't matter
# too much because TinyORM compiles even without it with Qt v6, warnings were only on Qt5
# too much because TinyORM compiles even without it with Qt v6, warnings were only
# on Qt v5
win32-msvc: \
versionAtLeast(TINY_COMPILER_FULL_VERSION, 19.38.32914.95): \
DEFINES *= _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING
@@ -84,15 +84,10 @@ defineReplace(tiny_configure_cmake_rc) {
# This solves the problem with the © character, problem with the encoding
# I have tried to solve this min. 6 times 🤬🤔
# Use utf8 with Qt5 and ANSI with Qt6. I hope this is the last time I'm updating this.
# Use ANSI encoding with Qt6. I hope this is the last time I'm updating this.
# The core of the problem is in the $$cat() and write_file() qmake functions they
# don't know how to process UTF-8 encoded files, they use the ANSI encoding.
# Few weeks later: I don't understand how the heck is possible that it works with
# the MSVC Qt5.
greaterThan(QT_MAJOR_VERSION, 5): \
pragmaCodepage = DEFAULT
else: \
pragmaCodepage = 65001
pragmaCodepage = DEFAULT
rcFileContent = $$cat($$rcFile, "blob")
+1 -6
View File
@@ -8,15 +8,10 @@ win32-clang-msvc: \
else: \
optionToken = -isystem
# Avoid following error on MSYS2 with Qt5:
# fatal error: stdlib.h: No such file or directory
# On MSYS2 are the Qt5 includes installed directly in the C:/msys64/ucrt64/include/ and
# they are tagged as -internal-isystem, tagging them as -isystem causes the error above.
# On MSYS2 with Qt6 are includes in the C:/msys64/ucrt64/include/qt6/ so tagging them
# as -isystem is needed.
# On Unix and also Clang-cl with MSVC it is needed to avoid warnings from system headers.
!if(mingw:versionAtMost(QT_MAJOR_VERSION, 5)): \
QMAKE_CXXFLAGS += $$optionToken $$shell_quote($$[QT_INSTALL_HEADERS]/)
QMAKE_CXXFLAGS += $$optionToken $$shell_quote($$[QT_INSTALL_HEADERS]/)
for(module, QT) {
equals(module, "testlib"): \
-16
View File
@@ -158,11 +158,7 @@ void LogsQueries::logQueryInternal(
executedQuery = query.lastQuery();
m_queryLog->append({std::move(executedQuery),
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
query.boundValues(),
#else
convertNamedToPositionalBindings(query.boundValues()),
#endif
Log::Type::NORMAL, ++m_queryLogId,
elapsed ? *elapsed : -1,
QueryUtils::queryResultSize(query),
@@ -188,18 +184,6 @@ void LogsQueries::logQueryInternal(
#endif
}
QVector<QVariant>
LogsQueries::convertNamedToPositionalBindings(QVariantMap &&bindings) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
{
QVector<QVariant> result;
result.reserve(bindings.size());
for (auto &&binding : bindings)
result << std::move(binding);
return result;
}
const DatabaseConnection &LogsQueries::databaseConnection() const
{
return dynamic_cast<const DatabaseConnection &>(*this);
@@ -72,17 +72,10 @@ void ConfigurationOptionsParser::copyOptionsFromTopLevel(
continue;
// Copy the value to the 'options' hash
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (auto newValue = config().value(optionTopLevel);
!newValue.value<QString>().isEmpty()
)
options.emplace(std::move(option), std::move(newValue));
#else
if (const auto &newValue = config()[optionTopLevel];
!newValue.value<QString>().isEmpty()
)
options.insert(option, newValue);
#endif
}
}
@@ -128,11 +121,7 @@ QVariantHash ConfigurationOptionsParser::prepareConfigOptions(const QVariant &op
const auto option = optionRaw.split(EQ_C);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
preparedOptions.emplace(
#else
preparedOptions.insert(
#endif
option.constFirst().trimmed().toString(),
optionRawCount == 0 ? EMPTY : option[1].trimmed().toString());
}
@@ -169,11 +158,7 @@ ConfigurationOptionsParser::mergeOptions(const QVariantHash &connectortOptions,
const auto &value = itConnectortOptions.value();
if (!merged.contains(key))
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
merged.emplace(key, value);
#else
merged.insert(key, value);
#endif
++itConnectortOptions;
}
@@ -191,11 +176,7 @@ QString ConfigurationOptionsParser::concatenateOptions(const QVariantHash &optio
const auto &key = itOption.key();
const auto value = itOption.value().value<QString>();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
concatenated.emplaceBack(
#else
concatenated.append(
#endif
// Support option flags without a value (are considred as enabled)
value.isEmpty() ? key : QStringLiteral("%1=%2").arg(key, value));
-31
View File
@@ -34,12 +34,6 @@ DatabaseManager::DatabaseManager(const QString &defaultConnection)
Concerns::HasConnectionResolver::setConnectionResolver(this);
setupDefaultReconnector();
/* I couldn't find a better place for this, even though this place is ideal because
it guarantees that it will be called only once per whole application. */
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
registerQMetaTypesForQt5();
#endif
}
DatabaseManager::DatabaseManager(const QVariantHash &config, const QString &connection,
@@ -986,31 +980,6 @@ void DatabaseManager::checkInstance()
"Only one instance of DatabaseManager is allowed per process.");
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void DatabaseManager::registerQMetaTypesForQt5()
{
if (!QMetaType::hasRegisteredComparators<QtTimeZoneConfig>())
QMetaType::registerEqualsComparator<QtTimeZoneConfig>();
/* Comparing serialized models with the toMap() and toVector() */
if (!QMetaType::hasRegisteredComparators<QVector<QVariantMap>>())
QMetaType::registerEqualsComparator<QVector<QVariantMap>>();
#ifndef TINYORM_DISABLE_ORM
using Tiny::AttributeItem;
if (!QMetaType::hasRegisteredComparators<AttributeItem>())
QMetaType::registerEqualsComparator<AttributeItem>();
if (!QMetaType::hasRegisteredComparators<QVector<AttributeItem>>())
QMetaType::registerEqualsComparator<QVector<AttributeItem>>();
if (!QMetaType::hasRegisteredComparators<QVector<QVector<AttributeItem>>>())
QMetaType::registerEqualsComparator<QVector<QVector<AttributeItem>>>();
#endif
}
#endif
} // namespace Orm
TINYORM_END_COMMON_NAMESPACE
-12
View File
@@ -61,25 +61,13 @@ QString SqlError::formatMessage(const char *message, const QSqlError &error)
errorText.reserve(3);
if (!nativeErrorCode.isEmpty())
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
errorText << std::move(nativeErrorCode);
#else
errorText << nativeErrorCode;
#endif
if (!driverText.isEmpty())
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
errorText << std::move(driverText);
#else
errorText << driverText;
#endif
if (!databaseText.isEmpty())
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
errorText << std::move(databaseText);
#else
errorText << databaseText;
#endif
result += errorText.join(COMMA);
+1 -8
View File
@@ -656,17 +656,10 @@ QString Grammar::removeLeadingBoolean(QString &&statement)
/* Before and/or could not be whitespace, current implementation doesn't include
whitespaces before. */
if (statement.startsWith(AndTmpl))
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return statement.sliced(firstChar(4));
#else
return statement.mid(firstChar(4));
#endif
if (statement.startsWith(OrTmpl))
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return statement.sliced(firstChar(3));
#else
return statement.mid(firstChar(3));
#endif
return std::move(statement);
}
-4
View File
@@ -64,11 +64,7 @@ QVector<QString> Blueprint::toSql(const DatabaseConnection &connection,
if (auto sql = grammar.invokeCompileMethod(*command, connection, *this);
!sql.isEmpty()
)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
statements << std::move(sql);
#else
statements << sql;
#endif
return statements;
}
-4
View File
@@ -33,11 +33,7 @@ SqlQuery::SqlQuery(TSqlQuery &&other, const QtTimeZoneConfig &qtTimeZone, // NOL
const QueryGrammar &queryGrammar,
const std::optional<bool> returnQDateTime
)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
: TSqlQuery(std::move(other))
#else
: TSqlQuery(other)
#endif
, m_qtTimeZone(qtTimeZone)
, m_isConvertingTimeZone(m_qtTimeZone.type != QtTimeZoneType::DontConvert)
, m_isSQLiteDb(isSQLiteDbmsType(*this))
-8
View File
@@ -104,20 +104,12 @@ namespace
{
/*! Insert a new item to the DB options hash. */
template<QVariantConcept T>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void insertDbOption(QVariantHash &options, const QString &key, T &&value)
#else
void insertDbOption(QVariantHash &options, const QString &key, T &&value) // NOLINT(cppcoreguidelines-missing-std-forward)
#endif
{
if (value.isEmpty())
return;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
options.emplace(key, std::forward<T>(value));
#else
options.insert(key, value);
#endif
}
/*! MySQL SSL options hash. */
-8
View File
@@ -20,11 +20,7 @@ namespace Orm::Utils
int Helpers::qVariantTypeId(const QVariant &value)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return value.typeId();
#else
return value.userType();
#endif
}
void Helpers::logException(const std::exception &e, const bool fatal)
@@ -193,11 +189,7 @@ void Helpers::logPluginsPath(const QString &exceptionMessage)
return;
qInfo().nospace() << "Plugins Path: "
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
<< QLibraryInfo::path(QLibraryInfo::PluginsPath);
#else
<< QLibraryInfo::location(QLibraryInfo::PluginsPath);
#endif
}
} // namespace Orm::Utils
-82
View File
@@ -19,7 +19,6 @@ namespace Orm::Utils
/* public */
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const QVariant &NullVariant::Bool()
{
static const QVariant cached = QVariant(QMetaType(QMetaType::Bool));
@@ -97,87 +96,6 @@ const QVariant &NullVariant::QString()
static const QVariant cached = QVariant(QMetaType(QMetaType::QString));
return cached;
}
#else
const QVariant &NullVariant::Bool()
{
static const QVariant cached(QVariant::Bool);
return cached;
}
const QVariant &NullVariant::Short()
{
// Qt5 QVariant doesn't support unsigned/ short int
static const QVariant cached(QVariant::Int);
return cached;
}
const QVariant &NullVariant::UShort()
{
// Qt5 QVariant doesn't support unsigned/ short int
static const QVariant cached(QVariant::UInt);
return cached;
}
const QVariant &NullVariant::Int()
{
static const QVariant cached(QVariant::Int);
return cached;
}
const QVariant &NullVariant::UInt()
{
static const QVariant cached(QVariant::UInt);
return cached;
}
const QVariant &NullVariant::LongLong()
{
static const QVariant cached(QVariant::LongLong);
return cached;
}
const QVariant &NullVariant::ULongLong()
{
static const QVariant cached(QVariant::ULongLong);
return cached;
}
const QVariant &NullVariant::Double()
{
static const QVariant cached(QVariant::Double);
return cached;
}
const QVariant &NullVariant::QByteArray()
{
static const QVariant cached(QVariant::ByteArray);
return cached;
}
const QVariant &NullVariant::QDate()
{
static const QVariant cached(QVariant::Date);
return cached;
}
const QVariant &NullVariant::QDateTime()
{
static const QVariant cached(QVariant::DateTime);
return cached;
}
const QVariant &NullVariant::QTime()
{
static const QVariant cached(QVariant::Time);
return cached;
}
const QVariant &NullVariant::QString()
{
static const QVariant cached(QVariant::String);
return cached;
}
#endif
} // namespace Orm::Utils
-36
View File
@@ -98,18 +98,13 @@ QString String::ltrim(const QString &string, const QString &characters)
else
break;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return string.sliced(position);
#else
return string.mid(position);
#endif
}
QString String::rtrim(const QString &string, const QString &characters)
{
/* The ++ and -- isn't bug, I'm doing this comment months after I wrote the code but
I still remember that it's correct. */
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QString::size_type position = string.size();
for (const auto itChar : string | ranges::views::reverse)
@@ -119,17 +114,6 @@ QString String::rtrim(const QString &string, const QString &characters)
break;
return string.first(position);
#else
QString::size_type position = 0;
for (const auto itChar : string | ranges::views::reverse)
if (characters.contains(itChar))
++position;
else
break;
return string.chopped(position);
#endif
}
QString String::stripTags(QString string)
@@ -311,16 +295,10 @@ namespace
if (!line.isEmpty())
line.append(SPACE);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// Guaranteed by the token.size() > emptySpace
line.append(token.first(pos));
// Cut the appended part
token = token.sliced(pos);
#else
line.append(token.left(pos));
// Cut the appended part
token = token.mid(pos);
#endif
}
// In every case no more space on the line here, push to lines
@@ -336,18 +314,11 @@ namespace
break;
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// Guaranteed by the token.size() <= width, so token.size() > width
// Fill the whole line
line.append(token.first(width));
// Cut the appended part
token = token.sliced(width);
#else
// Fill the whole line
line.append(token.left(width));
// Cut the appended part
token = token.mid(width);
#endif
// Push to lines
lines.emplace_back(std::move(line));
// Start a new line
@@ -418,17 +389,10 @@ QList<QStringView> String::splitAtFirst(const QStringView string, const QChar se
if (index == -1)
return {string};
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const auto *const begin = string.constBegin();
const auto *const end = string.constEnd();
const auto *const itSeparator = string.constBegin() + index;
const auto *const itAfterSeparator = string.constBegin() + index + 1; // +1 to skip the separator
#else
const auto *const begin = string.cbegin();
const auto *const end = string.cend();
const auto *const itSeparator = string.cbegin() + index;
const auto *const itAfterSeparator = string.cbegin() + index + 1; // +1 to skip the separator
#endif
// Currently, a value before the separator must contain at least one character
Q_ASSERT(begin < itSeparator);
+1
View File
@@ -100,6 +100,7 @@ tiny_resource_and_manifest(${TinyUtils_target}
# Unconditional dependencies
target_link_libraries(${TinyUtils_target}
PUBLIC
# Never use versionless Qt targets
Qt${QT_VERSION_MAJOR}::Core
${TinyOrm_ns}::${TinyOrm_target}
)
@@ -3502,11 +3502,7 @@ void tst_Collection_Models::each_lvalue() const
ModelsCollection<AlbumImage> &result = images.each([&expectedIds]
(AlbumImage *const image)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
expectedIds.emplaceBack(Common::getKeyCasted(image));
#else
expectedIds.append(Common::getKeyCasted(image));
#endif
});
// Verify
@@ -3547,7 +3543,7 @@ void tst_Collection_Models::each_lvalue_index() const
images.each([&expectedIds]
(AlbumImage *const image, const auto index)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) || (defined(__clang__) && __clang_major__ < 16)
#if defined(__clang__) && __clang_major__ < 16
expectedIds.append({Common::getKeyCasted(image), index});
#else
expectedIds.emplaceBack(Common::getKeyCasted(image), index);
@@ -3584,11 +3580,7 @@ void tst_Collection_Models::each_lvalue_bool() const
if (Common::getKeyCasted(image) == 5)
return false;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
expectedIds.emplaceBack(Common::getKeyCasted(image));
#else
expectedIds.append(Common::getKeyCasted(image));
#endif
return true;
});
@@ -3621,7 +3613,7 @@ void tst_Collection_Models::each_lvalue_bool_index() const
if (index == 3)
return false;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) || (defined(__clang__) && __clang_major__ < 16)
#if defined(__clang__) && __clang_major__ < 16
expectedIds.append({Common::getKeyCasted(image), index});
#else
expectedIds.emplaceBack(Common::getKeyCasted(image), index);
@@ -3655,11 +3647,7 @@ void tst_Collection_Models::each_rvalue() const
std::move(images).each([&expectedIds]
(AlbumImage *const image)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
expectedIds.emplaceBack(Common::getKeyCasted(image));
#else
expectedIds.append(Common::getKeyCasted(image));
#endif
});
// Verify
@@ -3683,7 +3671,7 @@ void tst_Collection_Models::each_rvalue_index() const
std::move(images).each([&expectedIds]
(AlbumImage *const image, const auto index)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) || (defined(__clang__) && __clang_major__ < 16)
#if defined(__clang__) && __clang_major__ < 16
expectedIds.append({Common::getKeyCasted(image), index});
#else
expectedIds.emplaceBack(Common::getKeyCasted(image), index);
@@ -3717,11 +3705,7 @@ void tst_Collection_Models::each_rvalue_bool() const
if (Common::getKeyCasted(image) == 5)
return false;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
expectedIds.emplaceBack(Common::getKeyCasted(image));
#else
expectedIds.append(Common::getKeyCasted(image));
#endif
return true;
});
@@ -3751,7 +3735,7 @@ void tst_Collection_Models::each_rvalue_bool_index() const
if (index == 3)
return false;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) || (defined(__clang__) && __clang_major__ < 16)
#if defined(__clang__) && __clang_major__ < 16
expectedIds.append({Common::getKeyCasted(image), index});
#else
expectedIds.emplaceBack(Common::getKeyCasted(image), index);
@@ -4134,11 +4134,7 @@ void tst_Collection_Relations::each_lvalue() const
ModelsCollection<AlbumImage *> &result = images.each([&expectedIds]
(AlbumImage *const image)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
expectedIds.emplaceBack(Common::getKeyCasted(image));
#else
expectedIds.append(Common::getKeyCasted(image));
#endif
});
// Verify
@@ -4185,7 +4181,7 @@ void tst_Collection_Relations::each_lvalue_index() const
images.each([&expectedIds]
(AlbumImage *const image, const auto index)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) || (defined(__clang__) && __clang_major__ < 16)
#if defined(__clang__) && __clang_major__ < 16
expectedIds.append({Common::getKeyCasted(image), index});
#else
expectedIds.emplaceBack(Common::getKeyCasted(image), index);
@@ -4227,11 +4223,7 @@ void tst_Collection_Relations::each_lvalue_bool() const
if (Common::getKeyCasted(image) == 5)
return false;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
expectedIds.emplaceBack(Common::getKeyCasted(image));
#else
expectedIds.append(Common::getKeyCasted(image));
#endif
return true;
});
@@ -4271,7 +4263,7 @@ void tst_Collection_Relations::each_lvalue_bool_index() const
if (index == 3)
return false;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) || (defined(__clang__) && __clang_major__ < 16)
#if defined(__clang__) && __clang_major__ < 16
expectedIds.append({Common::getKeyCasted(image), index});
#else
expectedIds.emplaceBack(Common::getKeyCasted(image), index);
@@ -4308,11 +4300,7 @@ void tst_Collection_Relations::each_rvalue() const
std::move(imagesInit).each([&expectedIds]
(AlbumImage *const image)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
expectedIds.emplaceBack(Common::getKeyCasted(image));
#else
expectedIds.append(Common::getKeyCasted(image));
#endif
});
// Verify
@@ -4339,7 +4327,7 @@ void tst_Collection_Relations::each_rvalue_index() const
std::move(imagesInit).each([&expectedIds]
(AlbumImage *const image, const auto index)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) || (defined(__clang__) && __clang_major__ < 16)
#if defined(__clang__) && __clang_major__ < 16
expectedIds.append({Common::getKeyCasted(image), index});
#else
expectedIds.emplaceBack(Common::getKeyCasted(image), index);
@@ -4375,11 +4363,7 @@ void tst_Collection_Relations::each_rvalue_bool() const
if (Common::getKeyCasted(image) == 5)
return false;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
expectedIds.emplaceBack(Common::getKeyCasted(image));
#else
expectedIds.append(Common::getKeyCasted(image));
#endif
return true;
});
@@ -4413,7 +4397,7 @@ void tst_Collection_Relations::each_rvalue_bool_index() const
if (index == 3)
return false;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) || (defined(__clang__) && __clang_major__ < 16)
#if defined(__clang__) && __clang_major__ < 16
expectedIds.append({Common::getKeyCasted(image), index});
#else
expectedIds.emplaceBack(Common::getKeyCasted(image), index);
@@ -495,11 +495,7 @@ void tst_Model_Serialization::toMap_UDatesOnly_OverrideSerializeDateTime() const
{"date", QDateTime({2023, 05, 14}, {10, 11, 12}, TTimeZone::UTC)},
});
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Datetime_SerializeOverride::u_dates = {"date", "datetime"};
#else
Datetime_SerializeOverride::u_dates = QStringList {"date", "datetime"};
#endif
QVariantMap serialized = datetime.toMap();
QCOMPARE(serialized.size(), 2);
@@ -523,11 +519,7 @@ tst_Model_Serialization::toVector_UDatesOnly_OverrideSerializeDateTime() const
{"date", QDateTime({2023, 05, 14}, {10, 11, 12}, TTimeZone::UTC)},
});
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Datetime_SerializeOverride::u_dates = {"date", "datetime"};
#else
Datetime_SerializeOverride::u_dates = QStringList {"date", "datetime"};
#endif
QVector<AttributeItem> serialized = datetime.toVector();
QCOMPARE(serialized.size(), 2);
@@ -621,11 +613,7 @@ void tst_Model_Serialization::
{"date", QDateTime({2023, 05, 14}, {10, 11, 12}, TTimeZone::UTC)},
});
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Datetime_SerializeOverride::u_dates = {"date", "datetime"};
#else
Datetime_SerializeOverride::u_dates = QStringList {"date", "datetime"};
#endif
datetime.mergeCasts({
{"datetime", CastType::QDateTime},
@@ -655,11 +643,7 @@ void tst_Model_Serialization::
{"date", QDateTime({2023, 05, 14}, {10, 11, 12}, TTimeZone::UTC)},
});
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Datetime_SerializeOverride::u_dates = {"date", "datetime"};
#else
Datetime_SerializeOverride::u_dates = QStringList {"date", "datetime"};
#endif
datetime.mergeCasts({
{"datetime", CastType::QDateTime},
@@ -763,11 +747,7 @@ void tst_Model_Serialization::
void tst_Model_Serialization::toMap_UDatesOnly_DateNullVariants() const
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Type::u_dates = {"date", "datetime", "timestamp"};
#else
Type::u_dates = QStringList {"date", "datetime", "timestamp"};
#endif
auto type = Type::find(3, {ID, "date", "datetime", "timestamp"});
QVERIFY(type);
@@ -788,11 +768,7 @@ void tst_Model_Serialization::toMap_UDatesOnly_DateNullVariants() const
void tst_Model_Serialization::toVector_UDatesOnly_DateNullVariants() const
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Type::u_dates = {"date", "datetime", "timestamp"};
#else
Type::u_dates = QStringList {"date", "datetime", "timestamp"};
#endif
auto type = Type::find(3, {ID, "date", "datetime", "timestamp"});
QVERIFY(type);
@@ -164,14 +164,11 @@ void tst_Migrate::initTestCase()
/* Testing of the Qt 5 QSQLITE driver is excluded because it doesn't support
ALTER TABLE DROP COLUMN, support for dropping columns was added
in the SQLite v3.35.0. */
m_connections = Databases::createConnections(
{Databases::MYSQL,
Databases::MARIADB,
Databases::POSTGRESQL,
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Databases::SQLITE
#endif
});
m_connections = Databases::createConnections({Databases::MYSQL,
Databases::MARIADB,
Databases::POSTGRESQL,
Databases::SQLITE,
});
if (m_connections.isEmpty())
QSKIP(TestUtils::AutoTestSkippedAny.arg(TypeUtils::classPureBasename(*this))
@@ -153,12 +153,7 @@ namespace Tom::Commands::Make::Support
result.reserve(valuesSize);
// Insert default values
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
result.insert(result.cbegin(), valuesSize, {});
#else
for (typename P::size_type i = 0; i < valuesSize ; ++i)
result.push_back({});
#endif
return {std::move(result), true};
}
-10
View File
@@ -340,11 +340,7 @@ void Application::prependOptions(QList<CommandLineOption> &&options)
m_options = std::move(options);
// Common options after Command options
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_options << std::move(commonOptions);
#else
m_options << commonOptions;
#endif
}
/* Run command */
@@ -455,13 +451,7 @@ void Application::printFullVersions() const
note(QStringLiteral("tom "), false);
info(TINYTOM_VERSION_STR);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
for (const auto &[subsectionName, abouts] : createVersionsSubsection()) {
#else
// To avoid clazy warning
const auto versions = createVersionsSubsection();
for (const auto &[subsectionName, abouts] : versions) {
#endif
// Subsection name is optional
if (subsectionName) {
newLine();
-7
View File
@@ -364,18 +364,11 @@ QVector<SubSectionItem> AboutCommand::gatherVersionsInformation()
{
auto versions = Application::createVersionsSubsection();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// std::nullopt produces -Wmaybe-uninitialized in GCC release builds
versions.emplaceFront(std::optional<QString> {std::nullopt},
std::map<QString, QString> {
{QStringLiteral("tom"), TINYTOM_VERSION_STR},
});
#else
versions.push_front({std::nullopt,
std::map<QString, QString> {
{QStringLiteral("tom"), TINYTOM_VERSION_STR},
}});
#endif
return versions;
}
+2 -17
View File
@@ -169,19 +169,9 @@ QStringList Command::optionNames() const
}
// Iterator to the option name
const auto nthOption = findNthOption(optionName, nthOptionIdx, optionNames);
optionNames.insert(findNthOption(optionName, nthOptionIdx, optionNames),
commasCount, optionName);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
optionNames.insert(nthOption, commasCount, optionName);
#else
/* We need to save the index position because the nthOption iterator will be
invalidated after an insertion. */
const auto optionIdx = static_cast<decltype (optionNames)::size_type>(
std::distance(optionNames.cbegin(), nthOption));
for (auto i = 0; i < commasCount ; ++i)
optionNames.insert(optionIdx, optionName);
#endif
// Take into account also a newly inserted option names
++nthOptionIdx += commasCount;
}
@@ -224,12 +214,7 @@ QStringList Command::values(const QString &name, const Qt::SplitBehavior behavio
// Support passing more values delimited by comma
for (auto &&value : values) {
if (!value.contains(regex)) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
valuesSplitted << std::move(value);
#else
valuesSplitted << value;
#endif
continue;
}
+1 -26
View File
@@ -101,11 +101,7 @@ int CompleteCommand::run() // NOLINT(readability-function-cognitive-complexity)
const auto commandlineArg = value(commandline);
#ifdef _MSC_VER
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const auto positionArg = value(position_).toLongLong();
# else
const auto positionArg = value(position_).toInt();
# endif
// Currently processed tom command
const auto commandlineArgSplitted = commandlineArg.split(SPACE);
@@ -119,13 +115,8 @@ int CompleteCommand::run() // NOLINT(readability-function-cognitive-complexity)
const auto wordArg = getWordOptionValue(commandlineArgSplitted, positionArg,
commandlineArgSize);
#else
const auto wordArg = value(word_);
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const auto wordArg = value(word_);
const auto cwordArg = value(cword_).toLongLong();
# else
const auto cwordArg = value(cword_).toInt();
# endif
// Currently processed tom command
const auto currentCommandArg = getCurrentTomCommand(commandlineArg, cwordArg);
@@ -341,11 +332,7 @@ int CompleteCommand::printGuessedCommands(
guessedCommands << QStringLiteral("%1;%2;%3").arg(commandName, commandName,
command->description());
#else
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
guessedCommands << std::move(commandName);
# else
guessedCommands << commandName;
# endif
#endif
}
@@ -539,12 +526,8 @@ int CompleteCommand::printGuessedLongOptions(
{
const auto commandOptions = getCommandOptionsSignature(currentCommand);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// The -- is guaranteed by the isLongOption(wordArg)
const auto wordToGuess = wordArg.sliced(2);
#else
const auto wordToGuess = wordArg.mid(2);
#endif
const auto printAll = wordToGuess.isEmpty();
QStringList options;
@@ -574,11 +557,7 @@ int CompleteCommand::printGuessedLongOptions(
options << QStringLiteral("%1;%2;%3").arg(longOption, longOption,
option.description());
#else
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
options << std::move(longOption);
# else
options << longOption;
# endif
#endif
}
// With a value
@@ -595,11 +574,7 @@ int CompleteCommand::printGuessedLongOptions(
option.description(),
getOptionDefaultValue(option));
#else
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
options << std::move(longOption);
# else
options << longOption;
# endif
#endif
}
}
@@ -190,11 +190,7 @@ void MakeCommand::throwIfFileAlreadyExists(
continue;
// Also remove the datetime prefix
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
entryName = entryName.sliced(DateTimePrefix.size() + 1);
#else
entryName = entryName.mid(DateTimePrefix.size() + 1);
#endif
}
if (entryName == basename) {
@@ -177,17 +177,10 @@ MigrationCommand::tryExtractDateTimePrefixFromName(
const auto dateTimePrefixSize = DateTimePrefix.size();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// Remove the datetime prefix from the migration name
auto datetimePrefix = migration.sliced(0, dateTimePrefixSize).toStdString();
// +1 to exclude the _ after the datetime prefix
migrationName = migration.sliced(dateTimePrefixSize + 1);
#else
// Remove the datetime prefix from the migration name
auto datetimePrefix = migration.mid(0, dateTimePrefixSize).toStdString();
// +1 to exclude the _ after the datetime prefix
migrationName = migration.mid(dateTimePrefixSize + 1);
#endif
return datetimePrefix;
}
-9
View File
@@ -60,21 +60,12 @@ CallsCommands::createCommandLineArguments(
newArguments.reserve(currentArguments.size() + arguments.size());
// Absolute path of the exe name
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
newArguments << std::move(currentArguments.first());
#else
newArguments << currentArguments.constFirst();
#endif
// Command name
newArguments << command;
// Remove a command exe name and tom's command name
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
currentArguments.remove(0, 2);
#else
currentArguments.removeFirst();
currentArguments.removeFirst();
#endif
// Get common allowed command-line arguments from the current command-line arguments
newArguments << getCommonArguments(currentArguments);
+1 -16
View File
@@ -493,12 +493,7 @@ InteractsWithIO::countSetOption(const QString &optionName,
{
/* This should be in the CommandLineParser, but I will not create a wrapper class
because of one line, I don't even create a future todo task for this. */
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return std::ranges::count(parser.optionNames(), optionName);
#else
return static_cast<QStringList::size_type>(
std::ranges::count(parser.optionNames(), optionName));
#endif
}
bool InteractsWithIO::dontOutput(const Verbosity verbosity) const
@@ -563,11 +558,7 @@ QString InteractsWithIO::errorWallInternal(const QString &string) const
// Split lines by the given width
for (const auto &lineNl : splitted)
for (auto &&line : StringUtils::splitStringByWidth(lineNl, maxLineWidth))
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
lines << std::move(line);
#else
lines << line;
#endif
}
QString output;
@@ -611,20 +602,14 @@ QStringList::size_type
InteractsWithIO::computeReserveForErrorWall(const QStringList &splitted,
const int maxLineWidth)
{
// TODO qt5 remove, change to QStringList::size_type silverqx
qint64 size = 0;
QStringList::size_type size = 0;
for (const auto &line : splitted)
/* +2 serves as a reserve because the splitting algorithm can decided
to start a new line if there is <30% free space, +2 is enough. */
size += std::llround(static_cast<double>(line.size()) / maxLineWidth) + 2;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return size;
#else
// This is ok, the line width can't be longer than int::max()
return static_cast<QStringList::size_type>(size);
#endif
}
InteractsWithIO::TableColors InteractsWithIO::initializeTableColors() const
-4
View File
@@ -175,11 +175,7 @@ QString Migrator::getMigrationName(const Migration &migration) const
it starts with the '_' char, it will be validated by the throw method below. */
auto migrationName = migrationNameOriginal.startsWith(UNDERSCORE)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
? migrationNameOriginal.sliced(1)
#else
? migrationNameOriginal.mid(1)
#endif
: migrationNameOriginal;
throwIfMigrationClassNameNotValid(migrationNameOriginal, migrationName);
-4
View File
@@ -84,11 +84,7 @@ Utils::convertToQCommandLineOptionList(QList<CommandLineOption> &&options) // NO
result.reserve(options.size());
for (auto &&option : options)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
result << std::move(option);
#else
result << option;
#endif
return result;
}
+8 -29
View File
@@ -38,7 +38,7 @@ $Script:BumpsHash = $null
$Script:VersionLocations = $null
# Files in which a number of unit tests needs to be updated (integer value is the number of updates)
$Script:NumberOfUnitTestsLocations = $null
# Vcpkg port filepaths and bumping port-version field for tinyorm and tinyorm-qt5 ports
# Vcpkg port filepaths and bumping port-version field for tinyorm port
$Script:VcpkgHash = $null
# Tag version with the v prefix
@@ -134,7 +134,6 @@ function Initialize-ScriptVariables {
[VersionType]::VersionOnly = [ordered] @{
(Resolve-Path -Path ./NOTES.txt) = 3
(Resolve-Path -Path ./cmake/vcpkg/ports/tinyorm/vcpkg.json) = 1
(Resolve-Path -Path ./cmake/vcpkg/ports/tinyorm-qt5/vcpkg.json) = 1
(Resolve-Path -Path ./docs/building/hello-world.mdx) = 4
(Resolve-Path -Path ./docs/building/migrations.mdx) = 1
(Resolve-Path -Path ./docs/building/tinyorm.mdx) = 1
@@ -199,14 +198,6 @@ function Initialize-ScriptVariables {
versionOld = $null
versionBumped = $null
}
'tinyorm-qt5' = @{
portfile = Resolve-Path -Path ./cmake/vcpkg/ports/tinyorm-qt5/portfile.cmake
vcpkgJson = Resolve-Path -Path ./cmake/vcpkg/ports/tinyorm-qt5/vcpkg.json
bumpType = [YesNoType]::No
versionOld = $null
versionBumped = $null
}
}
}
@@ -1123,34 +1114,22 @@ function Read-PortVersionsToBump {
New-Object System.Management.Automation.Host.ChoiceDescription(
'&tinyorm', 'tinyorm Qt6 port'
)
New-Object System.Management.Automation.Host.ChoiceDescription(
'tinyorm-qt&5', 'tinyorm-qt5 Qt5 port'
)
New-Object System.Management.Automation.Host.ChoiceDescription(
'&Both', 'Both ports tinyorm and tinyorm-qt5'
)
New-Object System.Management.Automation.Host.ChoiceDescription(
'&None', 'Don''t bump'
)
))
$answer = $Host.Ui.PromptForChoice(
"Bump `e[32mtinyorm`e[0m and/or `e[32mtinyorm-qt5`e[0m port-version numbers",
'Choose the vcpkg port/s to bump:', $versionTypeChoice, 3
"Bump `e[32mtinyorm`e[0m port-version number",
'Choose the vcpkg port to bump:', $versionTypeChoice, 1
)
# References
$tinyormValue = $Script:VcpkgHash.tinyorm
$tinyormQt5Value = $Script:VcpkgHash['tinyorm-qt5']
$tinyormValue = $Script:VcpkgHash.tinyorm
switch ($answer) {
0 { $tinyormValue.bumpType = [YesNoType]::Yes }
1 { $tinyormQt5Value.bumpType = [YesNoType]::Yes }
2 {
$tinyormValue.bumpType = [YesNoType]::Yes
$tinyormQt5Value.bumpType = [YesNoType]::Yes
}
3 { return $true }
0 { $tinyormValue.bumpType = [YesNoType]::Yes }
1 { return $true }
Default {
throw 'Unreachable code.'
}
@@ -1639,7 +1618,7 @@ function Invoke-BumpVersions {
Test-LastExitCode
}
# Main logic to bump vcpkg port-version fields in the tinyorm and tinyorm-qt5 ports
# Main logic to bump vcpkg port-version field in the tinyorm port
function Invoke-BumpPortVersions {
[OutputType([void])]
Param()
@@ -1787,7 +1766,7 @@ Write-PostDeployWarnings
- prepare a tag message with the bumped version number
- create an annotated git tag
- merge the `develop` to the `main` branch (ff-only), and push to the `origin/main`
- update the vcpkg `tinyorm` and `tinyorm-qt5` portfiles
- update the vcpkg `tinyorm` portfile
- obtain the `origin/main` commit ID (SHA-1) or use the tag number (based on select mode)
- update the REF value
- obtain the `origin/main` archive hash (SHA512)
+2 -2
View File
@@ -27,8 +27,8 @@ dev-cpp/tabulate ~amd64
Configure `USE` flags by creating `tinyorm` file at `/etc/portage/package.use/`
```
dev-db/tinyorm mysql postgres sqlite mysql-ping tom tom-cli -qt5
#dev-db/tinyorm build-drivers mysql -sqlite -qt5
dev-db/tinyorm mysql postgres sqlite mysql-ping tom tom-cli
#dev-db/tinyorm build-drivers mysql -sqlite
```
Check `USE` flags
@@ -20,9 +20,9 @@ else
KEYWORDS="~amd64"
fi
IUSE="build-drivers disable-thread-local inline-constants mysql mysql-ping +orm postgres -qt5 +sqlite +tom +tom-cli"
IUSE="build-drivers disable-thread-local inline-constants mysql mysql-ping +orm postgres +sqlite +tom +tom-cli"
REQUIRED_USE="
build-drivers? ( || ( mysql ) !postgres !sqlite !qt5 )
build-drivers? ( || ( mysql ) !postgres !sqlite )
tom-cli? ( tom )
"
@@ -32,14 +32,8 @@ RDEPEND="
mysql? ( dev-db/mysql-connector-c:= )
)
!build-drivers? (
!qt5? (
>=dev-qt/qtbase-6.7:6[icu]
dev-qt/qtbase:=[mysql,postgres,sqlite]
)
qt5? (
dev-qt/qtcore:5[icu]
dev-qt/qtsql:5[mysql,postgres,sqlite]
)
>=dev-qt/qtbase-6.7:6[icu]
dev-qt/qtbase:=[mysql,postgres,sqlite]
)
mysql-ping? ( dev-db/mysql-connector-c:= )
"
@@ -20,9 +20,9 @@ else
KEYWORDS="~amd64"
fi
IUSE="build-drivers disable-thread-local inline-constants mysql mysql-ping +orm postgres -qt5 +sqlite +tom +tom-cli"
IUSE="build-drivers disable-thread-local inline-constants mysql mysql-ping +orm postgres +sqlite +tom +tom-cli"
REQUIRED_USE="
build-drivers? ( || ( mysql ) !postgres !sqlite !qt5 )
build-drivers? ( || ( mysql ) !postgres !sqlite )
tom-cli? ( tom )
"
@@ -32,14 +32,8 @@ RDEPEND="
mysql? ( dev-db/mysql-connector-c:= )
)
!build-drivers? (
!qt5? (
>=dev-qt/qtbase-6.7:6[icu]
dev-qt/qtbase:=[mysql,postgres,sqlite]
)
qt5? (
dev-qt/qtcore:5[icu]
dev-qt/qtsql:5[mysql,postgres,sqlite]
)
>=dev-qt/qtbase-6.7:6[icu]
dev-qt/qtbase:=[mysql,postgres,sqlite]
)
mysql-ping? ( dev-db/mysql-connector-c:= )
"
+1 -1
View File
@@ -115,7 +115,7 @@ function Test-VcpkgRefAndHashReplaced {
$matchedLines.Count $expectedOccurrences $regexMatch $portfilePath
}
# Update the REF and SHA512 in tinyorm and tinyorm-qt5 portfiles
# Update the REF and SHA512 in tinyorm portfile
function Edit-VcpkgRefAndHash {
[OutputType([void])]
Param(
-66
View File
@@ -1,66 +0,0 @@
#!/usr/bin/env pwsh
Param(
[Parameter(Position = 0,
HelpMessage = 'Specifies the cpp files to be processed, is joined with the | character ' +
'and used in the parenthesized regex eg. (file1|file2).')]
[ValidateNotNullOrEmpty()]
[string[]] $Files,
[Parameter(HelpMessage = 'Specifies subfolders to lint. The pattern value is used ' +
'in regular expression, eg. (drivers|examples|src|tests|tom).')]
[AllowEmptyString()]
[string] $InSubFoldersPattern = '(?:drivers|examples|src|tests|tom)',
[Parameter(
HelpMessage = 'Specifies the files paths to be processed, is joined with by the | ' +
'character and used in the parenthesized regex eg. (folder1|folder2).')]
[ValidateNotNullOrEmpty()]
[string[]] $FilesPaths,
[Parameter(HelpMessage = 'Skip Clang Tidy analyzes.')]
[switch] $SkipClangTidy,
[Parameter(HelpMessage = 'Skip Clazy standalone analyzes.')]
[switch] $SkipClazy,
[Parameter(HelpMessage = 'Clean CMake build (remove everything inside the -BuildPath).')]
[switch] $CleanBuild,
[Parameter(HelpMessage = 'Specifies the CMake build type.')]
[ValidateSet('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel')]
[ValidateNotNullOrEmpty()]
[string] $BuildType = 'Debug',
[Parameter(
HelpMessage = 'Specifies the checks filter, when not specified, use clang-tidy default ' +
'(eg. -*,readability-magic-numbers to run only a specific check).')]
[ValidateNotNullOrEmpty()]
[string[]] $ClangTidyChecks,
[Parameter(HelpMessage = 'Specifies the number of tidy instances to be run in parallel.')]
[ValidateNotNull()]
[int] $Parallel,
[Parameter(HelpMessage = 'Build TinyORM database drivers that replaces QtSql module.')]
[switch] $BuildDrivers,
[Parameter(HelpMessage = 'Build TinyDrivers database driver (core/common code) ' +
'(default: Loadable).')]
[ValidateSet('Shared', 'Loadable', 'Static')]
[ValidateNotNullOrEmpty()]
[string] $DriversType = 'Loadable'
)
Set-StrictMode -Version 3.0
Clear-Host
$Script:TinyORMMainPath = $env:TINYORM_MAIN_DIR ?? '<your_path_here>'
Lint-TinyORM.ps1 `
-SourcePath "$Script:TinyORMMainPath\TinyORM" `
-BuildPath "$Script:TinyORMMainPath\TinyORM-builds-cmake\build-lint-qt5" `
-QtVersion 5 `
-Verbose:$VerbosePreference `
@PSBoundParameters
-12
View File
@@ -1,12 +0,0 @@
#!/usr/bin/env pwsh
Set-StrictMode -Version 3.0
Write-Host 'Setting up environment for Qt 5.15.2 usage...' -ForegroundColor Magenta
Write-Host
$Script:QtRoot = $env:TINY_QT_ROOT ?? 'C:\Qt'
$env:Path = "$Script:QtRoot\5.15.2\msvc2019_64\bin;" + $env:Path
. vcvars64.ps1
@@ -1,12 +0,0 @@
#!/usr/bin/env pwsh
Set-StrictMode -Version 3.0
Write-Host 'Setting up environment for vcpkg-tinyorm-port Qt5 usage...' -ForegroundColor Magenta
Add-FolderOnPath.ps1 -Path '<your_path>\vcpkg-tinyorm-port-qt5'
Write-Host
$env:VCPKG_ROOT = '<your_path>\vcpkg-tinyorm-port-qt5'
. vcvars64.ps1