summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHuang Jie <huangjie@uniontech.com>2020-11-03 13:57:37 +0800
committerAndy Shaw <andy.shaw@qt.io>2020-11-24 03:10:55 +0000
commit29fca29d1c448d563162e3daabb21f6e877ff07c (patch)
treea8fec4e41aa255c641fd3d47d88998c7618acd51 /src
parent1fcc882d7ca564f17e49b8d51adc43eb5b97c57b (diff)
Reduce the scope of variables in bindInValues()
The scope of the variables 'bind', 'field', 'i' can be reduced if the variable 'meta' is a null pointer. So declare the variables when the variable 'meta' is valid. Change-Id: I599406c034168dd73799c69dfb9c5e676861cdf2 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index 04a2df9ac5..7d945f23fc 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -317,15 +317,14 @@ void QMYSQLResultPrivate::bindBlobs()
bool QMYSQLResultPrivate::bindInValues()
{
- MYSQL_BIND *bind;
- char *field;
- int i = 0;
-
if (!meta)
meta = mysql_stmt_result_metadata(stmt);
if (!meta)
return false;
+ MYSQL_BIND *bind;
+ char *field;
+ int i = 0;
fields.resize(mysql_num_fields(meta));
inBinds = new MYSQL_BIND[fields.size()];