コード例 #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;
            }
        }
コード例 #5
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;
            }
            

        }
コード例 #6
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;
             }
         }
     }
 }
コード例 #7
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;
        }
コード例 #8
0
 //for read on each subtable
 internal MySubTableDataReader(MySqlSubTable tableResult)
 {
     SetCurrentSubTable(tableResult);
 }