} // toStringNoAlias()

        private void appendJoinOnItem(StringBuilder sb, String sideAlias, SelectItem onItem)
        {
            FromItem fromItem = onItem.getFromItem();

            if (fromItem != null && fromItem.getSubQuery() != null && fromItem.getAlias() != null)
            {
                // there's a corner case scenario where an ON item references a
                // subquery being joined. In that case the getSuperQueryAlias()
                // method will include the subquery alias.
                string super_query_alias = onItem.getSuperQueryAlias();
                sb.Append(super_query_alias);
                return;
            }

            if (_join != JoinType.None && _leftSide.getJoin() != JoinType.None)
            {
                sb.Append(onItem.toSql());
                return;
            }

            if (sideAlias != null)
            {
                sb.Append(sideAlias);
                sb.Append('.');
            }
            String superQueryAlias = onItem.getSuperQueryAlias();

            sb.Append(superQueryAlias);
        } // appendJoinOnItem()
Example #2
0
        public StringBuilder toStringNoAlias(bool?includeSchemaInColumnPath)
        {
            StringBuilder sb = new StringBuilder();

            if (_column != null)
            {
                sb.Append(getToStringColumnPrefix(includeSchemaInColumnPath));
                sb.Append(_column.getQuotedName());
            }
            if (_expression != null)
            {
                sb.Append(_expression);
            }
            if (_fromItem != null && _subQuerySelectItem != null)
            {
                if (_fromItem.getAlias() != null)
                {
                    sb.Append(_fromItem.getAlias() + '.');
                }
                sb.Append(_subQuerySelectItem.getSuperQueryAlias());
            }
            if (_function != null)
            {
                StringBuilder functionBeginning = new StringBuilder();
                if (_functionApproximationAllowed)
                {
                    functionBeginning.Append(FUNCTION_APPROXIMATION_PREFIX);
                }

                functionBeginning.Append(_function.getFunctionName());
                functionBeginning.Append('(');
                object[] functionParameters = getFunctionParameters();
                if (functionParameters != null && functionParameters.Length != 0)
                {
                    for (int i = 0; i < functionParameters.Length; i++)
                    {
                        functionBeginning.Append('\'');
                        functionBeginning.Append(functionParameters[i]);
                        functionBeginning.Append('\'');
                        functionBeginning.Append(',');
                    }
                }
                sb.Insert(0, functionBeginning.ToString());
                sb.Append(")");
            }
            return(sb);
        } // toStringNoAlias()