summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/mysql
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2017-05-19 15:31:46 +0200
committerAndy Shaw <andy.shaw@qt.io>2017-07-12 09:01:50 +0000
commit0843c6ca7fe604d8c44b9a81b8fcb072ab424172 (patch)
treee6784759b9dd8729d5bd179a38552170e084a723 /src/plugins/sqldrivers/mysql
parent9423be1f190bd7cdeb04add39f4ec621a33a3041 (diff)
QSqlField: Add a means to see what the tablename is for a given field
When you are using a query that pulls from a number of different tables then it can be ambiguous as to which table a particular field belongs to. So this will make it possible to determine the table that a given field belongs to if it is set. Task-number: QTBUG-7170 Change-Id: I49b7890c0523d81272a153df3860df800ff853d5 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/plugins/sqldrivers/mysql')
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index ee439fa33e..3dc0e73af5 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -331,7 +331,8 @@ static QVariant::Type qDecodeMYSQLType(int mysqltype, uint flags)
static QSqlField qToField(MYSQL_FIELD *field, QTextCodec *tc)
{
QSqlField f(toUnicode(tc, field->name),
- qDecodeMYSQLType(int(field->type), field->flags));
+ qDecodeMYSQLType(int(field->type), field->flags),
+ toUnicode(tc, field->table));
f.setRequired(IS_NOT_NULL(field->flags));
f.setLength(field->length);
f.setPrecision(field->decimals);