From 13e20c189e7dd9e86dc1419d745c98e2e4dc7739 Mon Sep 17 00:00:00 2001 From: artoka Date: Tue, 1 Nov 2011 13:47:17 +0100 Subject: Errors in QSqlDriver::handle examples In the examples the const char* variable was compared to QString with "==" operator which doesn't work. Changed the comparison to use qstrcmp - method. Task-number: QTBUG-20089 Merge-request: 2698 Reviewed-by: Casper van Donderen --- doc/src/snippets/code/src_sql_kernel_qsqldriver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/snippets/code/src_sql_kernel_qsqldriver.cpp b/doc/src/snippets/code/src_sql_kernel_qsqldriver.cpp index d49b6e0..1a3772f 100644 --- a/doc/src/snippets/code/src_sql_kernel_qsqldriver.cpp +++ b/doc/src/snippets/code/src_sql_kernel_qsqldriver.cpp @@ -41,7 +41,7 @@ //! [0] QSqlDatabase db = ...; QVariant v = db.driver()->handle(); -if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*")==0) { +if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0) { // v.data() returns a pointer to the handle sqlite3 *handle = *static_cast(v.data()); if (handle != 0) { // check that it is not NULL @@ -52,12 +52,12 @@ if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*")==0) { //! [1] -if (v.typeName() == "PGconn*") { +if (qstrcmp(v.typeName(), "PGconn*") == 0) { PGconn *handle = *static_cast(v.data()); if (handle != 0) ... } -if (v.typeName() == "MYSQL*") { +if (qstrcmp(v.typeName(), "MYSQL*") == 0) { MYSQL *handle = *static_cast(v.data()); if (handle != 0) ... } -- cgit v0.12