The ModelTableExpr method in the existing implementation simply overwrites the table name in the FROM clause, but not the table name used as the column name prefix in the SELECT clause (such as SELECT users.name). Therefore, the Insert, Update, and Delete processes were fine, but the Select process was not working as expected.
What's changed
1. add Table Parser
Extract table names and aliases from queries passed as arguments to ModelTableExpr method.
2. Update columns builder of select query
Consider the table name specified in ModelTableExpr when constructing columns in the SELECT clause.
Overview
This PR fixes #968.
The ModelTableExpr method in the existing implementation simply overwrites the table name in the FROM clause, but not the table name used as the column name prefix in the SELECT clause (such as SELECT users.name). Therefore, the Insert, Update, and Delete processes were fine, but the Select process was not working as expected.
What's changed
1. add Table Parser
Extract table names and aliases from queries passed as arguments to ModelTableExpr method.
2. Update columns builder of select query
Consider the table name specified in ModelTableExpr when constructing columns in the SELECT clause.