/// <exception cref="System.Exception" />
 public override void Route(SchemaConfig schema, int loop, string sql)
 {
     for (var i = 0; i < loop; ++i)
     {
         // SQLLexer lexer = new SQLLexer(sql);
         // DmlSelectStatement select = new DmlSelectParser(lexer, new
         // SQLExprParser(lexer)).select();
         // PartitionKeyVisitor visitor = new
         // PartitionKeyVisitor(schema.getTablesSpace());
         // select.accept(visitor);
         // visitor.getColumnValue();
         ServerRouter.Route(schema, sql, null, null);
     }
 }
 /// <exception cref="System.Exception" />
 public abstract void Route(SchemaConfig schema, int loop, string sql);
 /// <exception cref="System.Exception" />
 public override void Route(SchemaConfig schema, int loop, string sql)
 {
     for (var i = 0; i < loop; ++i)
     {
         for (var j = 0; j < 128; ++j)
         {
             var sb = new StringBuilder();
             insert.Accept(new MySqlOutputAstVisitor(sb));
             sb.ToString();
         }
     }
 }
 /// <exception cref="System.Exception" />
 public override void Route(SchemaConfig schema, int loop, string sql)
 {
     for (var i = 0; i < loop; ++i)
     {
         var lexer = new MySqlLexer(sql);
         var insert = new MySqlDmlInsertParser(lexer, new MySqlExprParser(lexer)).Insert();
     }
 }
 /// <exception cref="System.Exception" />
 public override void Route(SchemaConfig schema, int loop, string sql)
 {
     for (var i = 0; i < loop; ++i)
     {
         var lexer = new MySqlLexer(sql);
         var select = new MySqlDmlSelectParser(lexer, new MySqlExprParser(lexer)).Select();
         var visitor = new PartitionKeyVisitor(schema.Tables);
         select.Accept(visitor);
     }
 }
        private void LoadSchemas(XmlElement root)
        {
            var list = root.GetElementsByTagName("schema");
            XmlElement schemaElement = null;
            IDictionary<string, TableConfig> tables = null;
            for (int i = 0, n = list.Count; i < n; i++)
            {
                schemaElement = (XmlElement)list.Item(i);
                var name = schemaElement.GetAttribute("name");
                var dataNode = schemaElement.GetAttribute("dataNode");
                // 在非空的情况下检查dataNode是否存在
                if (dataNode != null && dataNode.Length != 0)
                {
                    CheckDataNodeExists(dataNode);
                }
                else
                {
                    dataNode = string.Empty;
                }

                // 确保非空
                var group = "default";
                if (schemaElement.HasAttribute("group"))
                {
                    group = schemaElement.GetAttribute("group").Trim();
                }
                tables = LoadTables(schemaElement);
                if (schemas.ContainsKey(name))
                {
                    throw new ConfigException("schema " + name + " duplicated!");
                }

                var keepSqlSchema = false;
                if (schemaElement.HasAttribute("keepSqlSchema"))
                {
                    keepSqlSchema = bool.Parse(schemaElement.GetAttribute("keepSqlSchema").Trim());
                }
                schemas[name] = new SchemaConfig(name, dataNode, group, keepSqlSchema, tables);
            }
        }