Esempio n. 1
0
        private string MinTableName(ExpressionSqlBuilder builder)
        {
            string      res;
            TableClause tc1 = this.TableClause;

            if (!(tc1.Table is TableDesc))
            {
                throw new Exception("Can not find alias table " + tc1.Table.ToStr());
            }
            ITableSource item = this.FindParentTableSource();
            var          arr  = item.GetTables();

            if (arr.Length == 1 && arr[0] == tc1)
            {
                return("");
            }
            while (item != null)
            {
                res = DoMinTableName(builder, item, tc1);
                if (res != null)
                {
                    return(res);
                }
                var t = item.FindParentTableSource();
                if (t == item)
                {
                    throw new Exception("internal parser error (132)");
                }
                item = t;
            }
            throw new Exception("Table clause not found in expression");
        }