Пример #1
0
        private string[] GenerateMostRestrictiveTableQueryTestHelper(string sql, bool includePrimaryKey, int top)
        {
            var cg = new MySqlCodeGenerator();
            cg.ResolveNames = true;

            var ss = CreateSelect(sql);

            var res = new List<string>();

            foreach (var qs in ss.EnumerateQuerySpecifications())
            {
                // TODO: use qs.SourceTableReferences
                foreach (var tr in qs.EnumerateSourceTableReferences(true))
                {
                    res.Add(cg.GenerateMostRestrictiveTableQuery(tr, includePrimaryKey, top));
                }
            }

            return res.ToArray();
        }
Пример #2
0
        private string GenerateCode(string query, bool resolved)
        {
            var ss = CreateSelect(query);
            var w = new StringWriter();

            var cg = new MySqlCodeGenerator();
            cg.ResolveNames = resolved;
            cg.Execute(w, ss);

            return w.ToString();
        }