From 5f9a0d64b324abb8bf9baffabd7accb61a83a7e7 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 23 Sep 2018 14:25:44 +0200 Subject: QtSql: fix code snippets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code snippets retrieving the native database driver handles was using qstrcmp() wrong since that is returning 0 when the strings are equal. In some snippets there was even a plain char * comparison which would not work at all. Fix all the places by correctly using qstrcmp() and replace the checks for the valid pointer by not checking for 0. Fixes: QTBUG-70598 Change-Id: I5c53dcfc51c958203fc60fa6a23dd6b27faa1d96 Reviewed-by: André Hartmann Reviewed-by: Paul Wicking Reviewed-by: Venugopal Shivashankar --- src/sql/doc/snippets/code/doc_src_sql-driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sql/doc/snippets/code/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 2c0e824db3..54576733bf 100644 --- a/src/sql/doc/snippets/code/doc_src_sql-driver.cpp +++ b/src/sql/doc/snippets/code/doc_src_sql-driver.cpp @@ -106,7 +106,7 @@ while (query.next()) { QVariant v = query.result()->handle(); if (qstrcmp(v.typeName(), "PGresult*") == 0) { PGresult *handle = *static_cast(v.data()); - if (handle != 0) { + if (handle) { // Do something... } } -- cgit v1.2.3