3131 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3232 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3333 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34- *
34+ *
3535 * @author André Rothe <andre.rothe@phosco.info>
3636 * @copyright 2010-2014 Justin Swanhart and André Rothe
3737 * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
3838 * @version SVN: $Id$
39- *
39+ *
4040 */
4141
4242namespace PHPSQLParser \builders ;
4343use PHPSQLParser \exceptions \UnableToCreateSQLException ;
4444
4545/**
46- * This class implements the references clause within a JOIN.
46+ * This class implements the references clause within a JOIN.
4747 * You can overwrite all functions to achieve another handling.
4848 *
4949 * @author André Rothe <andre.rothe@phosco.info>
5050 * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
51- *
51+ *
5252 */
5353class RefClauseBuilder implements Builder {
5454
@@ -86,7 +86,12 @@ protected function buildColumnList($parsed) {
8686 $ builder = new ColumnListBuilder ();
8787 return $ builder ->build ($ parsed );
8888 }
89-
89+
90+ protected function buildSubQuery ($ parsed ) {
91+ $ builder = new SubQueryBuilder ();
92+ return $ builder ->build ($ parsed );
93+ }
94+
9095 public function build (array $ parsed ) {
9196 if ($ parsed === false ) {
9297 return '' ;
@@ -101,6 +106,7 @@ public function build(array $parsed) {
101106 $ sql .= $ this ->buildBracketExpression ($ v );
102107 $ sql .= $ this ->buildInList ($ v );
103108 $ sql .= $ this ->buildColumnList ($ v );
109+ $ sql .= $ this ->buildSubQuery ($ v );
104110
105111 if ($ len == strlen ($ sql )) {
106112 throw new UnableToCreateSQLException ('expression ref_clause ' , $ k , $ v , 'expr_type ' );
0 commit comments