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>
This commit is contained in:
Huang Jie 2020-11-03 13:57:37 +08:00 committed by Andy Shaw
parent 1fcc882d7c
commit 29fca29d1c

View File

@ -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()];