MXS-1340 Report true table and not alias name
With this change, for a statement like SELECT t2.a FROM t1 t2; the affected field is reported as t1.a and not as t2.a, as it was before. For a statement like SELECT t.f FROM d.t; qc_mysqlembedded will now return "d.t.f" as the affected field, while qc_sqlite will still return "t.f" as both implementations did before. In qc_mysqlembedded's case that is a side-effect of the alias handling. To get qc_sqlite to return the same (which would be good), the table names would have to be collected in a smarter way than they are now.
This commit is contained in:
@ -514,6 +514,8 @@ public:
|
||||
{
|
||||
ss_dassert(zColumn);
|
||||
|
||||
// NOTE: This must be first, so that the type mask is properly updated
|
||||
// NOTE: in case zColumn is "currval" etc.
|
||||
if (is_sequence_related_field(zDatabase, zTable, zColumn))
|
||||
{
|
||||
m_type_mask |= QUERY_TYPE_WRITE;
|
||||
@ -527,6 +529,19 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (!zDatabase && zTable)
|
||||
{
|
||||
Aliases::const_iterator i = m_aliases.find(zTable);
|
||||
|
||||
if (i != m_aliases.end())
|
||||
{
|
||||
const QcAliasValue& value = i->second;
|
||||
|
||||
zDatabase = value.zDatabase;
|
||||
zTable = value.zTable;
|
||||
}
|
||||
}
|
||||
|
||||
QC_FIELD_INFO item = { (char*)zDatabase, (char*)zTable, (char*)zColumn, usage };
|
||||
|
||||
size_t i;
|
||||
|
Reference in New Issue
Block a user