Exemple #1
0
        public IEnumerable <TemplateNodeInfo> GetSubnodesFor(TemplateNodeQueryInfo groupQuery)
        {
            Debug.Assert(IsInstance);
            Debug.Assert(GroupQueries.Contains(groupQuery));

            return(Template.Childs.Where(t => t.GroupSelectId == groupQuery.Id));
        }
Exemple #2
0
        public DataTable[] GetGroupSelectResultsFromServer(
            SqlProcessor sqlProcessor,
            InstanceInfo serverInstance,
            QueryInfo queryInfo,
            TemplateNodeQueryInfo query
            )
        {
            DataTable[] tables = null;
            ErrorInfo   error  = null;

            Debug.Assert(IsInstance);
            Debug.Assert(GroupQueries.Contains(query));

            var db = this._model.GetVaultProcessor(ConnectionGroup).CurrentStorage;

            InstanceTemplate settings = GetUserSettings();

            //looking for user settings for parameter values
            query.ReadParametersFrom(settings);

            try
            {
                tables = sqlProcessor.ExecuteSql(
                    serverInstance,
                    queryInfo,
                    GetDefaultDatabase(),
                    queryInfo.Parameters,
                    query.ParameterValues,
                    fromGroupSelect: true
                    );
            }
            catch (Exception ex)
            {
                error  = new ErrorInfo(ex);
                tables = null;
            }

            Int64?queryId = db.QueryGroupDirectory.GetQueryId(
                query.TemplateNode,
                query,
                serverInstance,
                DateTime.Now,
                false
                );

            db.SaveMeta(queryId, error, tables);

            if (tables != null && tables.Length < 0)
            {
                throw new InvalidTemplateException(query + " returned no recordsets.");
            }

            return(tables);
        }