summaryrefslogtreecommitdiffstats
path: root/src/sql/doc
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql/doc')
-rw-r--r--src/sql/doc/qtsql.qdocconf12
-rw-r--r--src/sql/doc/snippets/CMakeLists.txt5
-rw-r--r--src/sql/doc/snippets/code/CMakeLists.txt3
-rw-r--r--src/sql/doc/snippets/code/doc_src_sql-driver.cpp83
-rw-r--r--src/sql/doc/snippets/code/doc_src_sql-driver.qdoc190
-rw-r--r--src/sql/doc/snippets/code/doc_src_sql-driver_snippet.cpp51
-rw-r--r--src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase.cpp51
-rw-r--r--src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase_snippet.cpp51
-rw-r--r--src/sql/doc/snippets/code/src_sql_kernel_qsqldriver.cpp51
-rw-r--r--src/sql/doc/snippets/code/src_sql_kernel_qsqlerror.cpp51
-rw-r--r--src/sql/doc/snippets/code/src_sql_kernel_qsqlquery.cpp53
-rw-r--r--src/sql/doc/snippets/code/src_sql_kernel_qsqlquery_snippet.cpp51
-rw-r--r--src/sql/doc/snippets/code/src_sql_kernel_qsqlresult.cpp51
-rw-r--r--src/sql/doc/snippets/code/src_sql_kernel_qsqlresult_snippet.cpp51
-rw-r--r--src/sql/doc/snippets/code/src_sql_models_qsqlquerymodel.cpp51
-rw-r--r--src/sql/doc/snippets/sqldatabase/CMakeLists.txt3
-rw-r--r--src/sql/doc/snippets/sqldatabase/sqldatabase.cpp57
-rw-r--r--src/sql/doc/snippets/sqldatabase/sqldatabase_snippet.cpp307
-rw-r--r--src/sql/doc/src/dontdocument.qdoc28
-rw-r--r--src/sql/doc/src/qsqldatatype-table.qdoc183
-rw-r--r--src/sql/doc/src/qt6-changes.qdoc30
-rw-r--r--src/sql/doc/src/qtsql.qdoc68
-rw-r--r--src/sql/doc/src/sql-driver.qdoc371
-rw-r--r--src/sql/doc/src/sql-programming.qdoc32
24 files changed, 640 insertions, 1244 deletions
diff --git a/src/sql/doc/qtsql.qdocconf b/src/sql/doc/qtsql.qdocconf
index 5d009e080d..9f6e1a31e0 100644
--- a/src/sql/doc/qtsql.qdocconf
+++ b/src/sql/doc/qtsql.qdocconf
@@ -15,10 +15,6 @@ qhp.QtSql.virtualFolder = qtsql
qhp.QtSql.indexTitle = Qt SQL
qhp.QtSql.indexRoot =
-qhp.QtSql.filterAttributes = qtsql $QT_VERSION qtrefdoc
-qhp.QtSql.customFilters.Qt.name = QtSql $QT_VERSION
-qhp.QtSql.customFilters.Qt.filterAttributes = qtsql $QT_VERSION
-
qhp.QtSql.subprojects = classes
qhp.QtSql.subprojects.classes.title = C++ Classes
qhp.QtSql.subprojects.classes.indexTitle = Qt SQL C++ Classes
@@ -43,3 +39,11 @@ imagedirs += images \
navigation.landingpage = "Qt SQL"
navigation.cppclassespage = "Qt SQL C++ Classes"
+
+# Highlighted examples in Data Processing & IO category
+manifestmeta.highlighted.names = \
+ "QtSql/Master Detail Example" \
+ "QtSql/SQL Browser"
+
+# Enforce zero documentation warnings
+warninglimit = 0
diff --git a/src/sql/doc/snippets/CMakeLists.txt b/src/sql/doc/snippets/CMakeLists.txt
index 2e74eed35a..a5c34d5688 100644
--- a/src/sql/doc/snippets/CMakeLists.txt
+++ b/src/sql/doc/snippets/CMakeLists.txt
@@ -1,4 +1,7 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
#! [cmake_use]
-find_package(Qt6 COMPONENTS Sql REQUIRED)
+find_package(Qt6 REQUIRED COMPONENTS Sql)
target_link_libraries(mytarget PRIVATE Qt6::Sql)
#! [cmake_use]
diff --git a/src/sql/doc/snippets/code/CMakeLists.txt b/src/sql/doc/snippets/code/CMakeLists.txt
index 4ee4a41312..b6899137fe 100644
--- a/src/sql/doc/snippets/code/CMakeLists.txt
+++ b/src/sql/doc/snippets/code/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
add_library(code_snippets OBJECT
doc_src_sql-driver.cpp
src_sql_kernel_qsqldatabase.cpp
diff --git a/src/sql/doc/snippets/code/doc_src_sql-driver.cpp b/src/sql/doc/snippets/code/doc_src_sql-driver.cpp
index acfd31ee3a..efcb45c98e 100644
--- a/src/sql/doc/snippets/code/doc_src_sql-driver.cpp
+++ b/src/sql/doc/snippets/code/doc_src_sql-driver.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlDriver>
@@ -82,14 +35,6 @@ QSqlDatabase db;
db.setHostName("MyServer");
db.setDatabaseName("C:\\test.gdb");
//! [24]
-
-
-//! [25]
-// connect to database using the Latin-1 character set
-db.setConnectOptions("ISC_DPB_LC_CTYPE=Latin1");
-if (db.open())
- qDebug("The database connection is open.");
-//! [25]
}
void exProc()
@@ -102,10 +47,8 @@ if (q.next())
//! [26]
qDebug( \
-//! [31]
"QSqlDatabase: QMYSQL driver not loaded \
QSqlDatabase: available drivers: QMYSQL" \
-//! [31]
);
/* Commented because the following line is not compilable
@@ -135,17 +78,15 @@ while (query1.next()) {
//! [37]
}
-
-void setConnString()
+void callOutProc()
{
-//! [39]
-QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
-QString connectString = QStringLiteral(
- "DRIVER=/path/to/installation/libodbcHDB.so;"
- "SERVERNODE=hostname:port;"
- "UID=USER;"
- "PWD=PASSWORD;"
- "SCROLLABLERESULT=true");
-db.setDatabaseName(connectString);
-//! [39]
+//! [40]
+ QSqlDatabase db;
+ QSqlQuery query;
+ int i1 = 10, i2 = 0;
+ query.prepare("call qtestproc(?, ?)");
+ query.bindValue(0, i1, QSql::InOut);
+ query.bindValue(1, i2, QSql::Out);
+ query.exec();
+//! [40]
}
diff --git a/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc b/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc
index 97f7e5171a..896839a1d9 100644
--- a/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc
+++ b/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
//! [0]
[...]
@@ -74,39 +27,36 @@ END
//! [3]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DMySQL_INCLUDE_DIR="/usr/local/mysql/include" -DMySQL_LIBRARY="/usr/local/mysql/lib/libmysqlclient.<so|dylib>"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_source_directory>/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DMySQL_INCLUDE_DIR="/usr/local/mysql/include" -DMySQL_LIBRARY="/usr/local/mysql/lib/libmysqlclient.<so|dylib>"
+cmake --build .
+cmake --install .
//! [3]
//! [5]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib"
+cmake --build .
+cmake --install .
//! [5]
//! [7]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DOracle_INCLUDE_DIR="/usr/include/oracle/21/client64" -DOracle_LIBRARY="/usr/lib/oracle/21/client64/lib/libclntsh.<so|dylib>"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_source_directory>/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DOracle_INCLUDE_DIR="/usr/include/oracle/21/client64" -DOracle_LIBRARY="/usr/lib/oracle/21/client64/lib/libclntsh.<so|dylib>"
+cmake --build .
+cmake --install .
//! [7]
//! [8]
mkdir build-sqldrivers
cd build-sqldrivers
-qt-cmake -G"Ninja" <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DOracle_INCLUDE_DIR="C:\oracle\sdk\include" -DOracle_LIBRARY="C:\oracle\oci.lib"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DOracle_INCLUDE_DIR="C:\oracle\sdk\include" -DOracle_LIBRARY="C:\oracle\oci.lib"
+cmake --build .
+cmake --install .
//! [8]
@@ -118,20 +68,18 @@ set PATH=%PATH%;C:\oracle
//! [11]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DODBC_INCLUDE_DIR="/usr/local/unixODBC/include" -DODBC_LIBRARY="/usr/local/unixODBC/lib/libodbc.<so|dylib>"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_source_directory>/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DODBC_INCLUDE_DIR="/usr/local/unixODBC/include" -DODBC_LIBRARY="/usr/local/unixODBC/lib/libodbc.<so|dylib>"
+cmake --build .
+cmake --install .
//! [11]
//! [12]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform>
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform>
+cmake --build .
+cmake --install .
//! [12]
@@ -139,101 +87,109 @@ qt-cmake --install
mkdir build-psql-driver
cd build-psql-driver
-qt-cmake -G"Ninja" <qt_installation_path>/Src/qtbase/src/plugins/sqldrivers-DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DCMAKE_INCLUDE_PATH="/usr/local/pgsql/include" -DCMAKE_LIBRARY_PATH="/usr/local/pgsql/lib"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_source_directory>/qtbase/src/plugins/sqldrivers-DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DCMAKE_INCLUDE_PATH="/usr/local/pgsql/include" -DCMAKE_LIBRARY_PATH="/usr/local/pgsql/lib"
+cmake --build .
+cmake --install .
//! [13]
//! [15]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DCMAKE_INCLUDE_PATH="C:\pgsql\include" -DCMAKE_LIBRARY_PATH="C:\pgsql\lib"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DCMAKE_INCLUDE_PATH="C:\pgsql\include" -DCMAKE_LIBRARY_PATH="C:\pgsql\lib"
+cmake --build .
+cmake --install .
//! [15]
//! [18]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DDB2_INCLUDE_DIR="/usr/local/db2/include" -DDB2_LIBRARY="/usr/local/db2/lib/libdb2.<so|dylib>"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_source_directory>/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DDB2_INCLUDE_DIR="/usr/local/db2/include" -DDB2_LIBRARY="/usr/local/db2/lib/libdb2.<so|dylib>"
+cmake --build .
+cmake --install .
//! [18]
//! [20]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DDB2_INCLUDE_DIR="C:\db2\include" -DDB2_LIBRARY="C:\db2\lib\db2.lib"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DDB2_INCLUDE_DIR="C:\db2\include" -DDB2_LIBRARY="C:\db2\lib\db2.lib"
+cmake --build .
+cmake --install .
//! [20]
//! [21]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DFEATURE_system_sqlite=ON -DCMAKE_INCLUDE_PATH="$SQLITE/include" -DCMAKE_LIBRARY_PATH="$SQLITE/lib"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_source_directory>/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DFEATURE_system_sqlite=ON -DCMAKE_INCLUDE_PATH="$SQLITE/include" -DCMAKE_LIBRARY_PATH="$SQLITE/lib"
+cmake --build .
+cmake --install .
//! [21]
//! [23]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DFEATURE_system_sqlite=ON -DCMAKE_INCLUDE_PATH="C:\SQLITE\include" -DCMAKE_LIBRARY_PATH="C:\SQLITE\lib"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DFEATURE_system_sqlite=ON -DCMAKE_INCLUDE_PATH="C:\SQLITE\include" -DCMAKE_LIBRARY_PATH="C:\SQLITE\lib"
+cmake --build .
+cmake --install .
//! [23]
//! [27]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DInterbase_INCLUDE_DIR="/opt/interbase/include" -DInterbase_LIBRARY="/opt/interbase/lib/libgds.<so|dylib>"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_source_directory>/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DInterbase_INCLUDE_DIR="/opt/interbase/include" -DInterbase_LIBRARY="/opt/interbase/lib/libgds.<so|dylib>"
+cmake --build .
+cmake --install .
//! [27]
//! [28]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DInterbase_INCLUDE_DIR="/opt/interbase/include" -DInterbase_LIBRARY="/opt/interbase/lib/libfbclient.<so|dylib>"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_source_directory>/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>/<platform> -DInterbase_INCLUDE_DIR="/opt/interbase/include" -DInterbase_LIBRARY="/opt/interbase/lib/libfbclient.<so|dylib>"
+cmake --build .
+cmake --install .
//! [28]
//! [29]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DInterbase_INCLUDE_DIR="C:\interbase\include" -DInterbase_LIBRARY="C:\interbase\gds.lib"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DInterbase_INCLUDE_DIR="C:\interbase\include" -DInterbase_LIBRARY="C:\interbase\gds.lib"
+cmake --build .
+cmake --install .
//! [29]
//! [30]
mkdir build-sqldrivers
cd build-sqldrivers
-
-qt-cmake -G"Ninja" <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DInterbase_INCLUDE_DIR="C:\interbase\include" -DInterbase_LIBRARY="C:\interbase\lib\fbclient_ms.lib"
-qt-cmake --build .
-qt-cmake --install
+qt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DInterbase_INCLUDE_DIR="C:\interbase\include" -DInterbase_LIBRARY="C:\interbase\lib\fbclient_ms.lib"
+cmake --build .
+cmake --install .
//! [30]
+//! [31]
+mkdir build-sqldrivers
+cd build-sqldrivers
+
+qt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DMimer_INCLUDE_DIR="/usr/include" -DMimer_LIBRARIES="/usr/lib/libmimer.so"
+cmake --build .
+cmake --install .
+//! [31]
+
+//! [32]
+mkdir build-sqldrivers
+cd build-sqldrivers
+
+qt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DMimer_INCLUDE_DIR="C:\Program Files\Mimer SQL Experience 11.0\dev\include" -DMimer_LIBRARIES="C:\Program Files\Mimer SQL Experience 11.0\dev\lib\amd64\mimapi64.lib|C:\Program Files\Mimer SQL Experience 11.0\dev\lib\x86\mimapi32.lib"
+cmake --build .
+cmake --install .
+//! [32]
//! [35]
QSqlDatabase: QPSQL driver not loaded
@@ -260,12 +216,13 @@ QSqlRecord rec = database.record(tableString.toLower());
//! [40]
//! [41]
-C:\Qt\6.0.0\mingw81_64\bin\qt-cmake -G"Ninja" C:\Qt\6.0.0\Src\qtbase\src\plugins\sqldrivers -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib" -DCMAKE_INSTALL_PREFIX="C:\Qt\6.0.0\mingw81_64"
+C:\Qt\6.0.0\mingw81_64\bin\qt-cmake -G Ninja C:\Qt\6.0.0\Src\qtbase\src\plugins\sqldrivers -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib" -DCMAKE_INSTALL_PREFIX="C:\Qt\6.0.0\mingw81_64"
Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
+ Mimer SQL .............................. yes
MySql .................................. yes
OCI (Oracle) ........................... no
ODBC ................................... yes
@@ -286,6 +243,7 @@ Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
+ Mimer SQL .............................. yes
MySql .................................. yes
OCI (Oracle) ........................... no
ODBC ................................... yes
@@ -303,6 +261,7 @@ Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
+ Mimer SQL .............................. yes
MySql .................................. yes
OCI (Oracle) ........................... no
ODBC ................................... yes
@@ -312,3 +271,10 @@ Qt Sql Drivers:
...
//! [43]
+//! [44]
+create procedure inout_proc (INOUT param1 INT, OUT param2 INT)
+BEGIN
+ set param1 = param1 * 2;
+ set param2 = param1 * param1;
+END
+//! [44]
diff --git a/src/sql/doc/snippets/code/doc_src_sql-driver_snippet.cpp b/src/sql/doc/snippets/code/doc_src_sql-driver_snippet.cpp
index 7cffe58ff1..22820063e4 100644
--- a/src/sql/doc/snippets/code/doc_src_sql-driver_snippet.cpp
+++ b/src/sql/doc/snippets/code/doc_src_sql-driver_snippet.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [36]
QSqlQuery query;
QVariant v;
diff --git a/src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase.cpp b/src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase.cpp
index c7ceb847da..d892ad7567 100644
--- a/src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase.cpp
+++ b/src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlDriver>
diff --git a/src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase_snippet.cpp b/src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase_snippet.cpp
index a53880fee1..b321ad121b 100644
--- a/src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase_snippet.cpp
+++ b/src/sql/doc/snippets/code/src_sql_kernel_qsqldatabase_snippet.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [2]
QSqlDatabase::registerSqlDriver("MYDRIVER", new QSqlDriverCreator<QSqlDriver>);
diff --git a/src/sql/doc/snippets/code/src_sql_kernel_qsqldriver.cpp b/src/sql/doc/snippets/code/src_sql_kernel_qsqldriver.cpp
index 47e8701149..3d955cbac9 100644
--- a/src/sql/doc/snippets/code/src_sql_kernel_qsqldriver.cpp
+++ b/src/sql/doc/snippets/code/src_sql_kernel_qsqldriver.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlDriver>
diff --git a/src/sql/doc/snippets/code/src_sql_kernel_qsqlerror.cpp b/src/sql/doc/snippets/code/src_sql_kernel_qsqlerror.cpp
index d442768fe2..85a0ca6665 100644
--- a/src/sql/doc/snippets/code/src_sql_kernel_qsqlerror.cpp
+++ b/src/sql/doc/snippets/code/src_sql_kernel_qsqlerror.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlQueryModel>
diff --git a/src/sql/doc/snippets/code/src_sql_kernel_qsqlquery.cpp b/src/sql/doc/snippets/code/src_sql_kernel_qsqlquery.cpp
index 71bd6eccf0..b62d5065ce 100644
--- a/src/sql/doc/snippets/code/src_sql_kernel_qsqlquery.cpp
+++ b/src/sql/doc/snippets/code/src_sql_kernel_qsqlquery.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlDriver>
@@ -73,7 +26,7 @@ ints << 1 << 2 << 3 << 4;
q.addBindValue(ints);
QVariantList names;
-names << "Harald" << "Boris" << "Trond" << QVariant(QMetaType::QString);
+names << "Harald" << "Boris" << "Trond" << QVariant(QMetaType::fromType<QString>());
q.addBindValue(names);
if (!q.execBatch())
diff --git a/src/sql/doc/snippets/code/src_sql_kernel_qsqlquery_snippet.cpp b/src/sql/doc/snippets/code/src_sql_kernel_qsqlquery_snippet.cpp
index d7d2a14d56..477f6ad629 100644
--- a/src/sql/doc/snippets/code/src_sql_kernel_qsqlquery_snippet.cpp
+++ b/src/sql/doc/snippets/code/src_sql_kernel_qsqlquery_snippet.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [0]
SELECT forename, surname FROM people;
//! [0]
diff --git a/src/sql/doc/snippets/code/src_sql_kernel_qsqlresult.cpp b/src/sql/doc/snippets/code/src_sql_kernel_qsqlresult.cpp
index 606b6d19fa..a5e135aaf3 100644
--- a/src/sql/doc/snippets/code/src_sql_kernel_qsqlresult.cpp
+++ b/src/sql/doc/snippets/code/src_sql_kernel_qsqlresult.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlDriver>
diff --git a/src/sql/doc/snippets/code/src_sql_kernel_qsqlresult_snippet.cpp b/src/sql/doc/snippets/code/src_sql_kernel_qsqlresult_snippet.cpp
index 2b1891f6c1..e17977bf54 100644
--- a/src/sql/doc/snippets/code/src_sql_kernel_qsqlresult_snippet.cpp
+++ b/src/sql/doc/snippets/code/src_sql_kernel_qsqlresult_snippet.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [2]
if (qstrcmp(v.typeName(), "PGresult*") == 0) {
diff --git a/src/sql/doc/snippets/code/src_sql_models_qsqlquerymodel.cpp b/src/sql/doc/snippets/code/src_sql_models_qsqlquerymodel.cpp
index cb2bde6c7d..6577c02f40 100644
--- a/src/sql/doc/snippets/code/src_sql_models_qsqlquerymodel.cpp
+++ b/src/sql/doc/snippets/code/src_sql_models_qsqlquerymodel.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlDriver>
diff --git a/src/sql/doc/snippets/sqldatabase/CMakeLists.txt b/src/sql/doc/snippets/sqldatabase/CMakeLists.txt
index 80f2ae0b73..5179c694d0 100644
--- a/src/sql/doc/snippets/sqldatabase/CMakeLists.txt
+++ b/src/sql/doc/snippets/sqldatabase/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
add_library(sqldatabase_snippets OBJECT
sqldatabase.cpp
)
diff --git a/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp b/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp
index d58f6640a0..5702116365 100644
--- a/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp
+++ b/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QCoreApplication>
#include <QtSql>
@@ -203,9 +156,9 @@ void QSqlQuery_snippets()
{
// examine with named or positional binding
//! [14]
- QVariantList list = query.boundValues();
- for (int i = 0; i < list.size(); ++i)
- cout << i << ": " << list.at(i).toString().toUtf8().data() << "\n";
+ const QVariantList list = query.boundValues();
+ for (qsizetype i = 0; i < list.size(); ++i)
+ qDebug() << i << ":" << list.at(i).toString();
//! [14]
}
}
diff --git a/src/sql/doc/snippets/sqldatabase/sqldatabase_snippet.cpp b/src/sql/doc/snippets/sqldatabase/sqldatabase_snippet.cpp
index 604eb97e58..48382bfee9 100644
--- a/src/sql/doc/snippets/sqldatabase/sqldatabase_snippet.cpp
+++ b/src/sql/doc/snippets/sqldatabase/sqldatabase_snippet.cpp
@@ -1,52 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//! [16]
QSqlQueryModel *model = new QSqlQueryModel;
@@ -64,17 +17,13 @@
//! [20]
}
-//! [21]
QSqlQueryModel model;
model.setQuery("SELECT name, salary FROM employee");
int salary = model.record(4).value("salary").toInt();
-//! [21]
Q_UNUSED(salary);
{
-//! [22]
int salary = model.data(model.index(4, 1)).toInt();
-//! [22]
Q_UNUSED(salary);
}
@@ -94,7 +43,6 @@ public:
int m_specialColumnNo;
};
-//! [23]
QVariant MyModel::data(const QModelIndex &item, int role) const
{
if (item.column() == m_specialColumnNo) {
@@ -102,7 +50,6 @@ QVariant MyModel::data(const QModelIndex &item, int role) const
}
return QSqlQueryModel::data(item, role);
}
-//! [23]
void QSqlTableModel_snippets()
{
@@ -119,258 +66,8 @@ void QSqlTableModel_snippets()
view->hideColumn(0); // don't show the ID
view->show();
//! [24]
-
- {
-//! [25]
- QSqlTableModel model;
- model.setTable("employee");
- model.select();
- int salary = model.record(4).value("salary").toInt();
-//! [25]
- }
-}
-
-void sql_intro_snippets()
-{
- {
-//! [26]
- QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
- db.setHostName("bigblue");
- db.setDatabaseName("flightdb");
- db.setUserName("acarlson");
- db.setPassword("1uTbSbAs");
- bool ok = db.open();
-//! [26]
- Q_UNUSED(ok);
- }
-
- {
-//! [27]
- QSqlDatabase firstDB = QSqlDatabase::addDatabase("QMYSQL", "first");
- QSqlDatabase secondDB = QSqlDatabase::addDatabase("QMYSQL", "second");
-//! [27]
- }
-
- {
-//! [28]
- QSqlDatabase defaultDB = QSqlDatabase::database();
-//! [28] //! [29]
- QSqlDatabase firstDB = QSqlDatabase::database("first");
-//! [29] //! [30]
- QSqlDatabase secondDB = QSqlDatabase::database("second");
-//! [30]
- }
-
- {
- // SELECT1
-//! [31]
- QSqlQuery query;
- query.exec("SELECT name, salary FROM employee WHERE salary > 50000");
-//! [31]
-
-//! [32]
- while (query.next()) {
- QString name = query.value(0).toString();
- int salary = query.value(1).toInt();
- qDebug() << name << salary;
- }
-//! [32]
- }
-
- {
- // FEATURE
-//! [33]
- QSqlQuery query;
- int numRows;
- query.exec("SELECT name, salary FROM employee WHERE salary > 50000");
-
- QSqlDatabase defaultDB = QSqlDatabase::database();
- if (defaultDB.driver()->hasFeature(QSqlDriver::QuerySize)) {
- numRows = query.size();
- } else {
- // this can be very slow
- query.last();
- numRows = query.at() + 1;
- }
-//! [33]
- }
-
- {
- // INSERT1
-//! [34]
- QSqlQuery query;
- query.exec("INSERT INTO employee (id, name, salary) "
- "VALUES (1001, 'Thad Beaumont', 65000)");
-//! [34]
- }
-
- {
- // NAMED BINDING
-//! [35]
- QSqlQuery query;
- query.prepare("INSERT INTO employee (id, name, salary) "
- "VALUES (:id, :name, :salary)");
- query.bindValue(":id", 1001);
- query.bindValue(":name", "Thad Beaumont");
- query.bindValue(":salary", 65000);
- query.exec();
-//! [35]
- }
-
- {
- // POSITIONAL BINDING
-//! [36]
- QSqlQuery query;
- query.prepare("INSERT INTO employee (id, name, salary) "
- "VALUES (?, ?, ?)");
- query.addBindValue(1001);
- query.addBindValue("Thad Beaumont");
- query.addBindValue(65000);
- query.exec();
-//! [36]
- }
-
- {
- // UPDATE1
-//! [37]
- QSqlQuery query;
- query.exec("UPDATE employee SET salary = 70000 WHERE id = 1003");
-//! [37]
- }
-
- {
- // DELETE1
-//! [38]
- QSqlQuery query;
- query.exec("DELETE FROM employee WHERE id = 1007");
-//! [38]
- }
-
- {
- // TRANSACTION
-//! [39]
- QSqlDatabase::database().transaction();
- QSqlQuery query;
- query.exec("SELECT id FROM employee WHERE name = 'Torild Halvorsen'");
- if (query.next()) {
- int employeeId = query.value(0).toInt();
- query.exec("INSERT INTO project (id, name, ownerid) "
- "VALUES (201, 'Manhattan Project', "
- + QString::number(employeeId) + ')');
- }
- QSqlDatabase::database().commit();
-//! [39]
- }
-
- {
- // SQLQUERYMODEL1
-//! [40]
- QSqlQueryModel model;
- model.setQuery("SELECT * FROM employee");
-
- for (int i = 0; i < model.rowCount(); ++i) {
- int id = model.record(i).value("id").toInt();
- QString name = model.record(i).value("name").toString();
- qDebug() << id << name;
- }
-//! [40]
- }
-
- {
- // SQLTABLEMODEL1
-//! [41]
- QSqlTableModel model;
- model.setTable("employee");
- model.setFilter("salary > 50000");
- model.setSort(2, Qt::DescendingOrder);
- model.select();
-
- for (int i = 0; i < model.rowCount(); ++i) {
- QString name = model.record(i).value("name").toString();
- int salary = model.record(i).value("salary").toInt();
- qDebug() << name << salary;
- }
-//! [41]
- }
-
- {
- // SQLTABLEMODEL2
- QSqlTableModel model;
- model.setTable("employee");
-
-//! [42]
- for (int i = 0; i < model.rowCount(); ++i) {
- QSqlRecord record = model.record(i);
- double salary = record.value("salary").toInt();
- salary *= 1.1;
- record.setValue("salary", salary);
- model.setRecord(i, record);
- }
- model.submitAll();
-//! [42]
-
- // SQLTABLEMODEL3
- int row = 1;
- int column = 2;
-//! [43]
- model.setData(model.index(row, column), 75000);
- model.submitAll();
-//! [43]
-
- // SQLTABLEMODEL4
-//! [44]
- model.insertRows(row, 1);
- model.setData(model.index(row, 0), 1013);
- model.setData(model.index(row, 1), "Peter Gordon");
- model.setData(model.index(row, 2), 68500);
- model.submitAll();
-//! [44]
-
-//! [45]
- model.removeRows(row, 5);
-//! [45] //! [46]
- model.submitAll();
-//! [46]
- }
}
-//! [47]
-class XyzResult : public QSqlResult
-{
-public:
- XyzResult(const QSqlDriver *driver)
- : QSqlResult(driver) {}
- ~XyzResult() {}
-
-protected:
- QVariant data(int /* index */) override { return QVariant(); }
- bool isNull(int /* index */) override { return false; }
- bool reset(const QString & /* query */) override { return false; }
- bool fetch(int /* index */) override { return false; }
- bool fetchFirst() override { return false; }
- bool fetchLast() override { return false; }
- int size() override { return 0; }
- int numRowsAffected() override { return 0; }
- QSqlRecord record() const override { return QSqlRecord(); }
-};
-//! [47]
-
-//! [48]
-class XyzDriver : public QSqlDriver
-{
-public:
- XyzDriver() {}
- ~XyzDriver() {}
-
- bool hasFeature(DriverFeature /* feature */) const override { return false; }
- bool open(const QString & /* db */, const QString & /* user */,
- const QString & /* password */, const QString & /* host */,
- int /* port */, const QString & /* options */) override
- { return false; }
- void close() {}
- QSqlResult *createResult() const override { return new XyzResult(this); }
-};
-//! [48]
int main(int argc, char **argv)
{
diff --git a/src/sql/doc/src/dontdocument.qdoc b/src/sql/doc/src/dontdocument.qdoc
index 0193ace4b4..3601a9841a 100644
--- a/src/sql/doc/src/dontdocument.qdoc
+++ b/src/sql/doc/src/dontdocument.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\dontdocument (QTypeInfo)
diff --git a/src/sql/doc/src/qsqldatatype-table.qdoc b/src/sql/doc/src/qsqldatatype-table.qdoc
index 434d2f1d9a..77aa56d21a 100644
--- a/src/sql/doc/src/qsqldatatype-table.qdoc
+++ b/src/sql/doc/src/qsqldatatype-table.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page sql-types.html
@@ -293,7 +269,7 @@
\row
\li NUMBER(p,s)
\li NUMERIC(p,s) DECIMAL(p,s)a
- \li By default mapping to QString
+ \li Mapped to QString
\row
\li NVARCHAR2(n)
\li Character string (NATIONAL CHARACTER VARYING(n) NATIONAL
@@ -502,4 +478,157 @@
\li The value is a BLOB of data, stored exactly as it was input.
\li Mapped to QByteArray
\endtable
+
+ \section2 Mimer SQL Data Types
+
+ \table 90%
+ \header
+ \li Mimer SQL type
+ \li SQL type description
+ \li Recommended input (C++ or Qt data type)
+ \row
+ \li SMALLINT
+ \li 16-bit signed integer
+ \li typedef qint16
+ \row
+ \li INTEGER
+ \li 32-bit signed integer
+ \li typedef qint32
+ \row
+ \li INTEGER(n)
+ \li Integer with up to 45 digits precision
+ \li Mapped to QString
+ \row
+ \li BIGINT
+ \li 64-bit signed integer
+ \li typedef qint64
+ \row
+ \li REAL
+ \li 32-bit Single-precision IEEE floating point
+ \li typedef float
+ \row
+ \li DOUBLE PRECISION
+ \li 64-bit Double-precision IEEE floating point
+ \li Mapped to QString for high precision doubles, otherwise qreal
+ \row
+ \li FLOAT
+ \li 64-bit Double-precision IEEE floating point
+ \li Mapped to QString for high precision doubles, otherwise qreal
+ \row
+ \li FLOAT(n)
+ \li Floating point with up to 45 digits precision
+ \li Mapped to QString
+ \row
+ \li DECIMAL(p,s)
+ \li Decimal with up to 45 digits precision and scale
+ \li Mapped to QString
+ \row
+ \li CHAR
+ \li Fixed-length character Latin-1 string (CHAR or character)
+ \li Mapped to QString
+ \row
+ \li VARCHAR
+ \li Variable length Latin-1 string (VARCHAR or CHARACTER VARYING)
+ \li Mapped to QString
+ \row
+ \li NCHAR
+ \li Fixed-length Unicode string (NCHAR or NATIONAL CHARACTER)
+ \li Mapped to QString
+ \row
+ \li NVARCHAR
+ \li Variable length Unicode string (NVARCHAR or NATIONAL CHARACTER VARYING)
+ \li Mapped to QString
+ \row
+ \li BINARY
+ \li Fixed length binary data
+ \li Mapped to QByteArray
+ \row
+ \li VARBINARY
+ \li Variable length binary data (VARBINARY or BINARY VARYING)
+ \li Mapped to QByteArray
+ \row
+ \li BLOB
+ \li Binary large object (BLOB or BINARY LARGE OBJECT)
+ \li Mapped to QByteArray
+ \row
+ \li CLOB
+ \li Latin-1 character large object (CLOB or CHARACTER LARGE OBJECT)
+ \li Mapped to QString
+ \row
+ \li NCLOB
+ \li Unicode character large object (NCLOB or NATIONAL CHARACTER LARGE OBJECT)
+ \li Mapped to QString
+ \row
+ \li DATE
+ \li Date consisting of year, month, and day
+ \li Mapped to QDate
+ \row
+ \li TIME
+ \li Time consisting of hours, minute, seconds with optional fractional seconds
+ \li Mapped to QTime
+ \row
+ \li TIMESTAMP
+ \li Date and time with optional fractional seconds
+ \li Mapped to QDateTime
+ \row
+ \li BUILTIN.UUID
+ \li Universally unique identifier
+ \li Mapped to QUuid
+ \row
+ \li BOOLEAN
+ \li Boolean
+ \li bool
+ \row
+ \li INTERVAL YEAR(7)
+ \li Year, format '±yyyyyyy' (max precision)
+ \li Mapped to QString
+ \row
+ \li INTERVAL YEAR(7) TO MONTH
+ \li Year to month, format '±yyyyyyy-mm' (max precision)
+ \li Mapped to QString
+ \row
+ \li INTERVAL MONTH(7)
+ \li Month, format '±mmmmmmm' (max precision)
+ \li Mapped to QString
+ \row
+ \li INTERVAL DAY(7)
+ \li Day, format '±ddddddd' (max precision)
+ \li Mapped to QString
+ \row
+ \li INTERVAL DAY(7) TO HOUR
+ \li Day to hour, format '±ddddddd hh' (max precision)
+ \li Mapped to QString
+ \row
+ \li INTERVAL DAY(7) TO MINUTE
+ \li Day to minute, format '±ddddddd hh:mm' (max precision)
+ \li Mapped to QString
+ \row
+ \li INTERVAL DAY(7) TO SECOND(9)
+ \li Day to second, format '±ddddddd hh:mm:ss[.fffffffff]' (max precision)
+ \li Mapped to QString
+ \row
+ \li INTERVAL HOUR(8)
+ \li Hour, format '±hhhhhhhh' (max precision)
+ \li Mapped to QString
+ \row
+ \li INTERVAL HOUR(8) TO MINUTE
+ \li Hour to minute, format '±hhhhhhhh:mm' (max precision)
+ \li Mapped to QString
+ \row
+ \li INTERVAL HOUR(8) TO SECOND(9)
+ \li Hour to second, format '±hhhhhhhh:mm:ss[.fffffffff]' (max precision)
+ \li Mapped to QString
+ \row
+ \li INTERVAL MINUTE(10)
+ \li Minute, format '±mmmmmmmmmm' (max precision)
+ \li Mapped to QString
+ \row
+ \li INTERVAL MINUTE(10) TO SECOND(9)
+ \li Minute to second, format '±mmmmmmmmmm:ss[.fffffffff]' (max precision)
+ \li Mapped to QString
+ \row
+ \li INTERVAL SECOND(12,9)
+ \li Second, format '±ssssssssssss[.fffffffff]' (max precision)
+ \li Mapped to QString
+ \endtable
*/
diff --git a/src/sql/doc/src/qt6-changes.qdoc b/src/sql/doc/src/qt6-changes.qdoc
index 55c94d0b60..28c4664fdd 100644
--- a/src/sql/doc/src/qt6-changes.qdoc
+++ b/src/sql/doc/src/qt6-changes.qdoc
@@ -1,35 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page qtsql-changes-qt6.html
\title Changes to Qt SQL
\ingroup changes-qt-5-to-6
- \brief Migrate Qt SQL to Qt 6.
+ \brief The return type for boundValues() has been changed in QSqlQuery class.
Qt 6 is a result of the conscious effort to make the framework more
efficient and easy to use.
diff --git a/src/sql/doc/src/qtsql.qdoc b/src/sql/doc/src/qtsql.qdoc
index 9d9eb369da..78acaf1fd0 100644
--- a/src/sql/doc/src/qtsql.qdoc
+++ b/src/sql/doc/src/qtsql.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page qtsql-index.html
\title Qt SQL
@@ -41,13 +17,35 @@
The \l{SQL Programming} guide contains information about development using
Qt SQL.
- \include module-use.qdocinc using qt module
- \snippet snippets/CMakeLists.txt cmake_use
+ \section1 Using the Module
- See also the \l {Build with CMake} overview.
+ \include {module-use.qdocinc} {using the c++ api}
- \include module-use.qdocinc building with qmake
- \snippet snippets/code/code.pro qmake_use
+ \section2 Building with CMake
+
+ \include {module-use.qdocinc} {building with cmake} {Sql}
+
+ \section2 Building with qmake
+
+ \include {module-use.qdocinc} {building_with_qmake} {sql}
+
+ \section1 Articles and Guides
+
+ \list
+ \li \l {SQL Programming} {Qt SQL Programming Guide}
+ \endlist
+
+ \section1 Examples
+
+ \list
+ \li \l {SQL Examples}
+ \endlist
+
+ \section1 Reference
+
+ \list
+ \li \l {Qt SQL C++ Classes} {C++ Classes}
+ \endlist
\section1 Module Evolution
\l{Changes to Qt SQL} lists important changes in the module API
@@ -65,14 +63,6 @@
modules under following permissive licenses:
\generatelist{groupsbymodule attributions-qtsql}
-
- \section1 Related Information
-
- These are links to the API reference materials and related pages.
- \list
- \li \l{Qt SQL C++ Classes}{C++ Classes}
- \li \l{SQL Examples}
- \endlist
*/
/*!
diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc
index 06dd0a1312..4cc5b0d050 100644
--- a/src/sql/doc/src/sql-driver.qdoc
+++ b/src/sql/doc/src/sql-driver.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page sql-driver.html
@@ -47,6 +23,7 @@
\table
\header \li Driver name \li DBMS
\row \li \l{#QDB2}{QDB2} \li IBM DB2 (version 7.1 and above)
+ \row \li \l{#QIBASE}{QIBASE} \li Borland InterBase / Firebird
\row \li \l{#QMYSQL}{QMYSQL / MARIADB} \li MySQL or MariaDB (version 5.6 and above)
\row \li \l{#QOCI}{QOCI} \li Oracle Call Interface Driver (version 12.1 and above)
\row \li \l{#QODBC}{QODBC}
@@ -54,6 +31,7 @@
ODBC-compliant databases
\row \li \l{#QPSQL}{QPSQL} \li PostgreSQL (versions 7.3 and above)
\row \li \l{#QSQLITE}{QSQLITE} \li SQLite version 3
+ \row \li \l{#QMIMER}{QMIMER} \li Mimer SQL (version 11 and above)
\endtable
SQLite is the in-process database system with the best test coverage
@@ -149,7 +127,7 @@
\section3 QMYSQL Stored Procedure Support
- MySQL 5 has stored procedure support at the SQL level, but no
+ MySQL has stored procedure support at the SQL level, but no
API to control IN, OUT, and INOUT parameters. Therefore, parameters
have to be set and read using SQL commands instead of QSqlQuery::bindValue().
@@ -178,6 +156,96 @@
Please refer to the MySQL documentation, chapter "libmysqld, the Embedded
MySQL Server Library" for more information about the MySQL embedded server.
+ \section3 Connection options
+ The Qt MySQL/MariaDB plugin honors the following connection options:
+ \table
+ \header \li Attribute \li Possible value
+ \row
+ \li CLIENT_COMPRESS
+ \li If set, switches to compressed protocol after successful authentication
+ \row
+ \li CLIENT_FOUND_ROWS
+ \li If set, send found rows instead of affected rows
+ \row
+ \li CLIENT_IGNORE_SPACE
+ \li If set, ignore spaces before '('
+ \row
+ \li CLIENT_NO_SCHEMA
+ \li If set, don't allow database.table.column
+ \row
+ \li CLIENT_INTERACTIVE
+ \li If set, client is treated as interactive
+ \row
+ \li MYSQL_OPT_PROTOCOL
+ \li explicitly specify the protocol to use:\br
+ MYSQL_PROTOCOL_TCP: use tcp connection (ip/hostname specified through setHostname())
+ MYSQL_PROTOCOL_SOCKET: connect through a socket specified in UNIX_SOCKET
+ MYSQL_PROTOCOL_PIPE: connect through a named pipe specified in UNIX_SOCKET
+ MYSQL_PROTOCOL_MEMORY: connect through shared memory specified in MYSQL_SHARED_MEMORY_BASE_NAME
+ \row
+ \li UNIX_SOCKET
+ \li Specifies the socket or named pipe to use, even it's called UNIX_SOCKET it
+ can also be used on windows
+ \row
+ \li MYSQL_SHARED_MEMORY_BASE_NAME
+ \li Specified the shared memory segment name to use
+ \row
+ \li MYSQL_OPT_RECONNECT
+ \li TRUE or 1: Automatically reconnect after connection loss\br
+ FALSE or 0: No automatic reconnect after connection loss (default)\br
+ See \l {https://dev.mysql.com/doc/c-api/8.0/en/c-api-auto-reconnect.html}
+ {Automatic Reconnection Control}
+ \row
+ \li MYSQL_OPT_CONNECT_TIMEOUT
+ \li The connect timeout in seconds
+ \row
+ \li MYSQL_OPT_READ_TIMEOUT
+ \li The timeout in seconds for each attempt to read from the server
+ \row
+ \li MYSQL_OPT_WRITE_TIMEOUT
+ \li The timeout in seconds for each attempt to write to the server
+ \row
+ \li MYSQL_OPT_LOCAL_INFILE
+ \li Set to 1 to enable the support for local
+ \l {https://dev.mysql.com/doc/refman/8.0/en/load-data.html} {LOAD_DATA},
+ disabled if not set or 0
+ \row
+ \li MYSQL_OPT_SSL_MODE
+ \li The security state to use for the connection to the server: SSL_MODE_DISABLED,
+ SSL_MODE_PREFERRED, SSL_MODE_REQUIRED, SSL_MODE_VERIFY_CA, SSL_MODE_VERIFY_IDENTITY.
+ \row
+ \li MYSQL_OPT_TLS_VERSION
+ \li A list of protocols the client permits for encrypted connections. The value can be
+ a combination of 'TLSv1' ,' TLSv1.1', 'TLSv1.2' or 'TLSv1.3' depending on the used \l
+ {https://dev.mysql.com/doc/refman/8.0/en/encrypted-connection-protocols-ciphers.html#encrypted-connection-protocol-configuration}
+ {MySQL server} version.
+ \row
+ \li MYSQL_OPT_SSL_KEY / SSL_KEY (deprecated)
+ \li The path name of the client private key file
+ \row
+ \li MYSQL_OPT_SSL_CERT / SSL_CERT (deprecated)
+ \li The path name of the client public key certificate file
+ \row
+ \li MYSQL_OPT_SSL_CA / SSL_CA (deprecated)
+ \li The path name of the Certificate Authority (CA) certificate file
+ \row
+ \li MYSQL_OPT_SSL_CAPATH / SSL_CAPATH (deprecated)
+ \li The path name of the directory that contains trusted SSL CA certificate files
+ \row
+ \li MYSQL_OPT_SSL_CIPHER / SSL_CIPHER (deprecated)
+ \li The list of permissible ciphers for SSL encryption
+ \row
+ \li MYSQL_OPT_SSL_CRL
+ \li The path name of the file containing certificate revocation lists
+ \row
+ \li MYSQL_OPT_SSL_CRLPATH
+ \li The path name of the directory that contains files containing certificate revocation lists
+ \endtable
+ For more detailed information about the connect options please refer
+ to the \l {https://dev.mysql.com/doc/c-api/8.0/en/mysql-options.html}
+ {mysql_options()} MySQL documentation.
+
+
\section3 How to Build the QMYSQL Plugin on Unix and \macos
You need the MySQL / MariaDB header files, as well as the shared library
@@ -194,8 +262,8 @@
\section3 How to Build the QMYSQL Plugin on Windows
You need to get the MySQL installation files (e.g.
- \l {https://dev.mysql.com/downloads/installer/}{mysql-installer-web-community-8.0.22.0.msi} or
- \l {https://downloads.mariadb.com/Connectors/c/connector-c-3.1.11/}{mariadb-connector-c-3.1.11-win64.msi}).
+ \l {https://dev.mysql.com/downloads/installer/}{MySQL web installer} or
+ \l {https://downloads.mariadb.com/Connectors/c/}{MariaDB C Connector}).
Run the installer,
select custom installation and install the MySQL C Connector
which matches your Qt installation (x86 or x64).
@@ -260,6 +328,29 @@
BLOBs are bound to placeholders or QSqlTableModel, which uses a prepared
query to do this internally.
+ \section3 Connection options
+ The Qt OCI plugin honors the following connection options:
+ \table
+ \header \li Attribute \li Possible value
+ \row
+ \li OCI_ATTR_PREFETCH_ROWS
+ \li Sets the OCI attribute
+ \l {https://docs.oracle.com/database/121/LNOCI/oci04sql.htm#LNOCI16355}
+ {OCI_ATTR_PREFETCH_ROWS} to the specified value
+ \row
+ \li OCI_ATTR_PREFETCH_MEMORY
+ \li Sets the OCI attribute
+ \l {https://docs.oracle.com/database/121/LNOCI/oci04sql.htm#LNOCI16355}
+ {OCI_ATTR_PREFETCH_MEMORY} to the specified value
+ \row
+ \li OCI_AUTH_MODE
+ \li OCI_SYSDBA: authenticate for SYSDBA access\br
+ OCI_SYSOPER: authenticate for SYSOPER access\br
+ OCI_DEFAULT: authenticate with normal access\br
+ see \l {https://docs.oracle.com/cd/B10500_01/appdev.920/a96584/oci15r13.htm}
+ {OCISessionBegin} for more information about the access modes
+ \endtable
+
\section3 How to Build the OCI Plugin on Unix and \macos
All you need is the " - Basic" and "Instant Client
@@ -294,7 +385,7 @@
\snippet code/doc_src_sql-driver.qdoc 8
- When you run your application, you will also need to add the \c oci.lib
+ When you run your application, you will also need to add the \c oci.dll
path to your \c PATH environment variable:
\snippet code/doc_src_sql-driver.qdoc 9
@@ -313,15 +404,20 @@
of the ODBC driver. ODBC support can be used as a fallback for compliant
databases if no native driver is available.
- On Windows, an ODBC driver manager should be installed by default.
+ On Windows, an ODBC driver manager is installed by default.
For Unix systems, there are some implementations which must be
installed first. Note that every end user of your application is
required to have an ODBC driver manager installed, otherwise the
QODBC plugin will not work.
When connecting to an ODBC datasource, you should pass the name
- of the ODBC datasource to the QSqlDatabase::setDatabaseName()
+ of the ODBC datasource (DSN) to the QSqlDatabase::setDatabaseName()
function, rather than the actual database name.
+ It's also possible to pass a FILEDSN (*.dsn) filename or a complete
+ ODBC driver string. When passing a driver string you must make sure,
+ that all parameters (username, password, ...) are properly escaped.
+ Passing the username or password through the QSqlDatabase functions,
+ the escaping is done by the QODBC plugin.
The QODBC Plugin needs an ODBC compliant driver manager version 2.0 or
later. Some ODBC drivers claim to be version-2.0-compliant,
@@ -345,17 +441,11 @@
e.g., the SQLSTATEs. Before setting this connect option, consult
your ODBC documentation about behavior differences you can expect.
- When using the SAP HANA database, the connection has to be
- established using the option "SCROLLABLERESULT=TRUE", as the
- HANA ODBC driver does not provide scrollable results by default, e.g.:
-
- \snippet code/doc_src_sql-driver.cpp 39
-
If you experience very slow access of the ODBC datasource, make sure
that ODBC call tracing is turned off in the ODBC datasource manager.
Some drivers do not support scrollable cursors. In that case, only
- queries in forwardOnly mode can be used successfully.
+ queries in \l QSqlQuery::setForwardOnly() mode can be used successfully.
\section3 ODBC Stored Procedure Support
@@ -372,12 +462,62 @@
\section3 ODBC Unicode Support
The QODBC Plugin will use the Unicode API if UNICODE is defined. On
- Windows NT based systems, this is the default. Note that the ODBC
+ Windows based systems, this is the default. Note that the ODBC
driver and the DBMS must also support Unicode.
For the Oracle 9 ODBC driver (Windows), it is necessary to check
"SQL_WCHAR support" in the ODBC driver manager otherwise Oracle
- will convert all Unicode strings to local 8-bit.
+ will convert all Unicode strings to local 8-bit representation.
+
+ \section3 Connection options
+ The Qt ODBC plugin honors the following connection options:
+ \table
+ \header \li Attribute \li Possible value
+ \row
+ \li SQL_ATTR_ACCESS_MODE
+ \li SQL_MODE_READ_ONLY: open the database in read-only mode\br
+ SQL_MODE_READ_WRITE: open the database in read-write mode (default)
+ \row
+ \li SQL_ATTR_LOGIN_TIMEOUT
+ \li Number of seconds to wait for the database connection
+ during login (a value of 0 will wait forever)
+ \row
+ \li SQL_ATTR_CONNECTION_TIMEOUT
+ \li Number of seconds to wait for any request to the database
+ (a value of 0 will wait forever)
+ \row
+ \li SQL_ATTR_CURRENT_CATALOG
+ \li The catalog (database) to use for this connection
+ \row
+ \li SQL_ATTR_METADATA_ID
+ \li SQL_TRUE: the string argument of catalog functions are treated
+ as identifiers\br
+ SQL_FALSE: the string arguments of catalog functions are not
+ treated as identifiers
+ \row
+ \li SQL_ATTR_PACKET_SIZE
+ \li Specifies the network packet size in bytes
+ \row
+ \li SQL_ATTR_TRACEFILE
+ \li A string containing the name of the trace file
+ \row
+ \li SQL_ATTR_TRACE
+ \li SQL_OPT_TRACE_ON: Enable database query tracing\br
+ SQL_OPT_TRACE_OFF: Disable database query tracing (default)
+ \row
+ \li SQL_ATTR_CONNECTION_POOLING
+ \li Enable or disable connection pooling at the environment level.\br
+ SQL_CP_DEFAULT, SQL_CP_OFF: Connection pooling is turned off (default)\br
+ SQL_CP_ONE_PER_DRIVER: A single connection pool is supported for each driver\br
+ SQL_CP_ONE_PER_HENV: A single connection pool is supported for each environment
+ \row
+ \li SQL_ATTR_ODBC_VERSION
+ \li SQL_OV_ODBC3: The driver should act as a ODBC 3.x driver\br
+ SQL_OV_ODBC2: The driver should act as a ODBC 2.x driver (default)
+ \endtable
+ For more detailed information about the connect options please refer
+ to the \l {https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlsetconnectattr-function}
+ {SQLSetConnectAttr()} ODBC documentation.
\section3 How to Build the ODBC Plugin on Unix and \macos
@@ -399,7 +539,7 @@
\snippet code/doc_src_sql-driver.qdoc 12
\target QPSQL
- \section2 QPSQL for PostgreSQL (Version 7.3 and Above)
+ \section2 QPSQL for PostgreSQL (Version 7.3 and above)
The QPSQL driver supports version 7.3 and higher of the PostgreSQL server.
@@ -468,7 +608,7 @@
database connections, or if we execute query2 after the while loop.
\note Some methods of QSqlDatabase like tables(), primaryIndex()
- implicity execute SQL queries, so these also cannot be used while
+ implicitly execute SQL queries, so these also cannot be used while
navigating the results of forward-only query.
\note QPSQL will print the following warning if it detects a loss of
@@ -476,6 +616,11 @@
\snippet code/doc_src_sql-driver.qdoc 38
+ \section3 Connection options
+ The Qt PostgreSQL plugin honors all connection options specified in the
+ \l {https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS}
+ {connect()} PostgreSQL documentation.
+
\section3 How to Build the QPSQL Plugin on Unix and \macos
You need the PostgreSQL client library and headers installed.
@@ -502,7 +647,7 @@
as the application executable.
\target QDB2
- \section2 QDB2 for IBM DB2 (Version 7.1 and Above)
+ \section2 QDB2 for IBM DB2 (Version 7.1 and above)
The Qt DB2 plugin makes it possible to access IBM DB2 databases. It
has been tested with IBM DB2 v7.1 and 7.2. You must install the IBM
@@ -515,6 +660,20 @@
We suggest using a forward-only query when calling stored procedures
in DB2 (see QSqlQuery::setForwardOnly()).
+ \section3 Connection options
+ The Qt IBM DB2 plugin honors the following connection options:
+ \table
+ \header \li Attribute \li Possible value
+ \row
+ \li SQL_ATTR_ACCESS_MODE
+ \li SQL_MODE_READ_ONLY: open the database in read-only mode\br
+ SQL_MODE_READ_WRITE: open the database in read-write mode (default)
+ \row
+ \li SQL_ATTR_LOGIN_TIMEOUT
+ \li Number of seconds to wait for the database connection
+ during login (max: 32767, a value of 0 will wait forever)
+ \endtable
+
\section3 How to Build the QDB2 Plugin on Unix and \macos
\snippet code/doc_src_sql-driver.qdoc 18
@@ -527,7 +686,7 @@
\snippet code/doc_src_sql-driver.qdoc 20
\target QSQLITE
- \section2 QSQLITE for SQLite (Version 3 and Above)
+ \section2 QSQLITE for SQLite (Version 3 and above)
The Qt SQLite plugin makes it possible to access SQLite
databases. SQLite is an in-process database, which means that it
@@ -560,6 +719,58 @@
You can find information about SQLite on \l{http://www.sqlite.org}.
+ \section3 Connection options
+ The Qt SQLite plugin honors the following connection options:
+ \table
+ \header \li Attribute \li Possible value
+ \row
+ \li QSQLITE_BUSY_TIMEOUT
+ \li Busy handler timeout in milliseconds (val <= 0: disabled),
+ see \l {https://www.sqlite.org/c3ref/busy_timeout.html}
+ {SQLite documentation} for more information
+
+ \row
+ \li QSQLITE_USE_QT_VFS
+ \li If set, the database is opened using Qt's VFS which allows to
+ open databases using QFile. This way it can open databases from
+ any read-write locations (e.g.android shared storage) but also
+ from read-only resources (e.g. qrc or android assets). Be aware
+ that when opening databases from read-only resources make sure
+ you add QSQLITE_OPEN_READONLY attribute as well.
+ Otherwise it will fail to open it.
+
+ \row
+ \li QSQLITE_OPEN_READONLY
+ \li If set, the database is open in read-only mode which will fail
+ if no database exists. Otherwise the database will be opened in
+ read-write mode and created if the database file does not yet
+ exist (default)
+ \row
+ \li QSQLITE_OPEN_URI
+ \li The given filename is interpreted as an uri, see
+ \l {https://www.sqlite.org/c3ref/open.html} {SQLITE_OPEN_URI}
+ \row
+ \li QSQLITE_ENABLE_SHARED_CACHE
+ \li If set, the database is opened in
+ \l {https://www.sqlite.org/sharedcache.html} {shared cache mode},
+ otherwise in private cache mode
+ \row
+ \li QSQLITE_ENABLE_REGEXP
+ \li If set, the plugin defines a function 'regex' which can be used
+ in queries, QRegularExpression is used for evaluation of the regex query
+ \row
+ \li QSQLITE_NO_USE_EXTENDED_RESULT_CODES
+ \li Disables the usage of the \l {https://www.sqlite.org/c3ref/extended_result_codes.html}
+ {extended result code} feature in SQLite
+ \row
+ \li QSQLITE_ENABLE_NON_ASCII_CASE_FOLDING
+ \li If set, the plugin replaces the functions 'lower' and 'upper' with
+ QString functions for correct case folding of non-ascii characters
+ \row
+ \li QSQLITE_OPEN_NOFOLLOW
+ \li If set, the database filename is not allowed to contain a symbolic link
+ \endtable
+
\section3 How to Build the QSQLITE Plugin
SQLite version 3 is included as a third-party library within Qt.
@@ -615,6 +826,47 @@
Some versions of SQLite can be forced to write a specific file format by setting
the \c{SQLITE_DEFAULT_FILE_FORMAT} define when building SQLite.
+ \target QMIMER
+ \section2 QMIMER for Mimer SQL version 11 and higher
+
+ The Qt Mimer SQL plugin makes it possible to work with the Mimer SQL RDBMS.
+ Mimer SQL provides small footprint, scalable and robust relational database
+ solutions that conform to international ISO SQL standards. Mimer SQL is available
+ on Windows, Linux, \macos, and OpenVMS as well as several embedded platforms like QNX, Android,
+ and embedded Linux.
+
+ Mimer SQL fully support Unicode. To work with Unicode data the column types National Character (NCHAR),
+ National Character Varying (NVARCHAR), or National Character Large Object (NCLOB) must be used.
+ For more information about Mimer SQL and unicode, see \l{https://developer.mimer.com/features/multilingual-support}
+
+ \section3 QMIMER Stored Procedure Support
+
+ Mimer SQL have stored procedures according to the SQL standard (PSM) and
+ the plugin fully support IN, OUT, INOUT parameters as well as resultset procedures.
+
+ Example stored procedure with INOUT and OUT parameters:
+
+ \snippet code/doc_src_sql-driver.qdoc 44
+
+ Source code to access the INOUT and OUT values:
+
+ \snippet code/doc_src_sql-driver.cpp 40
+
+ \section3 How to Build the QMIMER Plugin on Unix and \macos
+
+ You need the Mimer SQL header files and shared libraries. Get them by installing
+ any of the Mimer SQL variants found at \l{https://developer.mimer.com}.
+
+
+ \snippet code/doc_src_sql-driver.qdoc 31
+
+ \section3 How to Build the QMIMER Plugin on Windows
+
+ You need the Mimer SQL header files and shared libraries. Get them by installing
+ any of the Mimer SQL variants found at \l{https://developer.mimer.com}.
+
+ \snippet code/doc_src_sql-driver.qdoc 32
+
\target QIBASE
\section2 QIBASE for Borland InterBase
@@ -628,6 +880,17 @@
database file, no matter whether it is stored locally or on another
server.
+ \section3 Connection options
+ The Qt Borland InterBase plugin honors the following connection options:
+ \table
+ \header \li Attribute \li Possible value
+ \row
+ \li ISC_DPB_SQL_ROLE_NAME
+ \li Specifies the login role name
+ \endtable
+
+
+ \section3 How to Build the QIBASE Plugin
\snippet code/doc_src_sql-driver.cpp 24
You need the InterBase/Firebird development headers and libraries
@@ -637,20 +900,6 @@
Edition are not allowed to link this plugin to the commercial editions of
InterBase. Please use Firebird or the free edition of InterBase.
- \section3 QIBASE Unicode Support and Text Encoding
-
- By default the driver connects to the database using UNICODE_FSS. This can
- be overridden by setting the ISC_DPB_LC_CTYPE parameter with
- QSqlDatabase::setConnectOptions() before opening the connection.
-
- \snippet code/doc_src_sql-driver.cpp 25
-
- If Qt does not support the given text encoding the driver will issue a
- warning message and connect to the database using UNICODE_FSS.
-
- Note that if the text encoding set when connecting to the database is
- not the same as in the database, problems with transliteration might arise.
-
\section3 QIBASE Stored procedures
InterBase/Firebird return OUT values as result set, so when calling stored
@@ -692,7 +941,7 @@
You should always use client libraries that have been compiled with
the same compiler as you are using for your project. If you cannot get
- a source distibution to compile the client libraries yourself, you
+ a source distribution to compile the client libraries yourself, you
must make sure that the pre-compiled library is compatible with
your compiler, otherwise you will get a lot of "undefined symbols"
errors. Some compilers have tools to convert libraries, e.g. Borland
@@ -713,7 +962,7 @@
Qt Creator, you can update the \c PATH environment variable in the
\gui Run section of the \gui Project panel to include the path to
the folder containing the client libraries.
- \li Compile Qt with \c{QT_DEBUG_COMPONENT} defined to get very verbose
+ \li Compile Qt with \c{QT_DEBUG_PLUGINS} defined to get very verbose
debug output when loading plugins.
\endlist
diff --git a/src/sql/doc/src/sql-programming.qdoc b/src/sql/doc/src/sql-programming.qdoc
index 56bb48b27b..a7f87fe73f 100644
--- a/src/sql/doc/src/sql-programming.qdoc
+++ b/src/sql/doc/src/sql-programming.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\group database
@@ -520,11 +496,11 @@
submitted.
The items in the view are rendered using a delegate. The default
- delegate, QItemDelegate, handles the most common data types (\c
+ delegate, QStyledItemDelegate, handles the most common data types (\c
int, QString, QImage, etc.). The delegate is also responsible for
providing editor widgets (e.g., a combobox) when the user starts
editing an item in the view. You can create your own delegates by
- subclassing QAbstractItemDelegate or QItemDelegate. See
+ subclassing QAbstractItemDelegate or QStyledItemDelegate. See
\l{Model/View Programming} for more information.
QSqlTableModel is optimized to operate on a single table at a