/// <summary>
        /// This method will create a Select statement for all of the columns in the entity except for the ones passed in.
        /// This is very useful when you want to eliminate blobs and other fields for performance.
        /// </summary>
        /// <param name="columns">The columns which you wish to exclude from the Select statement</param>
        /// <returns></returns>
        override public esDynamicQuerySerializable SelectAllExcept(params esQueryItem[] columns)
        {
            foreach (esColumnMetadata col in this.Meta.Columns)
            {
                bool found = false;

                for (int i = 0; i < columns.Length; i++)
                {
                    if (col.Name == (string)columns[i])
                    {
                        found = true;
                        break;
                    }
                }

                if (found)
                {
                    continue;
                }

                esExpression item = new esQueryItem(this, col.Name, col.esType);
                this.Select(item);
            }

            return(this);
        }
Exemplo n.º 2
0
        private esQueryItem Alias(string alias)
        {
            esQueryItem item = null;

            foreach (esExpression exp in this.selectColumns)
            {
                if (exp.Column.Alias == alias)
                {
                    item              = new esQueryItem(this, alias, exp.Column.Datatype);
                    item.Column       = new esColumnItem();
                    item.Column.Query = this;
                    item.Column.Alias = alias;
                    item.Column.Name  = alias;
                }

                if (exp.OverClause != null)
                {
                    if (exp.OverClause.Alias == alias)
                    {
                        item                 = new esQueryItem(this, alias, esSystemType.Int32);
                        item.Column          = new esColumnItem();
                        item.Column.Datatype = exp.Column.Datatype;
                        item.Column.Query    = this;
                        item.Column.Alias    = alias;
                        item.Column.Name     = alias;
                    }
                }
            }

            return(item);
        }
Exemplo n.º 3
0
        public esCase Else(esQueryItem queryItem)
        {
            esExpression expression = queryItem;

            this.data.Else = expression;

            return(this);
        }
        /// <summary>
        /// This method will select all of the columns that were present when you generated your
        /// classes as opposed to doing a SELECT *
        /// </summary>
        /// <returns></returns>
        override public esDynamicQuerySerializable SelectAll()
        {
            foreach (esColumnMetadata col in this.Meta.Columns)
            {
                esQueryItem item = new esQueryItem(this, col.Name, col.esType);
                this.Select(item);
            }

            return(this);
        }
Exemplo n.º 5
0
        internal esQueryItem As(string alias, out esAlias aliasFunc)
        {
            aliasFunc = () =>
            {
                esQueryItem aliasedItem = new esQueryItem(this.query, alias, esSystemType.Unassigned);
                aliasedItem.Column.IsOutVar = true;
                return(aliasedItem);
            };

            _alias = alias;
            return(aliasFunc());
        }
        private void _selectAll()
        {
            if (this.m_selectAll)
            {
                foreach (esColumnMetadata col in this.Meta.Columns)
                {
                    esQueryItem item = new esQueryItem(this, col.Name, col.esType);
                    this.Select(item);
                }

                this.m_selectAll = false;
            }
        }
Exemplo n.º 7
0
        public esCase Then(esQueryItem queryItem)
        {
            esExpression expression = queryItem;

            esSimpleCaseData.esCaseClause clause = new esSimpleCaseData.esCaseClause();
            clause.When = this.WhenItem;
            clause.Then = expression;

            if (data.Cases == null)
            {
                data.Cases = new List <esSimpleCaseData.esCaseClause>();
            }

            this.data.Cases.Add(clause);

            return(this);
        }
 internal esDouble(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Double);
 }
