Ejemplo n.º 1
0
        public async Task <SqlQueryRunner.RunQueryResults> RunQuery([FromBody] RunQueryParams param)
        {
            var cs    = ConnectionStringsProvider.GetById(param.conn_string_id);
            var query = await SqlQueryRunner.RunQuery(cs, param.query_text, param.slow);

            return(query);
        }
Ejemplo n.º 2
0
        public async Task <Table[]> GetConnectionStrings([FromUri] string conn_string_id)
        {
            var query = @"
					SELECT '['  +TABLE_CATALOG + '].['  + TABLE_SCHEMA + '].[' + TABLE_NAME + ']' as table_name, '[' + COLUMN_NAME + ']' as name, DATA_TYPE as type
					FROM INFORMATION_SCHEMA.COLUMNS
					ORDER BY table_name
			"            ;
            var cs    = ConnectionStringsProvider.GetById(conn_string_id).value;

            return((await Utils.GetDictsFromQuery(query, cs))
                   .GroupBy(x => x["table_name"] as string)
                   .Select(x => new Table
            {
                name = x.Key,
                fields = x.Select(f => f.ToObject <Table.Field>()).ToArray()
            })
                   .ToArray());
        }