예제 #1
0
        /// <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 tgDynamicQuerySerializable SelectAllExcept(params tgQueryItem[] columns)
        {
            foreach (tgColumnMetadata 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;
                }

                tgExpression item = new tgQueryItem(this, col.Name, col.esType);
                this.Select(item);
            }

            return(this);
        }
예제 #2
0
        public tgCase Else(tgQueryItem queryItem)
        {
            tgExpression expression = queryItem;

            this.data.Else = expression;

            return(this);
        }
예제 #3
0
        /// <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 tgDynamicQuerySerializable SelectAll()
        {
            foreach (tgColumnMetadata col in this.Meta.Columns)
            {
                tgQueryItem item = new tgQueryItem(this, col.Name, col.esType);
                this.Select(item);
            }

            return(this);
        }
예제 #4
0
        private void _selectAll()
        {
            if (this.m_selectAll)
            {
                foreach (tgColumnMetadata col in this.Meta.Columns)
                {
                    tgQueryItem item = new tgQueryItem(this, col.Name, col.esType);
                    this.Select(item);
                }

                this.m_selectAll = false;
            }
        }
예제 #5
0
        public tgCase Then(tgQueryItem queryItem)
        {
            tgExpression expression = queryItem;

            tgSimpleCaseData.tgCaseClause clause = new tgSimpleCaseData.tgCaseClause();
            clause.When = this.WhenItem;
            clause.Then = expression;

            if (data.Cases == null)
            {
                data.Cases = new List <tgSimpleCaseData.tgCaseClause>();
            }

            this.data.Cases.Add(clause);

            return(this);
        }
예제 #6
0
파일: tgCasts.cs 프로젝트: BrewDawg/Tiraggo
 internal tgChar(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Char);
 }
예제 #7
0
 /// <summary>
 /// The Constructor
 /// </summary>
 public tgCase(tgDynamicQuerySerializable query, tgQueryItem queryItem)
 {
     this.data.Query     = query;
     this.data.QueryItem = queryItem;
 }
예제 #8
0
파일: tgCasts.cs 프로젝트: BrewDawg/Tiraggo
 internal tgSingle(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Single);
 }
예제 #9
0
파일: tgCasts.cs 프로젝트: BrewDawg/Tiraggo
 internal tgInt64(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Int64);
 }
예제 #10
0
파일: tgCasts.cs 프로젝트: BrewDawg/Tiraggo
 internal tgDouble(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Double);
 }
예제 #11
0
 internal tgDouble(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Double);
 }
예제 #12
0
 internal tgDecimal(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Decimal);
 }
예제 #13
0
 internal tgDateTime(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.DateTime);
 }
예제 #14
0
 internal tgChar(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Char);
 }
예제 #15
0
 internal tgByte(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Byte);
 }
예제 #16
0
파일: tgCasts.cs 프로젝트: BrewDawg/Tiraggo
 internal tgDateTime(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.DateTime);
 }
예제 #17
0
파일: tgCasts.cs 프로젝트: BrewDawg/Tiraggo
 internal tgDecimal(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Decimal);
 }
예제 #18
0
 internal tgGuid(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Guid);
 }
예제 #19
0
파일: tgCasts.cs 프로젝트: BrewDawg/Tiraggo
 internal tgGuid(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Guid);
 }
예제 #20
0
 internal tgInt64(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Int64);
 }
예제 #21
0
파일: tgCasts.cs 프로젝트: BrewDawg/Tiraggo
 internal tgBoolean(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Boolean);
 }
예제 #22
0
 internal tgSingle(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Single);
 }
예제 #23
0
파일: tgCasts.cs 프로젝트: BrewDawg/Tiraggo
 internal tgString(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.String);
 }
예제 #24
0
 internal tgString(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.String);
 }
예제 #25
0
 internal tgBoolean(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Boolean);
 }
예제 #26
0
파일: tgCasts.cs 프로젝트: BrewDawg/Tiraggo
 internal tgByte(tgQueryItem item)
 {
     base.item = item;
     item.Cast(tgCastType.Byte);
 }
예제 #27
0
 public tgCase When(tgQueryItem ex)
 {
     return(this);
 }
예제 #28
0
        /// <summary>
        ///
        /// </summary>
        private void AssignProviderMetadata(tgDynamicQuerySerializable query, List <tgDynamicQuerySerializable> beenThere)
        {
            if (beenThere.Contains(query))
            {
                return;
            }

            beenThere.Add(query);

            tgDynamicQuery theQuery = query as tgDynamicQuery;
            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            if (theQuery != null)
            {
                tgConnection conn = theQuery.tg2.Connection;

                if (iQuery.ProviderMetadata == null)
                {
                    tgProviderSpecificMetadata 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 (tgColumnMetadata col in (tgColumnMetadataCollection)iQuery.Columns)
                {
                    tgQueryItem item = new tgQueryItem(this, col.Name, col.esType);
                    query.Select(item);
                }
            }
            else
            {
                List <tgQueryItem> columns = iQuery.SelectAllExcept;

                if (columns != null)
                {
                    foreach (tgColumnMetadata col in (tgColumnMetadataCollection)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;
                        }

                        tgExpression item = new tgQueryItem(this, col.Name, col.esType);
                        query.Select(item);
                    }
                }
            }

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

            if (iQuery.InternalSetOperations != null)
            {
                foreach (tgSetOperation setOperation in iQuery.InternalSetOperations)
                {
                    AssignProviderMetadata(setOperation.Query, beenThere);
                }
            }
        }