Exemplo n.º 9
0
 internal esInt64(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Int64);
 }
        /// <summary>
        ///
        /// </summary>
        private void AssignProviderMetadata(esDynamicQuerySerializable query, List <esDynamicQuerySerializable> beenThere)
        {
            if (beenThere.Contains(query))
            {
                return;
            }

            beenThere.Add(query);

            esDynamicQuery theQuery = query as esDynamicQuery;
            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            if (theQuery != null)
            {
                esConnection conn = theQuery.es2.Connection;

                if (iQuery.ProviderMetadata == null)
                {
                    esProviderSpecificMetadata providerMetadata = theQuery.Meta.GetProviderMetadata(conn.ProviderMetadataKey);
                    iQuery.DataID           = theQuery.Meta.DataID;
                    iQuery.Columns          = theQuery.Meta.Columns;
                    iQuery.ProviderMetadata = providerMetadata;
                }

                iQuery.Catalog = conn.Catalog;
                iQuery.Schema  = conn.Schema;
            }

            // This code is for proxies as they are unable to work with column and provider metadata
            // until serialized back to the server
            if (iQuery.SelectAll)
            {
                foreach (esColumnMetadata col in (esColumnMetadataCollection)iQuery.Columns)
                {
                    esQueryItem item = new esQueryItem(this, col.Name, col.esType);
                    query.Select(item);
                }
            }
            else
            {
                List <esQueryItem> columns = iQuery.SelectAllExcept;

                if (columns != null)
                {
                    foreach (esColumnMetadata col in (esColumnMetadataCollection)iQuery.Columns)
                    {
                        bool found = false;

                        for (int i = 0; i < columns.Count; i++)
                        {
                            if (col.Name == (string)columns[i])
                            {
                                found = true;
                                break;
                            }
                        }

                        if (found)
                        {
                            continue;
                        }

                        esExpression item = new esQueryItem(this, col.Name, col.esType);
                        query.Select(item);
                    }
                }
            }

            foreach (esDynamicQuerySerializable subQuery in iQuery.queries.Values)
            {
                AssignProviderMetadata(subQuery, beenThere);
            }

            if (iQuery.InternalSetOperations != null)
            {
                foreach (esSetOperation setOperation in iQuery.InternalSetOperations)
                {
                    AssignProviderMetadata(setOperation.Query, beenThere);
                }
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// The Constructor
 /// </summary>
 public esCase(esDynamicQuerySerializable query, esQueryItem queryItem)
 {
     this.data.Query     = query;
     this.data.QueryItem = queryItem;
 }
 internal esBoolean(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Boolean);
 }
Exemplo n.º 13
0
 public esLagOver(esQueryItem expression, float offset = 1.0F, esQueryItem theDefault = null)
 {
     base._columnExpression = expression;
     this.offset            = $"{offset}";
 }
 internal esSingle(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Single);
 }
Exemplo n.º 15
0
 public esLeadOver(esQueryItem expression, decimal offset = 1.0M, esQueryItem theDefault = null)
 {
     base._columnExpression = expression;
     this.offset            = $"{offset}";
 }
Exemplo n.º 16
0
 public esLastValueOver(esQueryItem expression)
 {
     base._columnExpression = expression;
     ((IOverClause)this).IsWindowFrameSupported = true;
 }
Exemplo n.º 17
0
 internal esBoolean(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Boolean);
 }
Exemplo n.º 18
0
 internal esString(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.String);
 }
Exemplo n.º 19
0
 internal esSingle(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Single);
 }
 internal esGuid(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Guid);
 }
Exemplo n.º 21
0
 public esCountBigOver(esQueryItem columnExpression)
 {
     base._columnExpression = columnExpression;
     ((IOverClause)this).IsWindowFrameSupported = true;
 }
 internal esInt64(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Int64);
 }
Exemplo n.º 23
0
 internal esDouble(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Double);
 }
 internal esString(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.String);
 }
Exemplo n.º 25
0
 internal esDecimal(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Decimal);
 }
Exemplo n.º 26
0
 internal esDateTime(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.DateTime);
 }
Exemplo n.º 27
0
 internal esByte(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Byte);
 }
Exemplo n.º 28
0
 internal esChar(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Char);
 }
 internal esDateTime(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.DateTime);
 }
Exemplo n.º 30
0
 public esCase When(esQueryItem ex)
 {
     return(this);
 }
 internal esDecimal(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Decimal);
 }
 internal esByte(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Byte);
 }
Exemplo n.º 33
0
 internal esGuid(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Guid);
 }
 internal esChar(esQueryItem item)
 {
     base.item = item;
     item.Cast(esCastType.Char);
 }
Exemplo n.º 35
0
 /// <summary>
 /// The Constructor
 /// </summary>
 public esCase(esDynamicQuery query, esQueryItem queryItem)
 {
     this.data.Query     = query;
     this.data.QueryItem = queryItem;
 }