Example #1
0
        public void GenSqlDef(ISqlDumper dmp)
        {
            int sources = 0;

            if (TableOrView != null)
            {
                sources++;
            }
            if (SubQuery != null)
            {
                sources++;
            }
            if (SubQueryString != null)
            {
                sources++;
            }
            if (sources != 1)
            {
                throw new Exception("DBSH-00095 DmlfSource should have exactly one source");
            }

            if (TableOrView != null)
            {
                dmp.Put("%l%f", LinkedInfo, TableOrView);
            }
            if (SubQuery != null)
            {
                dmp.Put("(");
                SubQuery.GenSql(dmp);
                dmp.Put(")");
            }
            if (SubQueryString != null)
            {
                dmp.Put("(");
                dmp.WriteRaw(SubQueryString);
                dmp.Put(")");
            }
            if (Alias != null)
            {
                dmp.Put(" %i", Alias);
            }
            if (WithNoLock)
            {
                dmp.Put(" ^with (^nolock)");
            }
        }