Пример #1
0
        public T select <T>(string sql) where T : new()
        {
            Dictionary <int, string> columns = GetColumnsBySql(sql);
            string data = null;

            try
            {
                transport.Open();
                client.execute(sql);
                data = client.fetchOne();
                transport.Close();
            }
            catch (Exception ex)
            {
                transport.Close();
                Console.WriteLine(ex.Message);
                LogService.LogService.Instance.Logger(ex.Message, "hive");
            }
            T result = ClassReflection.Get <T>(columns, data, ',');

            return(result);
        }
Пример #2
0
        public List <T> SelectList <T>(string sql) where T : new()
        {
            Dictionary <int, string> columns = GetColumnsBySql(sql);
            List <string>            result  = null;

            try
            {
                transport.Open();
                client.execute(sql);
                result = client.fetchAll();
                transport.Close();
            }
            catch (Exception ex)
            {
                transport.Close();
                Console.WriteLine(ex.Message);
                LogService.LogService.Instance.Logger(ex.Message, "hive");
            }
            List <T> list = ClassReflection.GetList <T>(columns, result, ',');

            return(list);
        }