summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorartoka <arto.katajasalo@digia.com>2011-11-01 12:47:17 (GMT)
committerCasper van Donderen <casper.vandonderen@nokia.com>2011-11-01 13:10:49 (GMT)
commit13e20c189e7dd9e86dc1419d745c98e2e4dc7739 (patch)
tree772d05c991ddee20fbb9dc662594543005eb1b1b
parente71c2a6d13e079e9e4d7a8446f2ef4c6958b18f8 (diff)
downloadQt-13e20c189e7dd9e86dc1419d745c98e2e4dc7739.zip
Qt-13e20c189e7dd9e86dc1419d745c98e2e4dc7739.tar.gz
Qt-13e20c189e7dd9e86dc1419d745c98e2e4dc7739.tar.bz2
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 <casper.vandonderen@nokia.com>
-rw-r--r--doc/src/snippets/code/src_sql_kernel_qsqldriver.cpp6
1 files 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<sqlite3 **>(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<PGconn **>(v.data());
if (handle != 0) ...
}
-if (v.typeName() == "MYSQL*") {
+if (qstrcmp(v.typeName(), "MYSQL*") == 0) {
MYSQL *handle = *static_cast<MYSQL **>(v.data());
if (handle != 0) ...
}