Exemple #1
0
        public override IJoinSourceQueryBuilder <TRecord> Join(IAliasedSelectSource source, JoinType joinType, CommandParameterValues parameterValues, Parameters parameters, ParameterDefaults parameterDefaults)
        {
            if (clauses.Count == 0)
            {
                throw new InvalidOperationException("Must have at least one 'ON' clause per join");
            }

            intermediateJoins.Add(new Join(clauses.ToList(), joinSource, type));
            clauses    = new List <JoinClause>();
            joinSource = source;
            type       = joinType;

            var commandParameterValues    = new CommandParameterValues(ParamValues, parameterValues);
            var combinedParameters        = new Parameters(Params, parameters);
            var combinedParameterDefaults = new ParameterDefaults(ParamDefaults, parameterDefaults);

            ParamValues.Clear();
            ParamValues.AddRange(commandParameterValues);
            Params.Clear();
            Params.AddRange(combinedParameters);
            ParamDefaults.Clear();
            ParamDefaults.AddRange(combinedParameterDefaults);

            return(this);
        }
Exemple #2
0
 public SubquerySourceBuilder(ISelect select,
                              IReadQueryExecutor readQueryExecutor,
                              ITableAliasGenerator tableAliasGenerator,
                              IUniqueParameterNameGenerator uniqueParameterNameGenerator,
                              CommandParameterValues parameterValues,
                              Parameters parameters,
                              ParameterDefaults parameterDefaults)
     : base(readQueryExecutor, tableAliasGenerator, uniqueParameterNameGenerator, parameterValues, parameters, parameterDefaults)
 {
     this.select = select;
 }
Exemple #3
0
        public Function(ISelect @select, Parameters parameters, ParameterDefaults defaults, string functionName)
        {
            if (parameters.Any(p => p.DataType == null))
            {
                throw new ArgumentException("All parameters must have data types");
            }

            this.select       = @select;
            this.parameters   = parameters;
            this.defaults     = defaults;
            this.functionName = functionName;
        }
        public StoredProcedure(ISelect select, Parameters parameters, ParameterDefaults defaults, string procedureName)
        {
            if (parameters.Any(p => p.DataType == null))
            {
                throw new ArgumentException("All parameters must have data types");
            }

            this.select        = select;
            this.parameters    = parameters;
            this.defaults      = defaults;
            this.procedureName = procedureName;
        }
Exemple #5
0
 public TableSourceQueryBuilder(string tableOrViewName,
                                string schemaName,
                                IReadTransaction readQueryExecutor,
                                ITableAliasGenerator tableAliasGenerator,
                                IUniqueParameterNameGenerator uniqueParameterNameGenerator,
                                CommandParameterValues parameterValues,
                                Parameters parameters,
                                ParameterDefaults parameterDefaults)
     : base(readQueryExecutor, tableAliasGenerator, uniqueParameterNameGenerator, parameterValues, parameters, parameterDefaults)
 {
     this.schemaName      = schemaName;
     this.tableOrViewName = tableOrViewName;
 }
Exemple #6
0
 protected SourceQueryBuilder(IReadQueryExecutor readQueryExecutor,
                              ITableAliasGenerator tableAliasGenerator,
                              IUniqueParameterNameGenerator uniqueParameterNameGenerator,
                              CommandParameterValues parameterValues,
                              Parameters parameters,
                              ParameterDefaults parameterDefaults)
 {
     ReadQueryExecutor            = readQueryExecutor;
     TableAliasGenerator          = tableAliasGenerator;
     UniqueParameterNameGenerator = uniqueParameterNameGenerator;
     ParamValues   = parameterValues;
     Params        = parameters;
     ParamDefaults = parameterDefaults;
 }
Exemple #7
0
 public QueryBuilder(TSelectBuilder selectBuilder,
                     IReadQueryExecutor readQueryExecutor,
                     ITableAliasGenerator tableAliasGenerator,
                     IUniqueParameterNameGenerator uniqueParameterNameGenerator,
                     CommandParameterValues paramValues,
                     Parameters @params,
                     ParameterDefaults paramDefaults)
 {
     this.selectBuilder                = selectBuilder;
     this.readQueryExecutor            = readQueryExecutor;
     this.tableAliasGenerator          = tableAliasGenerator;
     this.uniqueParameterNameGenerator = uniqueParameterNameGenerator;
     this.paramValues   = paramValues;
     this.@params       = @params;
     this.paramDefaults = paramDefaults;
 }
