summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/psql
diff options
context:
space:
mode:
authorRobert Szefner <r.szefner@hydro-partner.pl>2018-01-07 14:18:39 +0100
committerRobert Szefner <robertsz27@interia.pl>2018-01-09 14:13:52 +0000
commitca4a76350a288589d7caf54548ee08f9d4ab46c1 (patch)
treecc50796cd56f2646c1b24386eafb2b39d1f471a2 /src/plugins/sqldrivers/psql
parent43f2d43e8f42446985fe7e5e56c85ebd2812d5ab (diff)
Small optimalization for NULL values
No need to call PQgetvalue() before PQgetisnull(). Change-Id: Ie83ee577b082dbe9d9ca2e86212a281abebdde6e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/sqldrivers/psql')
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index dfca183ff0..6f105f79ca 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -655,9 +655,9 @@ QVariant QPSQLResult::data(int i)
const int currentRow = isForwardOnly() ? 0 : at();
int ptype = PQftype(d->result, i);
QVariant::Type type = qDecodePSQLType(ptype);
- const char *val = PQgetvalue(d->result, currentRow, i);
if (PQgetisnull(d->result, currentRow, i))
return QVariant(type);
+ const char *val = PQgetvalue(d->result, currentRow, i);
switch (type) {
case QVariant::Bool:
return QVariant((bool)(val[0] == 't'));
@@ -742,7 +742,6 @@ bool QPSQLResult::isNull(int field)
{
Q_D(const QPSQLResult);
const int currentRow = isForwardOnly() ? 0 : at();
- PQgetvalue(d->result, currentRow, field);
return PQgetisnull(d->result, currentRow, field);
}