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
doc_src_sql-driver_snippet.cpp
Go to the documentation of this file.
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
//! [36]
4
QSqlQuery
query
;
5
QVariant
v
;
6
query.setForwardOnly(
true
);
7
query.exec(
"SELECT * FROM table"
);
8
while
(query.next()) {
9
// Handle changes in every iteration of the loop
10
v = query.result()->handle();
11
12
if
(qstrcmp(v.typeName(),
"PGresult*"
) == 0) {
13
PGresult *handle = *
static_cast
<PGresult **>(v.data());
14
if
(handle) {
15
// Do something...
16
}
17
}
18
}
19
//! [36]
query
QSqlQuery query
[36]
Definition
doc_src_sql-driver_snippet.cpp:4
v
QVariant v
Definition
doc_src_sql-driver_snippet.cpp:5
qtbase
src
sql
doc
snippets
code
doc_src_sql-driver_snippet.cpp
Generated on
for Qt by
1.14.0