summaryrefslogtreecommitdiffstats
path: root/src/sql/doc
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql/doc')
-rw-r--r--src/sql/doc/qtsql.qdocconf7
-rw-r--r--src/sql/doc/snippets/CMakeLists.txt2
-rw-r--r--src/sql/doc/snippets/code/CMakeLists.txt2
-rw-r--r--src/sql/doc/snippets/code/doc_src_sql-driver.cpp32
-rw-r--r--src/sql/doc/snippets/code/doc_src_sql-driver.qdoc60
-rw-r--r--src/sql/doc/snippets/code/src_sql_kernel_qsqlquery.cpp2
-rw-r--r--src/sql/doc/snippets/sqldatabase/CMakeLists.txt2
-rw-r--r--src/sql/doc/snippets/sqldatabase/sqldatabase.cpp6
-rw-r--r--src/sql/doc/snippets/sqldatabase/sqldatabase_snippet.cpp256
-rw-r--r--src/sql/doc/src/qsqldatatype-table.qdoc155
-rw-r--r--src/sql/doc/src/qt6-changes.qdoc2
-rw-r--r--src/sql/doc/src/sql-driver.qdoc339
-rw-r--r--src/sql/doc/src/sql-programming.qdoc4
13 files changed, 523 insertions, 346 deletions
diff --git a/src/sql/doc/qtsql.qdocconf b/src/sql/doc/qtsql.qdocconf
index 877411d326..9f6e1a31e0 100644
--- a/src/sql/doc/qtsql.qdocconf
+++ b/src/sql/doc/qtsql.qdocconf
@@ -40,5 +40,10 @@ imagedirs += images \
navigation.landingpage = "Qt SQL"
navigation.cppclassespage = "Qt SQL C++ Classes"
-# Fail the documentation build if there are more warnings than the limit
+# 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 780ee9261d..a5c34d5688 100644
--- a/src/sql/doc/snippets/CMakeLists.txt
+++ b/src/sql/doc/snippets/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#! [cmake_use]
find_package(Qt6 REQUIRED COMPONENTS Sql)
diff --git a/src/sql/doc/snippets/code/CMakeLists.txt b/src/sql/doc/snippets/code/CMakeLists.txt
index 54ced0e56d..b6899137fe 100644
--- a/src/sql/doc/snippets/code/CMakeLists.txt
+++ b/src/sql/doc/snippets/code/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
add_library(code_snippets OBJECT
doc_src_sql-driver.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 57de1fb5c1..efcb45c98e 100644
--- a/src/sql/doc/snippets/code/doc_src_sql-driver.cpp
+++ b/src/sql/doc/snippets/code/doc_src_sql-driver.cpp
@@ -35,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()
@@ -55,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
@@ -88,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 950ea87c37..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,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
//! [0]
[...]
@@ -27,8 +27,7 @@ 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 -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]
@@ -37,7 +36,6 @@ cmake --install .
//! [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"
cmake --build .
cmake --install .
@@ -47,8 +45,7 @@ cmake --install .
//! [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 -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]
@@ -71,8 +68,7 @@ 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 -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]
@@ -81,7 +77,6 @@ cmake --install .
//! [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>
cmake --build .
cmake --install .
@@ -92,7 +87,7 @@ 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 -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]
@@ -101,7 +96,6 @@ cmake --install .
//! [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"
cmake --build .
cmake --install .
@@ -111,8 +105,7 @@ cmake --install .
//! [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 -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]
@@ -121,7 +114,6 @@ cmake --install .
//! [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"
cmake --build .
cmake --install .
@@ -131,8 +123,7 @@ cmake --install .
//! [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 -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]
@@ -141,7 +132,6 @@ cmake --install .
//! [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"
cmake --build .
cmake --install .
@@ -151,8 +141,7 @@ cmake --install .
//! [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 -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]
@@ -161,8 +150,7 @@ cmake --install .
//! [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 -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]
@@ -171,7 +159,6 @@ cmake --install .
//! [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"
cmake --build .
cmake --install .
@@ -181,12 +168,28 @@ cmake --install .
//! [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"
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
@@ -219,6 +222,7 @@ Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
+ Mimer SQL .............................. yes
MySql .................................. yes
OCI (Oracle) ........................... no
ODBC ................................... yes
@@ -239,6 +243,7 @@ Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
+ Mimer SQL .............................. yes
MySql .................................. yes
OCI (Oracle) ........................... no
ODBC ................................... yes
@@ -256,6 +261,7 @@ Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
+ Mimer SQL .............................. yes
MySql .................................. yes
OCI (Oracle) ........................... no
ODBC ................................... yes
@@ -264,3 +270,11 @@ Qt Sql Drivers:
Using system provided SQLite ......... no
...
//! [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/src_sql_kernel_qsqlquery.cpp b/src/sql/doc/snippets/code/src_sql_kernel_qsqlquery.cpp
index af289543c1..b62d5065ce 100644
--- a/src/sql/doc/snippets/code/src_sql_kernel_qsqlquery.cpp
+++ b/src/sql/doc/snippets/code/src_sql_kernel_qsqlquery.cpp
@@ -26,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/sqldatabase/CMakeLists.txt b/src/sql/doc/snippets/sqldatabase/CMakeLists.txt
index 2028cdac1d..5179c694d0 100644
--- a/src/sql/doc/snippets/sqldatabase/CMakeLists.txt
+++ b/src/sql/doc/snippets/sqldatabase/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
+# 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 933124e74d..5702116365 100644
--- a/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp
+++ b/src/sql/doc/snippets/sqldatabase/sqldatabase.cpp
@@ -156,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 e81436a247..48382bfee9 100644
--- a/src/sql/doc/snippets/sqldatabase/sqldatabase_snippet.cpp
+++ b/src/sql/doc/snippets/sqldatabase/sqldatabase_snippet.cpp
@@ -17,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);
}
@@ -47,7 +43,6 @@ public:
int m_specialColumnNo;
};
-//! [23]
QVariant MyModel::data(const QModelIndex &item, int role) const
{
if (item.column() == m_specialColumnNo) {
@@ -55,7 +50,6 @@ QVariant MyModel::data(const QModelIndex &item, int role) const
}
return QSqlQueryModel::data(item, role);
}
-//! [23]
void QSqlTableModel_snippets()
{
@@ -72,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/qsqldatatype-table.qdoc b/src/sql/doc/src/qsqldatatype-table.qdoc
index 58a27a05a4..77aa56d21a 100644
--- a/src/sql/doc/src/qsqldatatype-table.qdoc
+++ b/src/sql/doc/src/qsqldatatype-table.qdoc
@@ -269,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
@@ -478,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 a0ba654a38..28c4664fdd 100644
--- a/src/sql/doc/src/qt6-changes.qdoc
+++ b/src/sql/doc/src/qt6-changes.qdoc
@@ -5,7 +5,7 @@
\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/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc
index 869c4b00a2..4cc5b0d050 100644
--- a/src/sql/doc/src/sql-driver.qdoc
+++ b/src/sql/doc/src/sql-driver.qdoc
@@ -23,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}
@@ -30,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
@@ -125,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().
@@ -154,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
@@ -170,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).
@@ -236,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
@@ -270,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
@@ -289,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,
@@ -321,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
@@ -348,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
@@ -375,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.
@@ -452,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.
@@ -478,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
@@ -491,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
@@ -503,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
@@ -536,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.
@@ -591,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
@@ -604,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
@@ -613,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
@@ -689,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 3dfd005516..a7f87fe73f 100644
--- a/src/sql/doc/src/sql-programming.qdoc
+++ b/src/sql/doc/src/sql-programming.qdoc
@@ -496,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