I don't think this can work. I found it best for me to remove rawAddPrefix function.
I had a longer query, and the preg_match_all gave me two identical table names.
In the loop it was run twice, so, for example i had, tbl_cars, and then tbl_tbl_cars.
I tried to use array unique on the $table array, and it was all ok, everything looked ok.
But then, i realized i had a field name in the query, that contained the table name, sometihng like cars_id.
And even with array unique on the $table array, i was getting SELECT tbl_cars.tbl_cars_id instead of tbl_cars.cars_id.
It can probably can be fixed, because i think you allways have a . (dot) before the column name, but i have no ideea what else can happend after this so i disabled this function.
If anyone needs it, it could work, if you are carefull and dont use the table name in any of the field names.
I don't think this can work. I found it best for me to remove rawAddPrefix function. I had a longer query, and the preg_match_all gave me two identical table names. In the loop it was run twice, so, for example i had, tbl_cars, and then tbl_tbl_cars. I tried to use array unique on the $table array, and it was all ok, everything looked ok. But then, i realized i had a field name in the query, that contained the table name, sometihng like cars_id. And even with array unique on the $table array, i was getting SELECT tbl_cars.tbl_cars_id instead of tbl_cars.cars_id. It can probably can be fixed, because i think you allways have a . (dot) before the column name, but i have no ideea what else can happend after this so i disabled this function.
If anyone needs it, it could work, if you are carefull and dont use the table name in any of the field names.
It's something on these lines,