It is very strange to me. If the table has no columns, query->exec() should return false. The list of the record columns showed 3 names.
Either the code shown is different from the real code or MySQL is behaving strangely.
That was my thought too, but the OP claims everything is working except for the missing columns. There is no code to show how "query" is being created and used prior to the code snippet given in the first post..