Doc: Fix most qdoc errors in QtSql.
- Move 2 images from qtdoc. - Add "make docs" command for qtsql - Fix qdoc command usage errors. Change-Id: Id2f0548d09ed8f77b2317863d443c19d1cccdd83 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
3
src/sql/doc/doc.pri
Normal file
@ -0,0 +1,3 @@
|
||||
qtPrepareTool(QDOC, qdoc)
|
||||
docs.commands += $$QDOC $$QT.sql.sources/doc/qtsql.qdocconf
|
||||
QMAKE_EXTRA_TARGETS += docs
|
BIN
src/sql/doc/images/foreignkeys.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
BIN
src/sql/doc/images/noforeignkeys.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
92
src/sql/doc/qtsql.qdocconf
Normal file
@ -0,0 +1,92 @@
|
||||
include(../../../doc/global/qt-cpp-ignore.qdocconf)
|
||||
|
||||
project = QtSql
|
||||
description = Qt SQL Reference Documentation
|
||||
url = http://qt-project.org/doc/qt-5.0/qtsql
|
||||
version = 5.0.0
|
||||
|
||||
sourceencoding = UTF-8
|
||||
outputencoding = UTF-8
|
||||
naturallanguage = en_US
|
||||
qhp.projects = QtSql
|
||||
|
||||
qhp.QtCore.file = qtsql.qhp
|
||||
qhp.Qt.namespace = org.qt-project.qtsql.500
|
||||
qhp.Qt.virtualFolder = qdoc
|
||||
qhp.Qt.indexTitle = Qt SQL Reference Documentation
|
||||
qhp.Qt.indexRoot =
|
||||
|
||||
qhp.Qt.filterAttributes = qtsql 5.0.0 qtrefdoc
|
||||
qhp.Qt.customFilters.Qt.name = QtSql 5.0.0
|
||||
qhp.Qt.customFilters.Qt.filterAttributes = qtsql 5.0.0
|
||||
qhp.Qt.subprojects = classes overviews examples
|
||||
qhp.Qt.subprojects.classes.title = Classes
|
||||
qhp.Qt.subprojects.classes.indexTitle = Qt SQL's Classes
|
||||
qhp.Qt.subprojects.classes.selectors = class fake:headerfile
|
||||
qhp.Qt.subprojects.classes.sortPages = true
|
||||
qhp.Qt.subprojects.overviews.title = Overviews
|
||||
qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs
|
||||
qhp.Qt.subprojects.overviews.selectors = fake:page,group,module
|
||||
qhp.Qt.subprojects.examples.title = Qt Core Tutorials and Examples
|
||||
qhp.Qt.subprojects.examples.indexTitle = Qt Core Examples
|
||||
qhp.Qt.subprojects.examples.selectors = fake:example
|
||||
|
||||
dita.metadata.default.author = Qt Project
|
||||
dita.metadata.default.permissions = all
|
||||
dita.metadata.default.publisher = Qt Project
|
||||
dita.metadata.default.copyryear = 2012
|
||||
dita.metadata.default.copyrholder = Nokia
|
||||
dita.metadata.default.audience = programmer
|
||||
|
||||
sources.fileextensions = "*.c++ *.cc *.cpp *.cxx *.mm *.qml *.qdoc"
|
||||
headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx"
|
||||
|
||||
examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml *.css"
|
||||
examples.imageextensions = "*.png"
|
||||
|
||||
outputdir = ../../../doc/qtsql
|
||||
tagfile = ../../../doc/qtsql/qtsql.tags
|
||||
|
||||
HTML.generatemacrefs = "true"
|
||||
HTML.nobreadcrumbs = "true"
|
||||
|
||||
HTML.templatedir = .
|
||||
|
||||
HTML.stylesheets = ../../../doc/global/style/offline.css
|
||||
|
||||
HTML.headerstyles = \
|
||||
" <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n"
|
||||
|
||||
HTML.endheader = \
|
||||
"</head>\n" \
|
||||
|
||||
defines = Q_QDOC \
|
||||
QT_.*_SUPPORT \
|
||||
QT_.*_LIB \
|
||||
QT_COMPAT \
|
||||
QT_KEYPAD_NAVIGATION \
|
||||
QT_NO_EGL \
|
||||
Q_WS_.* \
|
||||
Q_OS_.* \
|
||||
Q_BYTE_ORDER \
|
||||
QT_DEPRECATED \
|
||||
QT_DEPRECATED_* \
|
||||
Q_NO_USING_KEYWORD \
|
||||
__cplusplus \
|
||||
Q_COMPILER_INITIALIZER_LISTS
|
||||
|
||||
versionsym = QT_VERSION_STR
|
||||
|
||||
codeindent = 1
|
||||
|
||||
depends += qtcore
|
||||
|
||||
headerdirs += ..
|
||||
|
||||
sourcedirs += ..
|
||||
|
||||
exampledirs += ../../../examples \
|
||||
../ \
|
||||
snippets
|
||||
|
||||
imagedirs += images
|
@ -33,12 +33,12 @@
|
||||
To include the definitions of the module's classes, use the
|
||||
following directive:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qtsql.cpp 0
|
||||
\snippet code/doc_src_qtsql.cpp 0
|
||||
|
||||
To link against the module, add this line to your \l qmake \c
|
||||
.pro file:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_qtsql.pro 1
|
||||
\snippet code/doc_src_qtsql.pro 1
|
||||
|
||||
See the \l{SQL Programming} guide for information about using this
|
||||
module in your applications.
|
@ -84,7 +84,7 @@
|
||||
machine. Run \c{configure -help} to see what drivers can be
|
||||
built. You should get an output similar to this:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 0
|
||||
\snippet code/doc_src_sql-driver.qdoc 0
|
||||
|
||||
The \c configure script cannot detect the necessary libraries
|
||||
and include files if they are not in the standard paths, so it
|
||||
@ -117,11 +117,11 @@
|
||||
|
||||
Example stored procedure:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 1
|
||||
\snippet code/doc_src_sql-driver.qdoc 1
|
||||
|
||||
Source code to access the OUT values:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.cpp 2
|
||||
\snippet code/doc_src_sql-driver.cpp 2
|
||||
|
||||
\b{Note:} \c{@outval1} and \c{@outval2} are variables local to the current
|
||||
connection and will not be affected by queries sent from another host
|
||||
@ -151,13 +151,13 @@
|
||||
libraries (here it is assumed that MySQL is installed in
|
||||
\c{/usr/local}) and run \c{make}:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 3
|
||||
\snippet code/doc_src_sql-driver.qdoc 3
|
||||
|
||||
After installing Qt, as described in the \l{Installing Qt for X11
|
||||
Platforms} document, you also need to install the plugin in the
|
||||
standard location:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 4
|
||||
\snippet code/doc_src_sql-driver.qdoc 4
|
||||
|
||||
\section3 How to Build the QMYSQL Plugin on Windows
|
||||
|
||||
@ -166,7 +166,7 @@
|
||||
Build the plugin as follows (here it is assumed that MySQL is
|
||||
installed in \c{C:\MySQL}):
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 5
|
||||
\snippet code/doc_src_sql-driver.qdoc 5
|
||||
|
||||
If you are not using a Microsoft compiler, replace \c nmake with \c
|
||||
make in the line above.
|
||||
@ -295,21 +295,21 @@
|
||||
libraries and run make:
|
||||
|
||||
For Oracle version 9:
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 6
|
||||
\snippet code/doc_src_sql-driver.qdoc 6
|
||||
|
||||
For Oracle version 10, we assume that you installed the RPM packages of the
|
||||
Instant Client Package SDK (you need to adjust the version number accordingly):
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 7
|
||||
\snippet code/doc_src_sql-driver.qdoc 7
|
||||
|
||||
\b{Note:} If you are using the Oracle Instant Client package,
|
||||
you will need to set LD_LIBRARY_PATH when building the OCI SQL plugin
|
||||
and when running an application that uses the OCI SQL plugin. You can
|
||||
avoid this requirement by setting and RPATH and listing all of the
|
||||
libraries to link to. Here is an example:
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 32
|
||||
\snippet code/doc_src_sql-driver.qdoc 32
|
||||
|
||||
If you wish to build the OCI plugin manually with this method the procedure looks like this:
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 33
|
||||
\snippet code/doc_src_sql-driver.qdoc 33
|
||||
|
||||
\section3 How to Build the OCI Plugin on Windows
|
||||
|
||||
@ -321,7 +321,7 @@
|
||||
Build the plugin as follows (here it is assumed that Oracle Client is
|
||||
installed in \c{C:\oracle}):
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 8
|
||||
\snippet code/doc_src_sql-driver.qdoc 8
|
||||
|
||||
If you are not using a Microsoft compiler, replace \c nmake with \c
|
||||
make in the line above.
|
||||
@ -329,7 +329,7 @@
|
||||
When you run your application you will also need to add the \c oci.dll
|
||||
path to your \c PATH environment variable:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 9
|
||||
\snippet code/doc_src_sql-driver.qdoc 9
|
||||
|
||||
\b{Note:} This database plugin is not supported for Windows CE.
|
||||
|
||||
@ -394,7 +394,7 @@
|
||||
sets, will be accessible only if you set the query's forward only
|
||||
mode to \e forward using \l QSqlQuery::setForwardOnly().
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.cpp 10
|
||||
\snippet code/doc_src_sql-driver.cpp 10
|
||||
|
||||
\b{Note:} The value returned by the stored procedure's return statement
|
||||
is discarded.
|
||||
@ -423,14 +423,14 @@
|
||||
libraries (here it is assumed that unixODBC is installed in
|
||||
\c{/usr/local/unixODBC}) and run \c{make}:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 11
|
||||
\snippet code/doc_src_sql-driver.qdoc 11
|
||||
|
||||
\section3 How to Build the ODBC Plugin on Windows
|
||||
|
||||
The ODBC header and include files should already be installed in the
|
||||
right directories. You just have to build the plugin as follows:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 12
|
||||
\snippet code/doc_src_sql-driver.qdoc 12
|
||||
|
||||
If you are not using a Microsoft compiler, replace \c nmake with \c
|
||||
make in the line above.
|
||||
@ -478,12 +478,12 @@
|
||||
libraries, run \c qmake the following way (assuming that the
|
||||
PostgreSQL client is installed in \c{/usr}):
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 13
|
||||
\snippet code/doc_src_sql-driver.qdoc 13
|
||||
|
||||
After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document,
|
||||
you also need to install the plugin in the standard location:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 14
|
||||
\snippet code/doc_src_sql-driver.qdoc 14
|
||||
|
||||
\section3 How to Build the QPSQL Plugin on Windows
|
||||
|
||||
@ -491,7 +491,7 @@
|
||||
compiler. Assuming that PostgreSQL was installed in \c{C:\psql},
|
||||
build the plugin as follows:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 15
|
||||
\snippet code/doc_src_sql-driver.qdoc 15
|
||||
|
||||
Users of MinGW may wish to consult the following online document:
|
||||
\l{PostgreSQL MinGW/Native Windows}.
|
||||
@ -529,7 +529,7 @@
|
||||
point to the directory where you installed the client library and
|
||||
execute \c{qmake}:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 16
|
||||
\snippet code/doc_src_sql-driver.qdoc 16
|
||||
|
||||
\section3 How to Build the QDTS Plugin on Windows
|
||||
|
||||
@ -537,7 +537,7 @@
|
||||
Open Client (\l{http://www.sybase.com}). You must include \c
|
||||
NTWDBLIB.LIB to build the plugin:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 17
|
||||
\snippet code/doc_src_sql-driver.qdoc 17
|
||||
|
||||
By default the Microsoft library is used on Windows, if you want to
|
||||
force the use of the Sybase Open Client, you must define \c
|
||||
@ -565,19 +565,19 @@
|
||||
|
||||
\section3 How to Build the QDB2 Plugin on Unix and Mac OS X
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 18
|
||||
\snippet code/doc_src_sql-driver.qdoc 18
|
||||
|
||||
After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document,
|
||||
you also need to install the plugin in the standard location:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 19
|
||||
\snippet code/doc_src_sql-driver.qdoc 19
|
||||
|
||||
\section3 How to Build the QDB2 Plugin on Windows
|
||||
|
||||
The DB2 header and include files should already be installed in the
|
||||
right directories. You just have to build the plugin as follows:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 20
|
||||
\snippet code/doc_src_sql-driver.qdoc 20
|
||||
|
||||
If you are not using a Microsoft compiler, replace \c nmake
|
||||
with \c make in the line above.
|
||||
@ -640,16 +640,16 @@
|
||||
it manually (replace \c $SQLITE with the directory where
|
||||
SQLite resides):
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 21
|
||||
\snippet code/doc_src_sql-driver.qdoc 21
|
||||
|
||||
After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document,
|
||||
you also need to install the plugin in the standard location:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 22
|
||||
\snippet code/doc_src_sql-driver.qdoc 22
|
||||
|
||||
On Windows:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 23
|
||||
\snippet code/doc_src_sql-driver.qdoc 23
|
||||
|
||||
\section3 QSQLITE File Format Compatibility
|
||||
|
||||
@ -683,7 +683,7 @@
|
||||
database file, no matter whether it is stored locally or on another
|
||||
server.
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.cpp 24
|
||||
\snippet code/doc_src_sql-driver.cpp 24
|
||||
|
||||
You need the InterBase/Firebird development headers and libraries
|
||||
to build this plugin.
|
||||
@ -698,7 +698,7 @@
|
||||
be overridden by setting the ISC_DPB_LC_CTYPE parameter with
|
||||
QSqlDatabase::setConnectOptions() before opening the connection.
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.cpp 25
|
||||
\snippet code/doc_src_sql-driver.cpp 25
|
||||
|
||||
If Qt doesn't support the given text encoding the driver will issue a
|
||||
warning message and connect to the database using UNICODE_FSS.
|
||||
@ -712,7 +712,7 @@
|
||||
procedure, only IN values need to be bound via QSqlQuery::bindValue(). The
|
||||
RETURN/OUT values can be retrieved via QSqlQuery::value(). Example:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.cpp 26
|
||||
\snippet code/doc_src_sql-driver.cpp 26
|
||||
|
||||
\section3 How to Build the QIBASE Plugin on Unix and Mac OS X
|
||||
|
||||
@ -721,11 +721,11 @@
|
||||
|
||||
If you are using InterBase:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 27
|
||||
\snippet code/doc_src_sql-driver.qdoc 27
|
||||
|
||||
If you are using Firebird, the Firebird library has to be set explicitly:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 28
|
||||
\snippet code/doc_src_sql-driver.qdoc 28
|
||||
|
||||
\section3 How to Build the QIBASE Plugin on Windows
|
||||
|
||||
@ -734,11 +734,11 @@
|
||||
|
||||
If you are using InterBase:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 29
|
||||
\snippet code/doc_src_sql-driver.qdoc 29
|
||||
|
||||
If you are using Firebird, the Firebird library has to be set explicitly:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 30
|
||||
\snippet code/doc_src_sql-driver.qdoc 30
|
||||
|
||||
If you are not using a Microsoft compiler, replace \c nmake
|
||||
with \c make in the line above.
|
||||
@ -779,7 +779,7 @@
|
||||
Make sure you have followed the guide to \l{Deploying Plugins}.
|
||||
If you experience plugin load problems and see output like this:
|
||||
|
||||
\snippet doc/src/snippets/code/doc_src_sql-driver.cpp 31
|
||||
\snippet code/doc_src_sql-driver.cpp 31
|
||||
|
||||
the problem is usually that the plugin had the wrong \l{Deploying
|
||||
Plugins#The Build Key}{build key}. This might require removing an
|
||||
@ -824,7 +824,7 @@
|
||||
|
||||
The following code can be used as a skeleton for a SQL driver:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 47
|
||||
\snippet sqldatabase/sqldatabase.cpp 47
|
||||
\codeline
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 48
|
||||
\snippet sqldatabase/sqldatabase.cpp 48
|
||||
*/
|
@ -129,7 +129,7 @@
|
||||
following snippet shows how to create a \e{default} connection
|
||||
and then open it:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 26
|
||||
\snippet sqldatabase/sqldatabase.cpp 26
|
||||
|
||||
The first line creates the connection object, and the last line
|
||||
opens it for use. In between, we initialize some connection
|
||||
@ -150,7 +150,7 @@
|
||||
connection name. For example, here we establish two MySQL database
|
||||
connections named \c{"first"} and \c{"second"}:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 27
|
||||
\snippet sqldatabase/sqldatabase.cpp 27
|
||||
|
||||
After these connections have been initialized, \l{QSqlDatabase::}
|
||||
{open()} for each one to establish the live connections. If the
|
||||
@ -163,9 +163,9 @@
|
||||
connection name, it will return the default connection. For
|
||||
example:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 28
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 29
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 30
|
||||
\snippet sqldatabase/sqldatabase.cpp 28
|
||||
\snippet sqldatabase/sqldatabase.cpp 29
|
||||
\snippet sqldatabase/sqldatabase.cpp 30
|
||||
|
||||
To remove a database connection, first close the database using
|
||||
QSqlDatabase::close(), then remove it using the static method
|
||||
@ -195,7 +195,7 @@
|
||||
To execute an SQL statement, simply create a QSqlQuery object and
|
||||
call QSqlQuery::exec() like this:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 31
|
||||
\snippet sqldatabase/sqldatabase.cpp 31
|
||||
|
||||
The QSqlQuery constructor accepts an optional QSqlDatabase object
|
||||
that specifies which database connection to use. In the example
|
||||
@ -215,7 +215,7 @@
|
||||
to access the other records, until it returns false. Here's a
|
||||
typical loop that iterates over all the records in order:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 32
|
||||
\snippet sqldatabase/sqldatabase.cpp 32
|
||||
|
||||
The QSqlQuery::value() function returns the value of a field in
|
||||
the current record. Fields are specified as zero-based indexes.
|
||||
@ -243,7 +243,7 @@
|
||||
navigate to the last record and use the query's position to tell
|
||||
us how many records there are.
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 33
|
||||
\snippet sqldatabase/sqldatabase.cpp 33
|
||||
|
||||
If you iterate through a result set only using next() and seek()
|
||||
with positive values, you can call
|
||||
@ -257,7 +257,7 @@
|
||||
\c{SELECT}s. The following example inserts a record into a table
|
||||
using \c{INSERT}:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 34
|
||||
\snippet sqldatabase/sqldatabase.cpp 34
|
||||
|
||||
If you want to insert many records at the same time, it is often
|
||||
more efficient to separate the query from the actual values being
|
||||
@ -265,11 +265,11 @@
|
||||
placeholder syntaxes: named binding and positional binding.
|
||||
Here's an example of named binding:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 35
|
||||
\snippet sqldatabase/sqldatabase.cpp 35
|
||||
|
||||
Here's an example of positional binding:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 36
|
||||
\snippet sqldatabase/sqldatabase.cpp 36
|
||||
|
||||
Both syntaxes work with all database drivers provided by Qt. If
|
||||
the database supports the syntax natively, Qt simply forwards the
|
||||
@ -289,14 +289,14 @@
|
||||
|
||||
Updating a record is similar to inserting it into a table:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 37
|
||||
\snippet sqldatabase/sqldatabase.cpp 37
|
||||
|
||||
You can also use named or positional binding to associate
|
||||
parameters to actual values.
|
||||
|
||||
Finally, here's an example of a \c DELETE statement:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 38
|
||||
\snippet sqldatabase/sqldatabase.cpp 38
|
||||
|
||||
\section2 Transactions
|
||||
|
||||
@ -311,7 +311,7 @@
|
||||
|
||||
Example:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 39
|
||||
\snippet sqldatabase/sqldatabase.cpp 39
|
||||
|
||||
Transactions can be used to ensure that a complex operation is
|
||||
atomic (for example, looking up a foreign key and creating a
|
||||
@ -364,7 +364,7 @@
|
||||
|
||||
Example:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 40
|
||||
\snippet sqldatabase/sqldatabase.cpp 40
|
||||
|
||||
After setting the query using QSqlQueryModel::setQuery(), you can
|
||||
use QSqlQueryModel::record(int) to access the individual records.
|
||||
@ -383,7 +383,7 @@
|
||||
|
||||
Example:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 41
|
||||
\snippet sqldatabase/sqldatabase.cpp 41
|
||||
|
||||
QSqlTableModel is a high-level alternative to QSqlQuery for
|
||||
navigating and modifying individual SQL tables. It typically
|
||||
@ -394,7 +394,7 @@
|
||||
following code will increase every employee's salary by 10 per
|
||||
cent:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 42
|
||||
\snippet sqldatabase/sqldatabase.cpp 42
|
||||
|
||||
You can also use QSqlTableModel::data() and
|
||||
QSqlTableModel::setData(), which are inherited from
|
||||
@ -402,16 +402,16 @@
|
||||
to update a record using
|
||||
\l{QSqlTableModel::setData()}{setData()}:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 43
|
||||
\snippet sqldatabase/sqldatabase.cpp 43
|
||||
|
||||
Here's how to insert a row and populate it:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 44
|
||||
\snippet sqldatabase/sqldatabase.cpp 44
|
||||
|
||||
Here's how to delete five consecutive rows:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 45
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 46
|
||||
\snippet sqldatabase/sqldatabase.cpp 45
|
||||
\snippet sqldatabase/sqldatabase.cpp 46
|
||||
|
||||
The first argument to QSqlTableModel::removeRows() is the index
|
||||
of the first row to delete.
|
||||
@ -463,10 +463,10 @@
|
||||
The following code snippet shows how the QSqlRelationalTableModel
|
||||
was set up:
|
||||
|
||||
\snippet examples/sql/relationaltablemodel/relationaltablemodel.cpp 0
|
||||
\snippet sql/relationaltablemodel/relationaltablemodel.cpp 0
|
||||
\codeline
|
||||
\snippet examples/sql/relationaltablemodel/relationaltablemodel.cpp 1
|
||||
\snippet examples/sql/relationaltablemodel/relationaltablemodel.cpp 2
|
||||
\snippet sql/relationaltablemodel/relationaltablemodel.cpp 1
|
||||
\snippet sql/relationaltablemodel/relationaltablemodel.cpp 2
|
||||
|
||||
See the QSqlRelationalTableModel documentation for details.
|
||||
*/
|
||||
@ -490,15 +490,15 @@
|
||||
|
||||
The following example creates a view based on an SQL data model:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 17
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 18
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 19
|
||||
\snippet sqldatabase/sqldatabase.cpp 17
|
||||
\snippet sqldatabase/sqldatabase.cpp 18
|
||||
\snippet sqldatabase/sqldatabase.cpp 19
|
||||
|
||||
If the model is a read-write model (e.g., QSqlTableModel), the
|
||||
view lets the user edit the fields. You can disable this by
|
||||
calling
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 20
|
||||
\snippet sqldatabase/sqldatabase.cpp 20
|
||||
|
||||
You can use the same model as a data source for multiple views.
|
||||
If the user edits the model through one of the views, the other
|
||||
@ -511,7 +511,7 @@
|
||||
model. The header's labels default to the table's field names.
|
||||
For example:
|
||||
|
||||
\snippet examples/sql/relationaltablemodel/relationaltablemodel.cpp 3
|
||||
\snippet sql/relationaltablemodel/relationaltablemodel.cpp 3
|
||||
|
||||
QTableView also has a vertical header on the left with numbers
|
||||
identifying the rows. If you insert rows programmatically using
|
||||
@ -545,13 +545,13 @@
|
||||
read-write. The following two functions make fields 1 and 2 of a
|
||||
query model editable:
|
||||
|
||||
\snippet examples/sql/querymodel/editablesqlmodel.cpp 0
|
||||
\snippet sql/querymodel/editablesqlmodel.cpp 0
|
||||
\codeline
|
||||
\snippet examples/sql/querymodel/editablesqlmodel.cpp 1
|
||||
\snippet sql/querymodel/editablesqlmodel.cpp 1
|
||||
|
||||
The setFirstName() helper function is defined as follows:
|
||||
|
||||
\snippet examples/sql/querymodel/editablesqlmodel.cpp 2
|
||||
\snippet sql/querymodel/editablesqlmodel.cpp 2
|
||||
|
||||
The setLastName() function is similar. See the
|
||||
\l{sql/querymodel}{Query Model} example for the complete source code.
|
@ -35,7 +35,7 @@
|
||||
\ingroup database
|
||||
|
||||
|
||||
\sa {QtSql Module}
|
||||
\sa {Qt SQL Module}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -390,7 +390,7 @@ void QSqlDatabasePrivate::disable()
|
||||
snippet shows how to create and open a default connection to a
|
||||
PostgreSQL database:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 0
|
||||
\snippet sqldatabase/sqldatabase.cpp 0
|
||||
|
||||
Once the QSqlDatabase object has been created, set the connection
|
||||
parameters with setDatabaseName(), setUserName(), setPassword(),
|
||||
@ -403,7 +403,7 @@ void QSqlDatabasePrivate::disable()
|
||||
{addDatabase()}. Subsequently, you can get the default connection
|
||||
by calling database() without the connection name argument:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 1
|
||||
\snippet sqldatabase/sqldatabase.cpp 1
|
||||
|
||||
QSqlDatabase is a value class. Changes made to a database
|
||||
connection via one instance of QSqlDatabase will affect other
|
||||
@ -440,7 +440,7 @@ void QSqlDatabasePrivate::disable()
|
||||
If you have created your own custom driver, you must register it
|
||||
with registerSqlDriver().
|
||||
|
||||
\sa QSqlDriver, QSqlQuery, {QtSql Module}, {Threads and the SQL Module}
|
||||
\sa QSqlDriver, QSqlQuery, {Qt SQL Module}, {Threads and the SQL Module}
|
||||
*/
|
||||
|
||||
/*! \fn QSqlDatabase QSqlDatabase::addDatabase(const QString &type, const QString &connectionName)
|
||||
@ -472,7 +472,7 @@ void QSqlDatabasePrivate::disable()
|
||||
setHostName(), setPort(), and setConnectOptions(), and, finally,
|
||||
open().
|
||||
|
||||
\sa database() removeDatabase() {Threads and the SQL Module}
|
||||
\sa database(), removeDatabase(), {Threads and the SQL Module}
|
||||
*/
|
||||
QSqlDatabase QSqlDatabase::addDatabase(const QString &type, const QString &connectionName)
|
||||
{
|
||||
@ -492,7 +492,7 @@ QSqlDatabase QSqlDatabase::addDatabase(const QString &type, const QString &conne
|
||||
connectionName does not exist in the list of databases, an invalid
|
||||
connection is returned.
|
||||
|
||||
\sa isOpen() {Threads and the SQL Module}
|
||||
\sa isOpen(), {Threads and the SQL Module}
|
||||
*/
|
||||
|
||||
QSqlDatabase QSqlDatabase::database(const QString& connectionName, bool open)
|
||||
@ -512,11 +512,11 @@ QSqlDatabase QSqlDatabase::database(const QString& connectionName, bool open)
|
||||
|
||||
Example:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp 0
|
||||
\snippet code/src_sql_kernel_qsqldatabase.cpp 0
|
||||
|
||||
The correct way to do it:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp 1
|
||||
\snippet code/src_sql_kernel_qsqldatabase.cpp 1
|
||||
|
||||
To remove the default connection, which may have been created with a
|
||||
call to addDatabase() not specifying a connection name, you can
|
||||
@ -524,7 +524,7 @@ QSqlDatabase QSqlDatabase::database(const QString& connectionName, bool open)
|
||||
the database returned by database(). Note that if a default database
|
||||
hasn't been created an invalid database will be returned.
|
||||
|
||||
\sa database() connectionName() {Threads and the SQL Module}
|
||||
\sa database(), connectionName(), {Threads and the SQL Module}
|
||||
*/
|
||||
|
||||
void QSqlDatabase::removeDatabase(const QString& connectionName)
|
||||
@ -600,7 +600,7 @@ QStringList QSqlDatabase::drivers()
|
||||
and don't want to compile it as a plugin.
|
||||
|
||||
Example:
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp 2
|
||||
\snippet code/src_sql_kernel_qsqldatabase.cpp 2
|
||||
|
||||
QSqlDatabase takes ownership of the \a creator pointer, so you
|
||||
mustn't delete it yourself.
|
||||
@ -831,8 +831,8 @@ QSqlQuery QSqlDatabase::exec(const QString & query) const
|
||||
values. Returns true on success; otherwise returns false. Error
|
||||
information can be retrieved using lastError().
|
||||
|
||||
\sa lastError() setDatabaseName() setUserName() setPassword()
|
||||
\sa setHostName() setPort() setConnectOptions()
|
||||
\sa lastError(), setDatabaseName(), setUserName(), setPassword(),
|
||||
setHostName(), setPort(), setConnectOptions()
|
||||
*/
|
||||
|
||||
bool QSqlDatabase::open()
|
||||
@ -924,7 +924,7 @@ bool QSqlDatabase::transaction()
|
||||
|
||||
Call lastError() to get information about errors.
|
||||
|
||||
\sa QSqlQuery::isActive() QSqlDriver::hasFeature() rollback()
|
||||
\sa QSqlQuery::isActive(), QSqlDriver::hasFeature(), rollback()
|
||||
*/
|
||||
bool QSqlDatabase::commit()
|
||||
{
|
||||
@ -945,7 +945,7 @@ bool QSqlDatabase::commit()
|
||||
|
||||
Call lastError() to get information about errors.
|
||||
|
||||
\sa QSqlQuery::isActive() QSqlDriver::hasFeature() commit()
|
||||
\sa QSqlQuery::isActive(), QSqlDriver::hasFeature(), commit()
|
||||
*/
|
||||
bool QSqlDatabase::rollback()
|
||||
{
|
||||
@ -974,12 +974,12 @@ bool QSqlDatabase::rollback()
|
||||
connection string to open an \c .mdb file directly, instead of
|
||||
having to create a DSN entry in the ODBC manager:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp 3
|
||||
\snippet code/src_sql_kernel_qsqldatabase.cpp 3
|
||||
|
||||
There is no default value.
|
||||
|
||||
\sa databaseName() setUserName() setPassword() setHostName()
|
||||
\sa setPort() setConnectOptions() open()
|
||||
\sa databaseName(), setUserName(), setPassword(), setHostName(),
|
||||
setPort(), setConnectOptions(), open()
|
||||
*/
|
||||
|
||||
void QSqlDatabase::setDatabaseName(const QString& name)
|
||||
@ -996,8 +996,8 @@ void QSqlDatabase::setDatabaseName(const QString& name)
|
||||
|
||||
There is no default value.
|
||||
|
||||
\sa userName() setDatabaseName() setPassword() setHostName()
|
||||
\sa setPort() setConnectOptions() open()
|
||||
\sa userName(), setDatabaseName(), setPassword(), setHostName(),
|
||||
setPort(), setConnectOptions(), open()
|
||||
*/
|
||||
|
||||
void QSqlDatabase::setUserName(const QString& name)
|
||||
@ -1018,8 +1018,8 @@ void QSqlDatabase::setUserName(const QString& name)
|
||||
Qt. Use the open() call that takes a password as parameter to
|
||||
avoid this behavior.
|
||||
|
||||
\sa password() setUserName() setDatabaseName() setHostName()
|
||||
\sa setPort() setConnectOptions() open()
|
||||
\sa password(), setUserName(), setDatabaseName(), setHostName(),
|
||||
setPort(), setConnectOptions(), open()
|
||||
*/
|
||||
|
||||
void QSqlDatabase::setPassword(const QString& password)
|
||||
@ -1036,8 +1036,8 @@ void QSqlDatabase::setPassword(const QString& password)
|
||||
|
||||
There is no default value.
|
||||
|
||||
\sa hostName() setUserName() setPassword() setDatabaseName()
|
||||
\sa setPort() setConnectOptions() open()
|
||||
\sa hostName(), setUserName(), setPassword(), setDatabaseName(),
|
||||
setPort(), setConnectOptions(), open()
|
||||
*/
|
||||
|
||||
void QSqlDatabase::setHostName(const QString& host)
|
||||
@ -1054,8 +1054,8 @@ void QSqlDatabase::setHostName(const QString& host)
|
||||
|
||||
There is no default value.
|
||||
|
||||
\sa port() setUserName() setPassword() setHostName()
|
||||
\sa setDatabaseName() setConnectOptions() open()
|
||||
\sa port(), setUserName(), setPassword(), setHostName(),
|
||||
setDatabaseName(), setConnectOptions(), open()
|
||||
*/
|
||||
|
||||
void QSqlDatabase::setPort(int port)
|
||||
@ -1130,7 +1130,7 @@ int QSqlDatabase::port() const
|
||||
Returns the database driver used to access the database
|
||||
connection.
|
||||
|
||||
\sa addDatabase() drivers()
|
||||
\sa addDatabase(), drivers()
|
||||
*/
|
||||
|
||||
QSqlDriver* QSqlDatabase::driver() const
|
||||
@ -1278,7 +1278,7 @@ QSqlRecord QSqlDatabase::record(const QString& tablename) const
|
||||
\endtable
|
||||
|
||||
Examples:
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp 4
|
||||
\snippet code/src_sql_kernel_qsqldatabase.cpp 4
|
||||
|
||||
Refer to the client library documentation for more information
|
||||
about the different options.
|
||||
@ -1325,9 +1325,9 @@ bool QSqlDatabase::isDriverAvailable(const QString& name)
|
||||
application. For example, you can create a PostgreSQL connection
|
||||
with your own QPSQL driver like this:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp 5
|
||||
\snippet code/src_sql_kernel_qsqldatabase.cpp 5
|
||||
\codeline
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp 6
|
||||
\snippet code/src_sql_kernel_qsqldatabase.cpp 6
|
||||
|
||||
The above code sets up a PostgreSQL connection and instantiates a
|
||||
QPSQLDriver object. Next, addDatabase() is called to add the
|
||||
@ -1346,7 +1346,7 @@ bool QSqlDatabase::isDriverAvailable(const QString& name)
|
||||
client library. Make sure the client library is in your linker's
|
||||
search path, and add lines like these to your \c{.pro} file:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp 7
|
||||
\snippet code/src_sql_kernel_qsqldatabase.cpp 7
|
||||
|
||||
The method described works for all the supplied drivers. The only
|
||||
difference will be in the driver constructor arguments. Here is a
|
||||
@ -1423,7 +1423,7 @@ QSqlDatabase QSqlDatabase::addDatabase(QSqlDriver* driver, const QString& connec
|
||||
Returns true if the QSqlDatabase has a valid driver.
|
||||
|
||||
Example:
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp 8
|
||||
\snippet code/src_sql_kernel_qsqldatabase.cpp 8
|
||||
*/
|
||||
bool QSqlDatabase::isValid() const
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ QSqlDriver::~QSqlDriver()
|
||||
/*!
|
||||
\since 5.0
|
||||
|
||||
\fn QSqlDriver::notification(const QString &name, NotificationSource source, const QString & payload)
|
||||
\fn QSqlDriver::notification(const QString &name, QSqlDriver::NotificationSource source, const QVariant & payload)
|
||||
|
||||
This signal is emitted when the database posts an event notification
|
||||
that the driver subscribes to. \a name identifies the event notification, \a source indicates the signal source,
|
||||
@ -682,11 +682,11 @@ QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const
|
||||
|
||||
This example retrieves the handle for a connection to sqlite:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqldriver.cpp 0
|
||||
\snippet code/src_sql_kernel_qsqldriver.cpp 0
|
||||
|
||||
This snippet returns the handle for PostgreSQL or MySQL:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqldriver.cpp 1
|
||||
\snippet code/src_sql_kernel_qsqldriver.cpp 1
|
||||
|
||||
\sa QSqlResult::handle()
|
||||
*/
|
||||
@ -695,36 +695,6 @@ QVariant QSqlDriver::handle() const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QSqlRecord QSqlDriver::record(const QSqlQuery& query) const
|
||||
|
||||
Use query.record() instead.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QSqlRecord QSqlDriver::recordInfo(const QString& tablename) const
|
||||
|
||||
Use record() instead.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QSqlRecord QSqlDriver::recordInfo(const QSqlQuery& query) const
|
||||
|
||||
Use query.record() instead.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QSqlDriver::nullText() const
|
||||
|
||||
sqlStatement() is now used to generate SQL. Use tr("NULL") for example, instead.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString QSqlDriver::formatValue(const QSqlField *field, bool trimStrings) const
|
||||
|
||||
Use the other formatValue() overload instead.
|
||||
*/
|
||||
|
||||
/*!
|
||||
This function is called to subscribe to event notifications from the database.
|
||||
\a name identifies the event notification.
|
||||
@ -743,7 +713,7 @@ QVariant QSqlDriver::handle() const
|
||||
own QSqlDriver subclass,
|
||||
|
||||
\since 4.4
|
||||
\sa unsubscribeFromNotification() subscribedToNotifications() QSqlDriver::hasFeature()
|
||||
\sa unsubscribeFromNotification(), subscribedToNotifications(), QSqlDriver::hasFeature()
|
||||
*/
|
||||
bool QSqlDriver::subscribeToNotification(const QString &name)
|
||||
{
|
||||
@ -767,7 +737,7 @@ bool QSqlDriver::subscribeToNotification(const QString &name)
|
||||
own QSqlDriver subclass,
|
||||
|
||||
\since 4.4
|
||||
\sa subscribeToNotification() subscribedToNotifications()
|
||||
\sa subscribeToNotification(), subscribedToNotifications()
|
||||
*/
|
||||
bool QSqlDriver::unsubscribeFromNotification(const QString &name)
|
||||
{
|
||||
@ -782,7 +752,7 @@ bool QSqlDriver::unsubscribeFromNotification(const QString &name)
|
||||
own QSqlDriver subclass,
|
||||
|
||||
\since 4.4
|
||||
\sa subscribeToNotification() unsubscribeFromNotification()
|
||||
\sa subscribeToNotification(), unsubscribeFromNotification()
|
||||
*/
|
||||
QStringList QSqlDriver::subscribedToNotifications() const
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ QSqlError::~QSqlError()
|
||||
Returns the text of the error as reported by the driver. This may
|
||||
contain database-specific descriptions. It may also be empty.
|
||||
|
||||
\sa setDriverText() databaseText() text()
|
||||
\sa setDriverText(), databaseText(), text()
|
||||
*/
|
||||
QString QSqlError::driverText() const
|
||||
{
|
||||
@ -165,7 +165,7 @@ QString QSqlError::driverText() const
|
||||
/*!
|
||||
Sets the driver error text to the value of \a driverText.
|
||||
|
||||
\sa driverText() setDatabaseText() text()
|
||||
\sa driverText(), setDatabaseText(), text()
|
||||
*/
|
||||
|
||||
void QSqlError::setDriverText(const QString& driverText)
|
||||
@ -177,7 +177,7 @@ void QSqlError::setDriverText(const QString& driverText)
|
||||
Returns the text of the error as reported by the database. This
|
||||
may contain database-specific descriptions; it may be empty.
|
||||
|
||||
\sa setDatabaseText() driverText() text()
|
||||
\sa setDatabaseText(), driverText(), text()
|
||||
*/
|
||||
|
||||
QString QSqlError::databaseText() const
|
||||
@ -188,7 +188,7 @@ QString QSqlError::databaseText() const
|
||||
/*!
|
||||
Sets the database error text to the value of \a databaseText.
|
||||
|
||||
\sa databaseText() setDriverText() text()
|
||||
\sa databaseText(), setDriverText(), text()
|
||||
*/
|
||||
|
||||
void QSqlError::setDatabaseText(const QString& databaseText)
|
||||
@ -245,7 +245,7 @@ void QSqlError::setNumber(int number)
|
||||
This is a convenience function that returns databaseText() and
|
||||
driverText() concatenated into a single string.
|
||||
|
||||
\sa driverText() databaseText()
|
||||
\sa driverText(), databaseText()
|
||||
*/
|
||||
|
||||
QString QSqlError::text() const
|
||||
@ -261,7 +261,7 @@ QString QSqlError::text() const
|
||||
Returns true if an error is set, otherwise false.
|
||||
|
||||
Example:
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqlerror.cpp 0
|
||||
\snippet code/src_sql_kernel_qsqlerror.cpp 0
|
||||
|
||||
\sa type()
|
||||
*/
|
||||
|
@ -113,21 +113,21 @@ public:
|
||||
Field data values are stored as QVariants. Using an incompatible
|
||||
type is not permitted. For example:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 2
|
||||
\snippet sqldatabase/sqldatabase.cpp 2
|
||||
|
||||
However, the field will attempt to cast certain data types to the
|
||||
field data type where possible:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 3
|
||||
\snippet sqldatabase/sqldatabase.cpp 3
|
||||
|
||||
QSqlField objects are rarely created explicitly in application
|
||||
code. They are usually accessed indirectly through \l{QSqlRecord}s
|
||||
that already contain a list of fields. For example:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 4
|
||||
\snippet sqldatabase/sqldatabase.cpp 4
|
||||
\dots
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 5
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 6
|
||||
\snippet sqldatabase/sqldatabase.cpp 5
|
||||
\snippet sqldatabase/sqldatabase.cpp 6
|
||||
|
||||
A QSqlField object can provide some meta-data about the field, for
|
||||
example, its name(), variant type(), length(), precision(),
|
||||
@ -157,7 +157,8 @@ public:
|
||||
Constructs an empty field called \a fieldName of variant type \a
|
||||
type.
|
||||
|
||||
\sa setRequiredStatus() setLength() setPrecision() setDefaultValue() setGenerated() setReadOnly()
|
||||
\sa setRequiredStatus(), setLength(), setPrecision(), setDefaultValue(),
|
||||
setGenerated(), setReadOnly()
|
||||
*/
|
||||
QSqlField::QSqlField(const QString& fieldName, QVariant::Type type)
|
||||
{
|
||||
@ -216,7 +217,8 @@ QSqlField::~QSqlField()
|
||||
/*!
|
||||
Sets the required status of this field to \a required.
|
||||
|
||||
\sa requiredStatus() setType() setLength() setPrecision() setDefaultValue() setGenerated() setReadOnly()
|
||||
\sa requiredStatus(), setType(), setLength(), setPrecision(),
|
||||
setDefaultValue(), setGenerated(), setReadOnly()
|
||||
*/
|
||||
void QSqlField::setRequiredStatus(RequiredStatus required)
|
||||
{
|
||||
@ -237,7 +239,8 @@ void QSqlField::setRequiredStatus(RequiredStatus required)
|
||||
maximum number of characters the string can hold; the meaning
|
||||
varies for other types.
|
||||
|
||||
\sa length() setType() setRequiredStatus() setPrecision() setDefaultValue() setGenerated() setReadOnly()
|
||||
\sa length(), setType(), setRequiredStatus(), setPrecision(),
|
||||
setDefaultValue(), setGenerated(), setReadOnly()
|
||||
*/
|
||||
void QSqlField::setLength(int fieldLength)
|
||||
{
|
||||
@ -248,7 +251,8 @@ void QSqlField::setLength(int fieldLength)
|
||||
/*!
|
||||
Sets the field's \a precision. This only affects numeric fields.
|
||||
|
||||
\sa precision() setType() setRequiredStatus() setLength() setDefaultValue() setGenerated() setReadOnly()
|
||||
\sa precision(), setType(), setRequiredStatus(), setLength(),
|
||||
setDefaultValue(), setGenerated(), setReadOnly()
|
||||
*/
|
||||
void QSqlField::setPrecision(int precision)
|
||||
{
|
||||
@ -259,7 +263,8 @@ void QSqlField::setPrecision(int precision)
|
||||
/*!
|
||||
Sets the default value used for this field to \a value.
|
||||
|
||||
\sa defaultValue() value() setType() setRequiredStatus() setLength() setPrecision() setGenerated() setReadOnly()
|
||||
\sa defaultValue(), value(), setType(), setRequiredStatus(),
|
||||
setLength(), setPrecision(), setGenerated(), setReadOnly()
|
||||
*/
|
||||
void QSqlField::setDefaultValue(const QVariant &value)
|
||||
{
|
||||
@ -282,7 +287,8 @@ void QSqlField::setSqlType(int type)
|
||||
QSqlQueryModel and QSqlTableModel will generate SQL for this
|
||||
field.
|
||||
|
||||
\sa isGenerated() setType() setRequiredStatus() setLength() setPrecision() setDefaultValue() setReadOnly()
|
||||
\sa isGenerated(), setType(), setRequiredStatus(), setLength(),
|
||||
setPrecision(), setDefaultValue(), setReadOnly()
|
||||
*/
|
||||
void QSqlField::setGenerated(bool gen)
|
||||
{
|
||||
@ -302,7 +308,7 @@ void QSqlField::setGenerated(bool gen)
|
||||
|
||||
To set the value to NULL, use clear().
|
||||
|
||||
\sa value() isReadOnly() defaultValue()
|
||||
\sa value(), isReadOnly(), defaultValue()
|
||||
*/
|
||||
|
||||
void QSqlField::setValue(const QVariant& value)
|
||||
@ -316,7 +322,7 @@ void QSqlField::setValue(const QVariant& value)
|
||||
Clears the value of the field and sets it to NULL.
|
||||
If the field is read-only, nothing happens.
|
||||
|
||||
\sa setValue() isReadOnly() requiredStatus()
|
||||
\sa setValue(), isReadOnly(), requiredStatus()
|
||||
*/
|
||||
|
||||
void QSqlField::clear()
|
||||
@ -384,7 +390,8 @@ QVariant::Type QSqlField::type() const
|
||||
/*!
|
||||
Set's the field's variant type to \a type.
|
||||
|
||||
\sa type() setRequiredStatus() setLength() setPrecision() setDefaultValue() setGenerated() setReadOnly()
|
||||
\sa type(), setRequiredStatus(), setLength(), setPrecision(),
|
||||
setDefaultValue(), setGenerated(), setReadOnly()
|
||||
*/
|
||||
void QSqlField::setType(QVariant::Type type)
|
||||
{
|
||||
@ -399,7 +406,8 @@ void QSqlField::setType(QVariant::Type type)
|
||||
Returns true if the field's value is read-only; otherwise returns
|
||||
false.
|
||||
|
||||
\sa setReadOnly() type() requiredStatus() length() precision() defaultValue() isGenerated()
|
||||
\sa setReadOnly(), type(), requiredStatus(), length(), precision(),
|
||||
defaultValue(), isGenerated()
|
||||
*/
|
||||
bool QSqlField::isReadOnly() const
|
||||
{ return d->ro; }
|
||||
@ -424,7 +432,8 @@ void QSqlField::detach()
|
||||
Returns true if this is a required field; otherwise returns false.
|
||||
An \c INSERT will fail if a required field does not have a value.
|
||||
|
||||
\sa setRequiredStatus() type() length() precision() defaultValue() isGenerated()
|
||||
\sa setRequiredStatus(), type(), length(), precision(), defaultValue(),
|
||||
isGenerated()
|
||||
*/
|
||||
QSqlField::RequiredStatus QSqlField::requiredStatus() const
|
||||
{
|
||||
@ -437,7 +446,8 @@ QSqlField::RequiredStatus QSqlField::requiredStatus() const
|
||||
If the returned value is negative, it means that the information
|
||||
is not available from the database.
|
||||
|
||||
\sa setLength() type() requiredStatus() precision() defaultValue() isGenerated()
|
||||
\sa setLength(), type(), requiredStatus(), precision(), defaultValue(),
|
||||
isGenerated()
|
||||
*/
|
||||
int QSqlField::length() const
|
||||
{
|
||||
@ -451,7 +461,8 @@ int QSqlField::length() const
|
||||
If the returned value is negative, it means that the information
|
||||
is not available from the database.
|
||||
|
||||
\sa setPrecision() type() requiredStatus() length() defaultValue() isGenerated()
|
||||
\sa setPrecision(), type(), requiredStatus(), length(), defaultValue(),
|
||||
isGenerated()
|
||||
*/
|
||||
int QSqlField::precision() const
|
||||
{
|
||||
@ -461,7 +472,8 @@ int QSqlField::precision() const
|
||||
/*!
|
||||
Returns the field's default value (which may be NULL).
|
||||
|
||||
\sa setDefaultValue() type() requiredStatus() length() precision() isGenerated()
|
||||
\sa setDefaultValue(), type(), requiredStatus(), length(), precision(),
|
||||
isGenerated()
|
||||
*/
|
||||
QVariant QSqlField::defaultValue() const
|
||||
{
|
||||
@ -485,7 +497,8 @@ int QSqlField::typeID() const
|
||||
Returns true if the field is generated; otherwise returns
|
||||
false.
|
||||
|
||||
\sa setGenerated() type() requiredStatus() length() precision() defaultValue()
|
||||
\sa setGenerated(), type(), requiredStatus(), length(), precision(),
|
||||
defaultValue()
|
||||
*/
|
||||
bool QSqlField::isGenerated() const
|
||||
{
|
||||
@ -522,12 +535,6 @@ QDebug operator<<(QDebug dbg, const QSqlField &f)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn void QSqlField::setNull()
|
||||
|
||||
Use clear() instead.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns true if the value is auto-generated by the database,
|
||||
for example auto-increment primary key values.
|
||||
|
@ -148,7 +148,7 @@ QSqlQueryPrivate::~QSqlQueryPrivate()
|
||||
|
||||
For example:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 7
|
||||
\snippet sqldatabase/sqldatabase.cpp 7
|
||||
|
||||
To access the data returned by a query, use value(int). Each
|
||||
field in the data returned by a \c SELECT statement is accessed
|
||||
@ -161,7 +161,7 @@ QSqlQueryPrivate::~QSqlQueryPrivate()
|
||||
explained below). To convert a field name into an index, use
|
||||
record().\l{QSqlRecord::indexOf()}{indexOf()}, for example:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 8
|
||||
\snippet sqldatabase/sqldatabase.cpp 8
|
||||
|
||||
QSqlQuery supports prepared query execution and the binding of
|
||||
parameter values to placeholders. Some databases don't support
|
||||
@ -190,19 +190,19 @@ QSqlQueryPrivate::~QSqlQueryPrivate()
|
||||
|
||||
\b{Named binding using named placeholders:}
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 9
|
||||
\snippet sqldatabase/sqldatabase.cpp 9
|
||||
|
||||
\b{Positional binding using named placeholders:}
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 10
|
||||
\snippet sqldatabase/sqldatabase.cpp 10
|
||||
|
||||
\b{Binding values using positional placeholders (version 1):}
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 11
|
||||
\snippet sqldatabase/sqldatabase.cpp 11
|
||||
|
||||
\b{Binding values using positional placeholders (version 2):}
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 12
|
||||
\snippet sqldatabase/sqldatabase.cpp 12
|
||||
|
||||
\b{Binding values to a stored procedure:}
|
||||
|
||||
@ -210,7 +210,7 @@ QSqlQueryPrivate::~QSqlQueryPrivate()
|
||||
it a character through its in parameter, and taking its result in
|
||||
the out parameter.
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 13
|
||||
\snippet sqldatabase/sqldatabase.cpp 13
|
||||
|
||||
Note that unbound parameters will retain their values.
|
||||
|
||||
@ -343,7 +343,7 @@ bool QSqlQuery::isNull(int field) const
|
||||
|
||||
Example:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 34
|
||||
\snippet sqldatabase/sqldatabase.cpp 34
|
||||
|
||||
\sa isActive(), isValid(), next(), previous(), first(), last(),
|
||||
seek()
|
||||
@ -384,7 +384,7 @@ bool QSqlQuery::exec(const QString& query)
|
||||
The fields are numbered from left to right using the text of the
|
||||
\c SELECT statement, e.g. in
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqlquery.cpp 0
|
||||
\snippet code/src_sql_kernel_qsqlquery.cpp 0
|
||||
|
||||
field 0 is \c forename and field 1 is \c
|
||||
surname. Using \c{SELECT *} is not recommended because the order
|
||||
@ -394,7 +394,7 @@ bool QSqlQuery::exec(const QString& query)
|
||||
exist, if the query is inactive, or if the query is positioned on
|
||||
an invalid record.
|
||||
|
||||
\sa previous() next() first() last() seek() isActive() isValid()
|
||||
\sa previous(), next(), first(), last(), seek(), isActive(), isValid()
|
||||
*/
|
||||
|
||||
QVariant QSqlQuery::value(int index) const
|
||||
@ -411,7 +411,7 @@ QVariant QSqlQuery::value(int index) const
|
||||
function returns QSql::BeforeFirstRow or
|
||||
QSql::AfterLastRow, which are special negative values.
|
||||
|
||||
\sa previous() next() first() last() seek() isActive() isValid()
|
||||
\sa previous(), next(), first(), last(), seek(), isActive(), isValid()
|
||||
*/
|
||||
|
||||
int QSqlQuery::at() const
|
||||
@ -495,7 +495,7 @@ const QSqlResult* QSqlQuery::result() const
|
||||
|
||||
\endlist
|
||||
|
||||
\sa next() previous() first() last() at() isActive() isValid()
|
||||
\sa next(), previous(), first(), last(), at(), isActive(), isValid()
|
||||
*/
|
||||
bool QSqlQuery::seek(int index, bool relative)
|
||||
{
|
||||
@ -587,7 +587,7 @@ bool QSqlQuery::seek(int index, bool relative)
|
||||
the last record and false is returned. If the record is successfully
|
||||
retrieved, true is returned.
|
||||
|
||||
\sa previous() first() last() seek() at() isActive() isValid()
|
||||
\sa previous(), first(), last(), seek(), at(), isActive(), isValid()
|
||||
*/
|
||||
bool QSqlQuery::next()
|
||||
{
|
||||
@ -636,7 +636,7 @@ bool QSqlQuery::next()
|
||||
before the first record and false is returned. If the record is
|
||||
successfully retrieved, true is returned.
|
||||
|
||||
\sa next() first() last() seek() at() isActive() isValid()
|
||||
\sa next(), first(), last(), seek(), at(), isActive(), isValid()
|
||||
*/
|
||||
bool QSqlQuery::previous()
|
||||
{
|
||||
@ -671,7 +671,7 @@ bool QSqlQuery::previous()
|
||||
return false. Returns true if successful. If unsuccessful the query
|
||||
position is set to an invalid position and false is returned.
|
||||
|
||||
\sa next() previous() last() seek() at() isActive() isValid()
|
||||
\sa next(), previous(), last(), seek(), at(), isActive(), isValid()
|
||||
*/
|
||||
bool QSqlQuery::first()
|
||||
{
|
||||
@ -695,7 +695,7 @@ bool QSqlQuery::first()
|
||||
Returns true if successful. If unsuccessful the query position is
|
||||
set to an invalid position and false is returned.
|
||||
|
||||
\sa next() previous() first() seek() at() isActive() isValid()
|
||||
\sa next(), previous(), first(), seek(), at(), isActive(), isValid()
|
||||
*/
|
||||
|
||||
bool QSqlQuery::last()
|
||||
@ -717,7 +717,7 @@ bool QSqlQuery::last()
|
||||
To determine the number of rows affected by a non-\c SELECT
|
||||
statement, use numRowsAffected().
|
||||
|
||||
\sa isActive() numRowsAffected() QSqlDriver::hasFeature()
|
||||
\sa isActive(), numRowsAffected(), QSqlDriver::hasFeature()
|
||||
*/
|
||||
int QSqlQuery::size() const
|
||||
{
|
||||
@ -732,7 +732,7 @@ int QSqlQuery::size() const
|
||||
statements, the value is undefined; use size() instead. If the query
|
||||
is not \l{isActive()}{active}, -1 is returned.
|
||||
|
||||
\sa size() QSqlDriver::hasFeature()
|
||||
\sa size(), QSqlDriver::hasFeature()
|
||||
*/
|
||||
|
||||
int QSqlQuery::numRowsAffected() const
|
||||
@ -850,7 +850,7 @@ void QSqlQuery::setForwardOnly(bool forward)
|
||||
Since the order of the columns is not defined, QSqlRecord::indexOf()
|
||||
is used to obtain the index of a column.
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqlquery.cpp 1
|
||||
\snippet code/src_sql_kernel_qsqlquery.cpp 1
|
||||
|
||||
\sa value()
|
||||
*/
|
||||
@ -895,7 +895,7 @@ void QSqlQuery::clear()
|
||||
|
||||
Example:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 9
|
||||
\snippet sqldatabase/sqldatabase.cpp 9
|
||||
|
||||
\sa exec(), bindValue(), addBindValue()
|
||||
*/
|
||||
@ -937,7 +937,7 @@ bool QSqlQuery::prepare(const QString& query)
|
||||
Note that the last error for this query is reset when exec() is
|
||||
called.
|
||||
|
||||
\sa prepare() bindValue() addBindValue() boundValue() boundValues()
|
||||
\sa prepare(), bindValue(), addBindValue(), boundValue(), boundValues()
|
||||
*/
|
||||
bool QSqlQuery::exec()
|
||||
{
|
||||
@ -968,11 +968,11 @@ bool QSqlQuery::exec()
|
||||
|
||||
Example:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqlquery.cpp 2
|
||||
\snippet code/src_sql_kernel_qsqlquery.cpp 2
|
||||
|
||||
The example above inserts four new rows into \c myTable:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqlquery.cpp 3
|
||||
\snippet code/src_sql_kernel_qsqlquery.cpp 3
|
||||
|
||||
To bind NULL values, a null QVariant of the relevant type has to be
|
||||
added to the bound QVariantList; for example, \c
|
||||
@ -1021,7 +1021,7 @@ bool QSqlQuery::execBatch(BatchExecutionMode mode)
|
||||
\endcode
|
||||
Binding to name will bind to the first :name, but not the second.
|
||||
|
||||
\sa addBindValue(), prepare(), exec(), boundValue() boundValues()
|
||||
\sa addBindValue(), prepare(), exec(), boundValue(), boundValues()
|
||||
*/
|
||||
void QSqlQuery::bindValue(const QString& placeholder, const QVariant& val,
|
||||
QSql::ParamType paramType
|
||||
@ -1051,7 +1051,7 @@ void QSqlQuery::bindValue(int pos, const QVariant& val, QSql::ParamType paramTyp
|
||||
To bind a NULL value, use a null QVariant; for example, use \c
|
||||
{QVariant(QVariant::String)} if you are binding a string.
|
||||
|
||||
\sa bindValue(), prepare(), exec(), boundValue() boundValues()
|
||||
\sa bindValue(), prepare(), exec(), boundValue(), boundValues()
|
||||
*/
|
||||
void QSqlQuery::addBindValue(const QVariant& val, QSql::ParamType paramType)
|
||||
{
|
||||
@ -1061,7 +1061,7 @@ void QSqlQuery::addBindValue(const QVariant& val, QSql::ParamType paramType)
|
||||
/*!
|
||||
Returns the value for the \a placeholder.
|
||||
|
||||
\sa boundValues() bindValue() addBindValue()
|
||||
\sa boundValues(), bindValue(), addBindValue()
|
||||
*/
|
||||
QVariant QSqlQuery::boundValue(const QString& placeholder) const
|
||||
{
|
||||
@ -1082,13 +1082,13 @@ QVariant QSqlQuery::boundValue(int pos) const
|
||||
With named binding, the bound values can be examined in the
|
||||
following ways:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 14
|
||||
\snippet sqldatabase/sqldatabase.cpp 14
|
||||
|
||||
With positional binding, the code becomes:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 15
|
||||
\snippet sqldatabase/sqldatabase.cpp 15
|
||||
|
||||
\sa boundValue() bindValue() addBindValue()
|
||||
\sa boundValue(), bindValue(), addBindValue()
|
||||
*/
|
||||
QMap<QString,QVariant> QSqlQuery::boundValues() const
|
||||
{
|
||||
@ -1117,12 +1117,6 @@ QString QSqlQuery::executedQuery() const
|
||||
return d->sqlResult->executedQuery();
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn bool QSqlQuery::prev()
|
||||
|
||||
Use previous() instead.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns the object ID of the most recent inserted row if the
|
||||
database supports it. An invalid QVariant will be returned if the
|
||||
@ -1190,7 +1184,7 @@ QSql::NumericalPrecisionPolicy QSqlQuery::numericalPrecisionPolicy() const
|
||||
|
||||
Sets the query to inactive. Bound values retain their values.
|
||||
|
||||
\sa prepare() exec() isActive()
|
||||
\sa prepare(), exec(), isActive()
|
||||
*/
|
||||
void QSqlQuery::finish()
|
||||
{
|
||||
@ -1230,7 +1224,8 @@ void QSqlQuery::finish()
|
||||
databases may have restrictions on which statements are allowed to
|
||||
be used in a SQL batch.
|
||||
|
||||
\sa QSqlDriver::hasFeature() setForwardOnly() next() isSelect() numRowsAffected() isActive() lastError()
|
||||
\sa QSqlDriver::hasFeature(), setForwardOnly(), next(), isSelect(),
|
||||
numRowsAffected(), isActive(), lastError()
|
||||
*/
|
||||
bool QSqlQuery::nextResult()
|
||||
{
|
||||
|
@ -189,7 +189,7 @@ bool QSqlRecord::operator==(const QSqlRecord &other) const
|
||||
the record. If \a index is out of bounds, an invalid QVariant
|
||||
is returned.
|
||||
|
||||
\sa fieldName() isNull()
|
||||
\sa fieldName(), isNull()
|
||||
*/
|
||||
|
||||
QVariant QSqlRecord::value(int index) const
|
||||
@ -264,7 +264,7 @@ QSqlField QSqlRecord::field(const QString &name) const
|
||||
/*!
|
||||
Append a copy of field \a field to the end of the record.
|
||||
|
||||
\sa insert() replace() remove()
|
||||
\sa insert(), replace(), remove()
|
||||
*/
|
||||
|
||||
void QSqlRecord::append(const QSqlField& field)
|
||||
@ -276,7 +276,7 @@ void QSqlRecord::append(const QSqlField& field)
|
||||
/*!
|
||||
Inserts the field \a field at position \a pos in the record.
|
||||
|
||||
\sa append() replace() remove()
|
||||
\sa append(), replace(), remove()
|
||||
*/
|
||||
void QSqlRecord::insert(int pos, const QSqlField& field)
|
||||
{
|
||||
@ -288,7 +288,7 @@ void QSqlRecord::insert(int pos, const QSqlField& field)
|
||||
Replaces the field at position \a pos with the given \a field. If
|
||||
\a pos is out of range, nothing happens.
|
||||
|
||||
\sa append() insert() remove()
|
||||
\sa append(), insert(), remove()
|
||||
*/
|
||||
|
||||
void QSqlRecord::replace(int pos, const QSqlField& field)
|
||||
@ -304,7 +304,7 @@ void QSqlRecord::replace(int pos, const QSqlField& field)
|
||||
Removes the field at position \a pos. If \a pos is out of range,
|
||||
nothing happens.
|
||||
|
||||
\sa append() insert() replace()
|
||||
\sa append(), insert(), replace()
|
||||
*/
|
||||
|
||||
void QSqlRecord::remove(int pos)
|
||||
@ -319,7 +319,7 @@ void QSqlRecord::remove(int pos)
|
||||
/*!
|
||||
Removes all the record's fields.
|
||||
|
||||
\sa clearValues() isEmpty()
|
||||
\sa clearValues(), isEmpty()
|
||||
*/
|
||||
|
||||
void QSqlRecord::clear()
|
||||
@ -332,7 +332,7 @@ void QSqlRecord::clear()
|
||||
Returns true if there are no fields in the record; otherwise
|
||||
returns false.
|
||||
|
||||
\sa append() insert() clear()
|
||||
\sa append(), insert(), clear()
|
||||
*/
|
||||
|
||||
bool QSqlRecord::isEmpty() const
|
||||
@ -524,10 +524,4 @@ QDebug operator<<(QDebug dbg, const QSqlRecord &r)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn int QSqlRecord::position(const QString& name) const
|
||||
|
||||
Use indexOf() instead.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -953,7 +953,7 @@ void QSqlResult::virtual_hook(int, void *)
|
||||
|
||||
Example:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqlresult.cpp 0
|
||||
\snippet code/src_sql_kernel_qsqlresult.cpp 0
|
||||
|
||||
Here, we insert two rows into a SQL table, with each row containing three values.
|
||||
|
||||
@ -1032,11 +1032,11 @@ bool QSqlResult::nextResult()
|
||||
|
||||
This example retrieves the handle for a sqlite result:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqlresult.cpp 1
|
||||
\snippet code/src_sql_kernel_qsqlresult.cpp 1
|
||||
|
||||
This snippet returns the handle for PostgreSQL or MySQL:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_kernel_qsqlresult.cpp 2
|
||||
\snippet code/src_sql_kernel_qsqlresult.cpp 2
|
||||
|
||||
\sa QSqlDriver::handle()
|
||||
*/
|
||||
|
@ -111,7 +111,7 @@ void QSqlQueryModelPrivate::initColOffsets(int size)
|
||||
the lower-level QSqlQuery and can be used to provide data to
|
||||
view classes such as QTableView. For example:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 16
|
||||
\snippet sqldatabase/sqldatabase.cpp 16
|
||||
|
||||
We set the model's query, then we set up the labels displayed in
|
||||
the view header.
|
||||
@ -119,13 +119,13 @@ void QSqlQueryModelPrivate::initColOffsets(int size)
|
||||
QSqlQueryModel can also be used to access a database
|
||||
programmatically, without binding it to a view:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 21
|
||||
\snippet sqldatabase/sqldatabase.cpp 21
|
||||
|
||||
The code snippet above extracts the \c salary field from record 4 in
|
||||
the result set of the query \c{SELECT * from employee}. Assuming
|
||||
that \c salary is column 2, we can rewrite the last line as follows:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 22
|
||||
\snippet sqldatabase/sqldatabase.cpp 22
|
||||
|
||||
The model is read-only by default. To make it read-write, you
|
||||
must subclass it and reimplement setData() and flags(). Another
|
||||
@ -179,7 +179,7 @@ QSqlQueryModel::~QSqlQueryModel()
|
||||
|
||||
To force fetching of the entire result set, you can use the following:
|
||||
|
||||
\snippet doc/src/snippets/code/src_sql_models_qsqlquerymodel.cpp 0
|
||||
\snippet code/src_sql_models_qsqlquerymodel.cpp 0
|
||||
|
||||
\a parent should always be an invalid QModelIndex.
|
||||
|
||||
@ -394,7 +394,7 @@ void QSqlQueryModel::setQuery(const QSqlQuery &query)
|
||||
was an error setting the query.
|
||||
|
||||
Example:
|
||||
\snippet doc/src/snippets/code/src_sql_models_qsqlquerymodel.cpp 1
|
||||
\snippet code/src_sql_models_qsqlquerymodel.cpp 1
|
||||
|
||||
\sa query(), queryChange(), lastError()
|
||||
*/
|
||||
@ -529,7 +529,7 @@ QSqlRecord QSqlQueryModel::record() const
|
||||
By default, inserted columns are empty. To fill them with data,
|
||||
reimplement data() and handle any inserted column separately:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 23
|
||||
\snippet sqldatabase/sqldatabase.cpp 23
|
||||
|
||||
\sa removeColumns()
|
||||
*/
|
||||
|
@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
|
||||
use the class, simply call QAbstractItemView::setItemDelegate()
|
||||
on the view with an instance of QSqlRelationalDelegate:
|
||||
|
||||
\snippet examples/sql/relationaltablemodel/relationaltablemodel.cpp 4
|
||||
\snippet sql/relationaltablemodel/relationaltablemodel.cpp 4
|
||||
|
||||
The \l{sql/relationaltablemodel}{Relational Table Model} example
|
||||
(shown below) illustrates how to use QSqlRelationalDelegate in
|
||||
|
@ -340,10 +340,10 @@ void QSqlRelationalTableModelPrivate::clearCache()
|
||||
The following code snippet shows how the QSqlRelationalTableModel
|
||||
was set up:
|
||||
|
||||
\snippet examples/sql/relationaltablemodel/relationaltablemodel.cpp 0
|
||||
\snippet sql/relationaltablemodel/relationaltablemodel.cpp 0
|
||||
\codeline
|
||||
\snippet examples/sql/relationaltablemodel/relationaltablemodel.cpp 1
|
||||
\snippet examples/sql/relationaltablemodel/relationaltablemodel.cpp 2
|
||||
\snippet sql/relationaltablemodel/relationaltablemodel.cpp 1
|
||||
\snippet sql/relationaltablemodel/relationaltablemodel.cpp 2
|
||||
|
||||
The setRelation() function calls establish a relationship between
|
||||
two tables. The first call specifies that column 2 in table \c
|
||||
@ -359,7 +359,7 @@ void QSqlRelationalTableModelPrivate::clearCache()
|
||||
call QAbstractItemView::setItemDelegate() on the view with an
|
||||
instance of QSqlRelationalDelegate:
|
||||
|
||||
\snippet examples/sql/relationaltablemodel/relationaltablemodel.cpp 4
|
||||
\snippet sql/relationaltablemodel/relationaltablemodel.cpp 4
|
||||
|
||||
The \l{sql/relationaltablemodel} example illustrates how to use
|
||||
QSqlRelationalTableModel in conjunction with
|
||||
@ -486,9 +486,9 @@ bool QSqlRelationalTableModel::setData(const QModelIndex &index, const QVariant
|
||||
|
||||
Example:
|
||||
|
||||
\snippet examples/sql/relationaltablemodel/relationaltablemodel.cpp 0
|
||||
\snippet sql/relationaltablemodel/relationaltablemodel.cpp 0
|
||||
\codeline
|
||||
\snippet examples/sql/relationaltablemodel/relationaltablemodel.cpp 1
|
||||
\snippet sql/relationaltablemodel/relationaltablemodel.cpp 1
|
||||
|
||||
The setRelation() call specifies that column 2 in table \c
|
||||
employee is a foreign key that maps with field \c id of table \c
|
||||
|
@ -213,7 +213,7 @@ QSqlRecord QSqlTableModelPrivate::primaryValues(int row) const
|
||||
lower-level QSqlQuery and can be used to provide data to view
|
||||
classes such as QTableView. For example:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 24
|
||||
\snippet sqldatabase/sqldatabase.cpp 24
|
||||
|
||||
We set the SQL table's name and the edit strategy, then we set up
|
||||
the labels displayed in the view header. The edit strategy
|
||||
@ -224,7 +224,7 @@ QSqlRecord QSqlTableModelPrivate::primaryValues(int row) const
|
||||
QSqlTableModel can also be used to access a database
|
||||
programmatically, without binding it to a view:
|
||||
|
||||
\snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 21
|
||||
\snippet sqldatabase/sqldatabase.cpp 21
|
||||
|
||||
The code snippet above extracts the \c salary field from record 4 in
|
||||
the result set of the query \c{SELECT * from employee}.
|
||||
|
@ -21,6 +21,7 @@ DEFINES += QT_NO_CAST_FROM_ASCII
|
||||
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
|
||||
SQL_P = sql
|
||||
|
||||
include(doc/doc.pri)
|
||||
include(kernel/kernel.pri)
|
||||
include(drivers/drivers.pri)
|
||||
include(models/models.pri)
|
||||
|