public object Clone()
 {
     _SqlMetaDataSetCollection result = new _SqlMetaDataSetCollection();
     result.metaDataSet = metaDataSet == null ? null : (_SqlMetaDataSet)metaDataSet.Clone();
     foreach (_SqlMetaDataSet set in _altMetaDataSetArray)
     {
         result._altMetaDataSetArray.Add((_SqlMetaDataSet)set.Clone());
     }
     return result;
 }
 internal void SetAltMetaDataSet(_SqlMetaDataSet metaDataSet, bool metaDataConsumed)
 {
     if (this._altMetaDataSetCollection == null)
     {
         this._altMetaDataSetCollection = new _SqlMetaDataSetCollection();
     }
     this._altMetaDataSetCollection.SetAltMetaData(metaDataSet);
     this._metaDataConsumed = metaDataConsumed;
     if (this._metaDataConsumed && (this._parser != null))
     {
         byte num = this._stateObj.PeekByte();
         if (0xa9 == num)
         {
             this._parser.Run(RunBehavior.ReturnImmediately, this._command, this, null, this._stateObj);
             num = this._stateObj.PeekByte();
         }
         this._hasRows = 0xd1 == num;
     }
     if ((metaDataSet != null) && ((this._data == null) || (this._data.Length < metaDataSet.Length)))
     {
         this._data = SqlBuffer.CreateBufferArray(metaDataSet.Length);
     }
 }
Ejemplo n.º 3
0
            internal void Snap()
            {
                _snapshotInBuffs.Clear();
                _snapshotInBuffCurrent = 0;
                _snapshotInBytesUsed = _stateObj._inBytesUsed;
                _snapshotInBytesPacket = _stateObj._inBytesPacket;
                _snapshotPendingData = _stateObj._pendingData;
                _snapshotErrorTokenReceived = _stateObj._errorTokenReceived;
                _snapshotMessageStatus = _stateObj._messageStatus;
                // _nullBitmapInfo must be cloned before it is updated
                _snapshotNullBitmapInfo = _stateObj._nullBitmapInfo;
                _snapshotLongLen = _stateObj._longlen;
                _snapshotLongLenLeft = _stateObj._longlenleft;
                _snapshotCleanupMetaData = _stateObj._cleanupMetaData;
                // _cleanupAltMetaDataSetArray must be cloned bofore it is updated
                _snapshotCleanupAltMetaDataSetArray = _stateObj._cleanupAltMetaDataSetArray;
                _snapshotHasOpenResult = _stateObj._hasOpenResult;
                _snapshotReceivedColumnMetadata = _stateObj._receivedColMetaData;
                _snapshotAttentionReceived = _stateObj._attentionReceived;
#if DEBUG
                _rollingPend = 0;
                _rollingPendCount = 0;
                _stateObj._lastStack = null;
                Debug.Assert(_stateObj._bTmpRead == 0, "Has partially read data when snapshot taken");
                Debug.Assert(_stateObj._partialHeaderBytesRead == 0, "Has partially read header when shapshot taken");
#endif

                PushBuffer(_stateObj._inBuff, _stateObj._inBytesRead);
            }
        private bool HasMoreResults()
        {
            if (this._parser != null)
            {
                if (!this.HasMoreRows())
                {
                    while (this._stateObj._pendingData)
                    {
                        switch (this._stateObj.PeekByte())
                        {
                            case 0xd1:
                                return true;

                            case 0xd3:
                                if (this._altRowStatus == ALTROWSTATUS.Null)
                                {
                                    this._altMetaDataSetCollection.metaDataSet = this._metaData;
                                    this._metaData = null;
                                }
                                this._altRowStatus = ALTROWSTATUS.AltRow;
                                this._hasRows = true;
                                return true;

                            case 0xfd:
                                this._altRowStatus = ALTROWSTATUS.Null;
                                this._metaData = null;
                                this._altMetaDataSetCollection = null;
                                return true;

                            case 0x81:
                                return true;
                        }
                        this._parser.Run(RunBehavior.ReturnImmediately, this._command, this, null, this._stateObj);
                    }
                }
                else
                {
                    return true;
                }
            }
            return false;
        }