Exemple #8
0
 public JoinSourceQueryBuilder(IAliasedSelectSource originalSource,
                               JoinType joinType,
                               IAliasedSelectSource nextJoin,
                               IReadQueryExecutor readQueryExecutor,
                               ITableAliasGenerator tableAliasGenerator,
                               IUniqueParameterNameGenerator uniqueParameterNameGenerator,
                               CommandParameterValues parameterValues,
                               Parameters parameters,
                               ParameterDefaults parameterDefaults)
     : base(readQueryExecutor, tableAliasGenerator, uniqueParameterNameGenerator, parameterValues, parameters, parameterDefaults)
 {
     this.originalSource = originalSource;
     clauses             = new List <JoinClause>();
     joinSource          = nextJoin;
     type = joinType;
 }
Exemple #9
0
        public IJoinSourceQueryBuilder <TRecord> Join(IAliasedSelectSource source, JoinType joinType, CommandParameterValues parameterValues, Parameters parameters, ParameterDefaults parameterDefaults)
        {
            var subquery = new SubquerySource(selectBuilder.GenerateSelectWithoutDefaultOrderBy(), tableAliasGenerator.GenerateTableAlias());

            return(new JoinSourceQueryBuilder <TRecord>(subquery,
                                                        joinType,
                                                        source,
                                                        readQueryExecutor,
                                                        tableAliasGenerator,
                                                        uniqueParameterNameGenerator,
                                                        new CommandParameterValues(ParameterValues, parameterValues),
                                                        new Parameters(Parameters, parameters),
                                                        new ParameterDefaults(ParameterDefaults, parameterDefaults)));
        }
        private void ParamSection()
        {
            if (PaddedBoxGS == null)
            {
                PaddedBoxGS = new GUIStyle((GUIStyle)"HelpBox")
                {
                    normal = ((GUIStyle)"GroupBox").normal, padding = new RectOffset(4, 4, 4, 4)
                }
            }
            ;

            if (PaddedGS == null)
            {
                PaddedGS = new GUIStyle(PaddedBoxGS)
                {
                    normal = ((GUIStyle)"MiniLabel").normal
                }
            }
            ;

            t.useGlobalParamSettings = EditorGUILayout.ToggleLeft("Use Global Settings", t.useGlobalParamSettings);

            showAdvancedParams[uid] = IndentedFoldout(new GUIContent("Adv. Parameter Settings"), showAdvancedParams[uid], 1);

            if (showAdvancedParams[uid])
            {
                var indenthold = EditorGUI.indentLevel;

                EditorGUI.indentLevel = 0;
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.GetControlRect(GUILayout.MinWidth(COL1));
                EditorGUILayout.LabelField(label_Interp, (GUIStyle)"MiniLabel", GUILayout.MaxWidth(COL2));
                EditorGUILayout.LabelField(label_Extrap, (GUIStyle)"MiniLabel", GUILayout.MaxWidth(COL3));
                EditorGUILayout.LabelField(label_Default, (GUIStyle)"MiniLabel", GUILayout.MaxWidth(COL4));
                EditorGUILayout.EndHorizontal();

                ParameterDefaults defs = t.sharedParamDefaults;

                if (t.useGlobalParamSettings)
                {
                    EditorGUILayout.BeginHorizontal();
                    InspectorWidgets.MiniToggle(t, EditorGUILayout.GetControlRect(GUILayout.MinWidth(COL1)), new GUIContent("Ints"), ref defs.includeInts);
                    DrawInterp(AnimatorControllerParameterType.Int, ref defs.interpolateInts);
                    DrawExtrap(AnimatorControllerParameterType.Int, ref defs.extrapolateInts);
                    DrawDefaults(AnimatorControllerParameterType.Int, ref defs.defaultInt);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    InspectorWidgets.MiniToggle(t, EditorGUILayout.GetControlRect(GUILayout.MinWidth(COL1)), new GUIContent("Floats"), ref defs.includeFloats);
                    DrawInterp(AnimatorControllerParameterType.Float, ref defs.interpolateFloats);
                    DrawExtrap(AnimatorControllerParameterType.Float, ref defs.extrapolateFloats);
                    DrawDefaults(AnimatorControllerParameterType.Float, ref defs.defaultFloat);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    InspectorWidgets.MiniToggle(t, EditorGUILayout.GetControlRect(GUILayout.MinWidth(COL1)), new GUIContent("Bools"), ref defs.includeBools);
                    EditorGUILayout.GetControlRect(GUILayout.MaxWidth(COL2));
                    DrawExtrap(AnimatorControllerParameterType.Bool, ref defs.extrapolateBools);
                    DrawDefaults(AnimatorControllerParameterType.Bool, ref defs.defaultBool);
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    var tr = EditorGUILayout.GetControlRect(GUILayout.MinWidth(COL1));
                    InspectorWidgets.MiniToggle(t, tr, triggerLabel, ref defs.includeTriggers);
                    if (t.sharedParamDefaults.includeTriggers)
                    {
                        GUI.DrawTexture(new Rect(tr)
                        {
                            x = 2, width = 16
                        }, EditorGUIUtility.FindTexture("console.warnicon"));
                    }
                    EditorGUILayout.GetControlRect(GUILayout.MaxWidth(COL2));
                    DrawExtrap(AnimatorControllerParameterType.Trigger, ref defs.extrapolateTriggers);
                    DrawDefaults(AnimatorControllerParameterType.Trigger, ref defs.defaultTrigger);
                    EditorGUILayout.EndHorizontal();
                }
                else
                {
                    var names = ParameterSettings.RebuildParamSettings(a, ref t.sharedParamSettings, ref t.paramCount, t.sharedParamDefaults);
                    serializedObject.Update();

                    var pms = t.sharedParamSettings;
                    for (int i = 0; i < t.paramCount; ++i)
                    {
                        var pm = pms[i];

                        EditorGUILayout.BeginHorizontal();

                        // Type Letter Box (left vertical)
                        EditorGUILayout.BeginVertical(PaddedBoxGS, GUILayout.MaxWidth(8));
                        TypeLabel(EditorGUILayout.GetControlRect(GUILayout.MaxWidth(12)), pm.paramType);

                        EditorGUILayout.EndVertical();

                        // Main Vertical (Right)
                        EditorGUILayout.BeginVertical((pm.include) ? PaddedBoxGS : PaddedGS);

                        EditorGUILayout.BeginHorizontal();

                        InspectorWidgets.MiniToggle(t, EditorGUILayout.GetControlRect(GUILayout.MinWidth(COL1)), new GUIContent(names[i]), ref pm.include);

                        EditorGUI.BeginDisabledGroup(!pm.include);
                        DrawInterp(pm.paramType, ref pm.interpolate);
                        DrawExtrap(pm.paramType, ref pm.extrapolate);
                        DrawDefaults(pm.paramType, ref pm.defaultValue);
                        EditorGUI.EndDisabledGroup();

                        EditorGUILayout.EndHorizontal();

                        // Compression Row
                        if (pm.include)
                        {
                            if (pm.paramType == AnimatorControllerParameterType.Float || pm.paramType == AnimatorControllerParameterType.Int)
                            {
                                var sharedPSs = serializedObject.FindProperty("sharedParamSettings");
                                var ps        = sharedPSs.GetArrayElementAtIndex(i);

                                var fcrusher = (pm.paramType == AnimatorControllerParameterType.Float) ? ps.FindPropertyRelative("fcrusher") : ps.FindPropertyRelative("icrusher");

                                var r = EditorGUILayout.GetControlRect(false, EditorGUI.GetPropertyHeight(fcrusher));

                                Rect rectCrusher = new Rect(r)
                                {
                                    height = 16
                                };
                                EditorGUI.PropertyField(rectCrusher, fcrusher);
                            }
                        }

                        // End Right Vertical
                        EditorGUILayout.EndVertical();

                        // End Parameter
                        EditorGUILayout.EndHorizontal();
                    }
                }

                EditorGUI.indentLevel = indenthold;
            }
        }
Exemple #11
0
 public override IJoinSourceQueryBuilder <TRecord> Join(IAliasedSelectSource source, JoinType joinType, CommandParameterValues parameterValues, Parameters parameters, ParameterDefaults parameterDefaults)
 {
     return(new JoinSourceQueryBuilder <TRecord>(AsSource(),
                                                 joinType,
                                                 source,
                                                 ReadQueryExecutor,
                                                 TableAliasGenerator,
                                                 UniqueParameterNameGenerator,
                                                 new CommandParameterValues(ParamValues, parameterValues),
                                                 new Parameters(Params, parameters),
                                                 new ParameterDefaults(ParamDefaults, parameterDefaults)));
 }
Exemple #12
0
 public abstract IJoinSourceQueryBuilder <TRecord> Join(IAliasedSelectSource source, JoinType joinType, CommandParameterValues parameterValues, Parameters parameters, ParameterDefaults parameterDefaults);