Adding subtable columns to query causes an error

Wappler Version : 5.4.1
Operating System : 12.6.1
Server Model: PHP
Database Type: MySQL
Hosting Type: Docker

What do you think should happen?

Adding a subtable’s columns to a query should not cause an error.

What actually happens?

Adding the subtable columns causes the following message:
“Undefined property: stdClass::$sub”

How to reproduce

In my case, I have a “users” table in which I have created a “roles” table. When adding the users table to a query with INNER or LEFT JOIN and adding the roles table to the columns, I get the above error. I noticed that other user table columns get added with the proper alias name like “participants_table.id” etc. but the roles table gets added as “users.roles” (see screenshot) so I removed the alias so they would all be added as users.column_name and users.role, but that didn’t help. Perhaps this is not supported, but I could have sworn that I’ve done it this way before.

Does it also give some stack information like the filename and linenumber where the error was generated?

I have a similar bug report.

Thanks for the quick reply @Patrick and @kfawcett. I didn’t see the other bug report, my apologies.

Is this what you’re looking for Patrick?

{“code”:0,“file”:"/var/www/html/dmxConnectLib/modules/dbconnector.php",“line”:259,“message”:“Undefined property: stdClass::$sub”,“trace”:"#0 /var/www/html/dmxConnectLib/modules/dbconnector.php(259): exception_error_handler(8, ‘Undefined prope…’, ‘/var/www/html/d…’, 259, Array)\n#1 /var/www/html/dmxConnectLib/lib/App.php(197): modules\dbconnector->paged(Object(stdClass), ‘qCompetitors’, Array)\n#2 /var/www/html/dmxConnectLib/lib/App.php(137): lib\App->execSteps(Object(stdClass))\n#3 /var/www/html/dmxConnectLib/lib/App.php(126): lib\App->exec(Object(stdClass), false)\n#4 /var/www/html/dmxConnectLib/lib/App.php(104): lib\App->exec(Object(stdClass))\n#5 /var/www/html/dmxConnect/api/teams/getCompetitors.php(8): lib\App->define(Object(stdClass))\n#6 {main}"}

Do you have a JOIN in the query and is the sub table on the joined table?

Yes it is in the joined table.

Thx, that helped me finding the issue.

Here an update: dbconnector.zip (2.5 KB) unzip to dmxConnectLib/modules.

1 Like

Looks like that fixed it. Thank you!

@kfawcett, see if that works for you as well.

It fixed my issue as well. :slight_smile:

1 Like

Fixed in Wappler 5.4.2