Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_sql_models_qsqlquerymodel.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
#
include
<
QSqlDatabase
>
4
#
include
<
QSqlQuery
>
5
#
include
<
QSqlDriver
>
6
#
include
<
QVariant
>
7
#
include
"../sqldatabase/sqldatabase.cpp"
8
9
void
MyModel
::
fetchModel
()
10
{
11
MyModel
*myModel =
new
MyModel
;
12
//! [0]
13
while
(myModel->canFetchMore())
14
myModel->fetchMore();
15
//! [0]
16
17
//! [1]
18
QSqlQueryModel model;
19
model.setQuery(
"select * from MyTable"
);
20
if
(model.lastError().isValid())
21
qDebug() << model.lastError();
22
//! [1]
23
}
MyModel
Definition
src_corelib_kernel_qabstractitemmodel.cpp:11
MyModel::fetchModel
void fetchModel()
Definition
src_sql_models_qsqlquerymodel.cpp:9
qtbase
src
sql
doc
snippets
code
src_sql_models_qsqlquerymodel.cpp
Generated on
for Qt by
1.14.0