예제 #1
0
        public HighChart[] BahaGetOneGame(string game, string startDate, string endDate)
        {
            var gameList  = game.Split(',');
            var chartList = new HighChart[gameList.Length];
            var client    = ThriftTool.GetClient("default", ref _transport);

            for (var i = 0; i < gameList.Length; i++)
            {
                var       rank      = new List <ScoreList>();
                CqlResult cqlResult = client.execute_cql_query(ThriftTool.ToByte("select * from BahamutGames where Title='" + gameList[i] + "'"), Compression.NONE);

                foreach (CqlRow t in cqlResult.Rows)
                {
                    var rl = new ScoreList();
                    foreach (var col in t.Columns)
                    {
                        var name = ThriftTool.ToString(col.Name);
                        switch (name)
                        {
                        case "Title":
                            rl.Title = ThriftTool.ToString(col.Value);
                            break;

                        case "Link":
                            rl.Link = ThriftTool.ToString(col.Value);
                            break;

                        case "Article":
                            rl.Article = ThriftTool.ToString(col.Value);
                            break;

                        case "Popular":
                            rl.Popular = ThriftTool.ToString(col.Value);
                            break;

                        case "Date":
                            rl.Date = ThriftTool.ToInt(col.Value);
                            break;
                        }
                    }
                    rank.Add(rl);
                }

                var ranks = from n in rank orderby n.Date select n;

                chartList[i] = ParseToHighChart(ranks);
            }
            ThriftTool.TransportClose(ref _transport);

            return(chartList);
        }
예제 #2
0
        static int GetCfCount(string cf, int limit)
        {
            var sqlStr = "select count(*) from \"M01UserRelaction\" limit 400000";
            //var sqlStr = "Select count(*) from '" + cf + "' limit " + limit;
            CqlResult n1Result = ThriftTool.GetByCql(sqlStr);

            Console.WriteLine("Type=" + n1Result.Type);
            Console.WriteLine("Num=" + n1Result.Num);
            foreach (var row in n1Result.Rows)
            {
                Console.WriteLine("row.Key=" + ThriftTool.ToString(row.Key));
                Console.WriteLine("row.Columns.Count=" + row.Columns.Count);
                foreach (var col in row.Columns)
                {
                    Console.WriteLine("Type=" + col.Value.GetType());
                    Console.WriteLine("\tcol.Name=" + ThriftTool.ToString(col.Name));
                    Console.WriteLine("\tcol.Value=" + ThriftTool.ToLong(col.Value));
                }
            }

            return(ThriftTool.ToInt(n1Result.Rows.First().Columns.First().Value));
        }