예제 #1
0
        internal void SetCurrentSubTable(MySqlSubTable currentSubTable)
        {
            this.currentSubTable = currentSubTable;
            this.fieldMaps       = null;

            if (!currentSubTable.IsEmpty)
            {
                isEmptyTable      = false;
                this.rows         = currentSubTable.GetMySqlTableResult().rows;
                _isBinaryProtocol = currentSubTable.IsBinaryProtocol;
                subTableRowCount  = rows.Count;
                //buffer for each row
                cells = new MyStructData[currentSubTable.FieldCount];
            }
            else
            {
                isEmptyTable      = true;
                _isBinaryProtocol = false;
                rows             = null;
                subTableRowCount = 0;
            }
            currentRowIndex = 0;
        }
예제 #2
0
        /// <summary>
        /// blocking, wait for first data arrive
        /// </summary>
        internal void WaitUntilFirstDataArrive()
        {
TRY_AGAIN:
            if (emptySubTable)
            {
                //no current table
                bool hasSomeSubTables = false;
                lock (subTables)
                {
                    if (subTables.Count > 0)
                    {
                        MySqlSubTable subt = new MySqlSubTable(subTables.Dequeue());
                        SetCurrentSubTable(subt);
                        hasSomeSubTables = true;
                    }
                }
                if (!hasSomeSubTables)
                {
                    if (tableResultIsNotComplete)
                    {
                        //we are in isPartial table mode (not complete)
                        //so must wait until the table arrive **
                        //------------------
                        //wait ***
                        //------------------
                        //TODO: review here *** tight loop
                        //*** tigh loop
                        //wait on this
                        while (tableResultIsNotComplete)
                        {
                            ;
                        }
                        goto TRY_AGAIN;
                    }
                }
            }
        }
예제 #3
0
 //for read on each subtable
 internal MySubTableDataReader(MySqlSubTable tableResult)
 {
     SetCurrentSubTable(tableResult);
 }
예제 #4
0
        /// <summary>
        /// sync read row
        /// </summary>
        /// <returns></returns>
        public override bool Read()
        {
TRY_AGAIN:
            if (IsEmptyTable)
            {
                //no current table
                bool hasSomeSubTables = false;
                lock (subTables)
                {
                    if (subTables.Count > 0)
                    {
                        MySqlSubTable subT = new MySqlSubTable(subTables.Dequeue());
                        SetCurrentSubTable(subT);
                        hasSomeSubTables = true;
                    }
                }

                if (!hasSomeSubTables)
                {
                    if (tableResultIsNotComplete)
                    {
                        //we are in isPartial table mode (not complete)
                        //so must wait until the table arrive **
                        //------------------
                        //wait ***
                        //------------------
                        //TODO: review here *** tight loop
                        while (tableResultIsNotComplete)
                        {
                            ;                              //*** tight loop
                        }
                        //------------------
                        goto TRY_AGAIN;
                    }
                    else if (!firstResultArrived)
                    {
                        //another tight loop
                        //wait for first result arrive
                        //TODO: review here *** tight loop
                        while (!firstResultArrived)
                        {
                            ;                        //*** tight loop
                        }
                        goto TRY_AGAIN;
                    }
                    else
                    {
                        //not in partial table mode
                        return(false);
                    }
                }
            }
            //------------------------------------------------------------------
            if (base.Read())
            {
                return(true);
            }
            else
            {
                SetCurrentSubTable(MySqlSubTable.Empty);
                goto TRY_AGAIN;
            }
        }
        /// <summary>
        /// sync read row
        /// </summary>
        /// <returns></returns>
        public override bool Read()
        {
            TRY_AGAIN:
            if (IsEmptyTable)
            {
                //no current table 
                bool hasSomeSubTables = false;
                lock (subTables)
                {
                    if (subTables.Count > 0)
                    {
                        MySqlSubTable subT = new MySqlSubTable(subTables.Dequeue());
                        SetCurrentSubTable(subT);
                        hasSomeSubTables = true;
                    }
                }

                if (!hasSomeSubTables)
                {

                    if (tableResultIsNotComplete)
                    {
                        //we are in isPartial table mode (not complete)
                        //so must wait until the table arrive **
                        //------------------                    
                        //wait ***
                        //------------------
                        //TODO: review here *** tight loop
                        while (tableResultIsNotComplete) ; //*** tight loop
                        //------------------
                        goto TRY_AGAIN;
                    }
                    else if (!firstResultArrived)
                    {
                        //another tight loop
                        //wait for first result arrive
                        //TODO: review here *** tight loop
                        while (!firstResultArrived) ;//*** tight loop
                        goto TRY_AGAIN;
                    }
                    else
                    {
                        //not in partial table mode
                        return false;
                    }
                }
            }
            //------------------------------------------------------------------
            if (base.Read())
            {
                return true;
            }
            else
            {
                SetCurrentSubTable(MySqlSubTable.Empty);
                goto TRY_AGAIN;
            }
            

        }
 /// <summary>
 /// blocking, wait for first data arrive
 /// </summary>
 internal void WaitUntilFirstDataArrive()
 {
     TRY_AGAIN:
     if (emptySubTable)
     {
         //no current table 
         bool hasSomeSubTables = false;
         lock (subTables)
         {
             if (subTables.Count > 0)
             {
                 MySqlSubTable subt = new MySqlSubTable(subTables.Dequeue());
                 SetCurrentSubTable(subt);
                 hasSomeSubTables = true;
             }
         }
         if (!hasSomeSubTables)
         {
             if (tableResultIsNotComplete)
             {
                 //we are in isPartial table mode (not complete)
                 //so must wait until the table arrive **
                 //------------------                    
                 //wait ***
                 //------------------
                 //TODO: review here *** tight loop
                 //*** tigh loop
                 //wait on this
                 while (tableResultIsNotComplete) ;
                 goto TRY_AGAIN;
             }
         }
     }
 }
        internal void SetCurrentSubTable(MySqlSubTable currentSubTable)
        {
            this.currentSubTable = currentSubTable;
            this.fieldMaps = null;

            if (!currentSubTable.IsEmpty)
            {
                isEmptyTable = false;
                this.rows = currentSubTable.GetMySqlTableResult().rows;
                _isBinaryProtocol = currentSubTable.IsBinaryProtocol;
                subTableRowCount = rows.Count;
                //buffer for each row 
                cells = new MyStructData[currentSubTable.FieldCount];
            }
            else
            {
                isEmptyTable = true;
                _isBinaryProtocol = false;
                rows = null;
                subTableRowCount = 0;

            }
            currentRowIndex = 0;
        }
 //for read on each subtable
 internal MySubTableDataReader(MySqlSubTable tableResult)
 {
     SetCurrentSubTable(tableResult);
 }