Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
6query.setForwardOnly(true);
7query.exec("SELECT * FROM table");
8while (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}
The QSqlQuery class provides a means of executing and manipulating SQL statements.
Definition qsqlquery.h:24
\inmodule QtCore
Definition qvariant.h:65
QSqlQuery query
[36]
Q_CORE_EXPORT int qstrcmp(const char *str1, const char *str2)
GLsizei const GLfloat * v
[13]
GLuint64 GLenum void * handle
GLenum query
struct pg_result PGresult
Definition qsql_psql_p.h:27