Beispiel #1
0
        //public static List<string> GetBaseColumns(this IEnumerable<DmlfColumnRef> cols)
        //{
        //    var res = new List<string>();
        //    foreach (var col in cols)
        //    {
        //        if (col.Source != null && col.Source.Alias != "basetbl") continue;
        //        res.Add(col.ColumnName);
        //    }
        //    return res;
        //}

        //public static int GetBaseOrdinal(this IEnumerable<DmlfColumnRef> cols, string colname)
        //{
        //    int index = 0;
        //    foreach (var col in cols)
        //    {
        //        if (col.Source == null || col.Source.Alias == "basetbl")
        //        {
        //            if (col.ColumnName == colname) return index;
        //        }
        //        index++;
        //    }
        //    return -1;
        //}

        public static string ToSql(this IDmlfNode node, ISqlDialect dialect, IDmlfHandler handler)
        {
            var sw  = new StringWriter();
            var dmp = dialect.CreateDumper(sw);

            node.GenSql(dmp, handler);
            return(sw.ToString());
        }
Beispiel #2
0
        public static string ToSql(this IDmlfNode node, IDatabaseFactory factory)
        {
            if (factory == null)
            {
                return("");
            }
            var sw  = new StringWriter();
            var dmp = factory.CreateDumper(new SqlOutputStream(factory.CreateDialect(), sw, SqlFormatProperties.Default), SqlFormatProperties.Default);

            node.GenSql(dmp);
            return(sw.ToString());
        }