PHP-MySQLi-Database-Class
PHP-MySQLi-Database-Class copied to clipboard
Fix rawAddPrefix() to add prefix to all tables in raw query
In the rawAddPrefix function, the prefix is added only to the first table in the query, if we have join and ... in the query, the prefix must be added to the names of all tables.
For example, query
select t1.id as post_id, t2.id as bot_id from posts as t1 inner join bots as t2 on t1.bot_id = t2.id
is converted to
select t1.id as post_id, t2.id as bot_id from tbl_posts as t1 inner join bots as t2 on t1.bot_id = t2.id
when it should be converted to
select t1.id as post_id, t2.id as bot_id from tbl_posts as t1 inner join tbl_bots as t2 on t1.bot_id = t2.id
This issue is resolved in this change.