当前位置: 首页>>代码示例>>C#>>正文


C# SqlClient._SqlMetaDataSet类代码示例

本文整理汇总了C#中System.Data.SqlClient._SqlMetaDataSet的典型用法代码示例。如果您正苦于以下问题:C# _SqlMetaDataSet类的具体用法?C# _SqlMetaDataSet怎么用?C# _SqlMetaDataSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


_SqlMetaDataSet类属于System.Data.SqlClient命名空间,在下文中一共展示了_SqlMetaDataSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SkipRow

 internal void SkipRow(_SqlMetaDataSet columns, int startCol, TdsParserStateObject stateObj)
 {
     for (int i = startCol; i < columns.Length; i++)
     {
         _SqlMetaData md = columns[i];
         if (md.metaType.IsLong && !md.metaType.IsPlp)
         {
             byte num2 = stateObj.ReadByte();
             if (num2 == 0)
             {
                 continue;
             }
             this.SkipBytes(num2 + 8, stateObj);
         }
         this.SkipValue(md, stateObj);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:TdsParser.cs

示例2: TryProcessRow

        // Used internally by BulkCopy only
        private bool TryProcessRow(_SqlMetaDataSet columns, object[] buffer, int[] map, TdsParserStateObject stateObj)
        {
            SqlBuffer data = new SqlBuffer();

            for (int i = 0; i < columns.Length; i++)
            {
                _SqlMetaData md = columns[i];
                Debug.Assert(md != null, "_SqlMetaData should not be null for column " + i.ToString(CultureInfo.InvariantCulture));

                bool isNull;
                ulong len;
                if (!TryProcessColumnHeader(md, stateObj, i, out isNull, out len))
                {
                    return false;
                }

                if (isNull)
                {
                    GetNullSqlValue(data, md);
                    buffer[map[i]] = data.SqlValue;
                }
                else
                {
                    // We only read up to 2Gb. Throw if data is larger. Very large data
                    // should be read in chunks in sequential read mode
                    // For Plp columns, we may have gotten only the length of the first chunk
                    if (!TryReadSqlValue(data, md, md.metaType.IsPlp ? (Int32.MaxValue) : (int)len, stateObj))
                    {
                        return false;
                    }
                    buffer[map[i]] = data.SqlValue;
                    if (stateObj._longlen != 0)
                    {
                        throw new SqlTruncateException(Res.GetString(Res.SqlMisc_TruncationMaxDataMessage));
                    }
                }
                data.Clear();
            }

            return true;
        }
开发者ID:nnyamhon,项目名称:corefx,代码行数:42,代码来源:TdsParser.cs

示例3: TrySkipRow

        internal bool TrySkipRow(_SqlMetaDataSet columns, int startCol, TdsParserStateObject stateObj)
        {
            for (int i = startCol; i < columns.Length; i++)
            {
                _SqlMetaData md = columns[i];

                if (!TrySkipValue(md, i, stateObj))
                {
                    return false;
                }
            }
            return true;
        }
开发者ID:nnyamhon,项目名称:corefx,代码行数:13,代码来源:TdsParser.cs

示例4: SetAltMetaData

        internal void SetAltMetaData(_SqlMetaDataSet altMetaDataSet)
        {
            // If altmetadata with same id is found, override it rather than adding a new one
            int newId = altMetaDataSet.id;
            for (int i = 0; i < _altMetaDataSetArray.Count; i++)
            {
                if (_altMetaDataSetArray[i].id == newId)
                {
                    // override the existing metadata with the same id
                    _altMetaDataSetArray[i] = altMetaDataSet;
                    return;
                }
            }

            // if we did not find metadata to override, add as new
            _altMetaDataSetArray.Add(altMetaDataSet);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:17,代码来源:TdsParserHelperClasses.cs

示例5: TryProcessMetaData

        internal bool TryProcessMetaData(int cColumns, TdsParserStateObject stateObj, out _SqlMetaDataSet metaData)
        {
            Debug.Assert(cColumns > 0, "should have at least 1 column in metadata!");

            _SqlMetaDataSet newMetaData = new _SqlMetaDataSet(cColumns);
            for (int i = 0; i < cColumns; i++)
            {
                if (!TryCommonProcessMetaData(stateObj, newMetaData[i]))
                {
                    metaData = null;
                    return false;
                }
            }

            metaData = newMetaData;
            return true;
        }
开发者ID:nnyamhon,项目名称:corefx,代码行数:17,代码来源:TdsParser.cs

示例6: SetMetaData

 internal void SetMetaData(_SqlMetaDataSet metaData, bool moreInfo)
 {
     this._metaData = metaData;
     this._tableNames = null;
     if (this._metaData != null)
     {
         this._metaData.schemaTable = null;
         this._data = SqlBuffer.CreateBufferArray(metaData.Length);
     }
     this._fieldNameLookup = null;
     if (metaData != null)
     {
         if (!moreInfo)
         {
             this._metaDataConsumed = true;
             if (this._parser != null)
             {
                 byte num = this._stateObj.PeekByte();
                 if (num == 0xa9)
                 {
                     this._parser.Run(RunBehavior.ReturnImmediately, null, null, null, this._stateObj);
                     num = this._stateObj.PeekByte();
                 }
                 this._hasRows = 0xd1 == num;
                 if (0x88 == num)
                 {
                     this._metaDataConsumed = false;
                 }
             }
         }
     }
     else
     {
         this._metaDataConsumed = false;
     }
     this._browseModeInfoConsumed = false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:37,代码来源:SqlDataReader.cs

示例7: NextResult

        public override bool NextResult()
        {
            bool flag;
            SqlStatistics statistics = null;
            IntPtr ptr;
            Bid.ScopeEnter(out ptr, "<sc.SqlDataReader.NextResult|API> %d#", this.ObjectID);
            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                statistics = SqlStatistics.StartTimer(this.Statistics);
                this.SetTimeout();
                if (this.IsClosed)
                {
                    throw ADP.DataReaderClosed("NextResult");
                }
                this._fieldNameLookup = null;
                bool flag2 = false;
                this._hasRows = false;
                if (this.IsCommandBehavior(CommandBehavior.SingleResult))
                {
                    this.CloseInternal(false);
                    this.ClearMetaData();
                    return flag2;
                }
                if (this._parser != null)
                {
                    while (this.ReadInternal(false))
                    {
                    }
                }
                if (this._parser != null)
                {
                    if (this.HasMoreResults())
                    {
                        this._metaDataConsumed = false;
                        this._browseModeInfoConsumed = false;
                        switch (this._altRowStatus)
                        {
                            case ALTROWSTATUS.AltRow:
                            {
                                int altRowId = this._parser.GetAltRowId(this._stateObj);
                                _SqlMetaDataSet altMetaData = this._altMetaDataSetCollection.GetAltMetaData(altRowId);
                                if (altMetaData != null)
                                {
                                    this._metaData = altMetaData;
                                    this._metaData.indexMap = altMetaData.indexMap;
                                }
                                break;
                            }
                            case ALTROWSTATUS.Done:
                                this._metaData = this._altMetaDataSetCollection.metaDataSet;
                                this._altRowStatus = ALTROWSTATUS.Null;
                                break;

                            default:
                                this.ConsumeMetaData();
                                if (this._metaData == null)
                                {
                                    return false;
                                }
                                break;
                        }
                        return true;
                    }
                    this.CloseInternal(false);
                    this.SetMetaData(null, false);
                    return flag2;
                }
                this.ClearMetaData();
                return flag2;
            }
            catch (OutOfMemoryException exception3)
            {
                this._isClosed = true;
                if (this._connection != null)
                {
                    this._connection.Abort(exception3);
                }
                throw;
            }
            catch (StackOverflowException exception2)
            {
                this._isClosed = true;
                if (this._connection != null)
                {
                    this._connection.Abort(exception2);
                }
                throw;
            }
            catch (ThreadAbortException exception)
            {
                this._isClosed = true;
                if (this._connection != null)
                {
                    this._connection.Abort(exception);
                }
                throw;
            }
            finally
            {
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:SqlDataReader.cs

示例8: SetAltMetaDataSet

 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);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:SqlDataReader.cs

示例9: SetMetaData

        // callback function for the tdsparser
        // note that setting the metadata adds a resultset
        //
        internal void SetMetaData(_SqlMetaDataSet metadata) {
            resultSet = new Result(metadata);
            _results.Add(resultSet);

            indexmap = new int[resultSet.MetaData.Length];
            for(int i = 0; i < indexmap.Length; i++) {
                indexmap[i] = i;
            }
        }
开发者ID:mind0n,项目名称:hive,代码行数:12,代码来源:SqlBulkCopy.cs

示例10: WriteBulkCopyMetaData

        internal void WriteBulkCopyMetaData(_SqlMetaDataSet metadataCollection, int count, TdsParserStateObject stateObj)
        {
            this.WriteByte(0x81, stateObj);
            this.WriteShort(count, stateObj);
            for (int i = 0; i < metadataCollection.Length; i++)
            {
                if (metadataCollection[i] == null)
                {
                    continue;
                }
                _SqlMetaData data = metadataCollection[i];
                if (this.IsYukonOrNewer)
                {
                    this.WriteInt(0, stateObj);
                }
                else
                {
                    this.WriteShort(0, stateObj);
                }
                ushort v = (ushort) (data.updatability << 2);
                v = (ushort) (v | (data.isNullable ? 1 : 0));
                v = (ushort) (v | (data.isIdentity ? 0x10 : 0));
                this.WriteShort(v, stateObj);
                switch (data.type)
                {
                    case SqlDbType.Xml:
                        this.WriteByteArray(s_xmlMetadataSubstituteSequence, s_xmlMetadataSubstituteSequence.Length, 0, stateObj);
                        break;

                    case SqlDbType.Udt:
                        this.WriteByte(0xa5, stateObj);
                        this.WriteTokenLength(0xa5, data.length, stateObj);
                        break;

                    case SqlDbType.Date:
                        this.WriteByte(data.tdsType, stateObj);
                        break;

                    case SqlDbType.Time:
                    case SqlDbType.DateTime2:
                    case SqlDbType.DateTimeOffset:
                        this.WriteByte(data.tdsType, stateObj);
                        this.WriteByte(data.scale, stateObj);
                        break;

                    case SqlDbType.Decimal:
                        this.WriteByte(data.tdsType, stateObj);
                        this.WriteTokenLength(data.tdsType, data.length, stateObj);
                        this.WriteByte(data.precision, stateObj);
                        this.WriteByte(data.scale, stateObj);
                        break;

                    default:
                        this.WriteByte(data.tdsType, stateObj);
                        this.WriteTokenLength(data.tdsType, data.length, stateObj);
                        if (data.metaType.IsCharType && this._isShiloh)
                        {
                            this.WriteUnsignedInt(data.collation.info, stateObj);
                            this.WriteByte(data.collation.sortId, stateObj);
                        }
                        break;
                }
                if (data.metaType.IsLong && !data.metaType.IsPlp)
                {
                    this.WriteShort(data.tableName.Length, stateObj);
                    this.WriteString(data.tableName, stateObj);
                }
                this.WriteByte((byte) data.column.Length, stateObj);
                this.WriteString(data.column, stateObj);
            }
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:71,代码来源:TdsParser.cs

示例11: TryProcessAltMetaData

        internal bool TryProcessAltMetaData(int cColumns, TdsParserStateObject stateObj, out _SqlMetaDataSet metaData) {
            Debug.Assert(cColumns > 0, "should have at least 1 column in altMetaData!");

            metaData = null;
            _SqlMetaDataSet altMetaDataSet = new _SqlMetaDataSet(cColumns, null);
            int[] indexMap = new int[cColumns];

            if (!stateObj.TryReadUInt16(out altMetaDataSet.id)) {
                return false;
            }

            byte byCols;
            if (!stateObj.TryReadByte(out byCols)) {
                return false;
            }

            while (byCols > 0) {
                if (!stateObj.TrySkipBytes(2)) { // ignore ColNum ...
                    return false;
                }
                byCols--;
            }

            // pass 1, read the meta data off the wire
            for (int i = 0; i < cColumns; i++) {
                // internal meta data class
                _SqlMetaData col = altMetaDataSet[i];

                if (!stateObj.TryReadByte(out col.op)) {
                    return false;
                }
                if (!stateObj.TryReadUInt16(out col.operand)) {
                    return false;
                }

                // TCE is not applicable to AltMetadata.
                if (!TryCommonProcessMetaData(stateObj, col, null, fColMD: false, columnEncryptionSetting: SqlCommandColumnEncryptionSetting.Disabled)) {
                    return false;
                }

                if (ADP.IsEmpty(col.column)) {
                    // create column name from op
                    switch (col.op) {
                        case TdsEnums.AOPAVG:
                            col.column = "avg";
                            break;

                        case TdsEnums.AOPCNT:
                            col.column = "cnt";
                            break;

                        case TdsEnums.AOPCNTB:
                            col.column = "cntb";
                            break;

                        case TdsEnums.AOPMAX:
                            col.column = "max";
                            break;

                        case TdsEnums.AOPMIN:
                            col.column = "min";
                            break;

                        case TdsEnums.AOPSUM:
                            col.column = "sum";
                            break;

                        case TdsEnums.AOPANY:
                            col.column = "any";
                            break;

                        case TdsEnums.AOPNOOP:
                            col.column = "noop";
                            break;

                        case TdsEnums.AOPSTDEV:
                            col.column = "stdev";
                            break;

                        case TdsEnums.AOPSTDEVP:
                            col.column = "stdevp";
                            break;

                        case TdsEnums.AOPVAR:
                            col.column = "var";
                            break;

                        case TdsEnums.AOPVARP:
                            col.column = "varp";
                            break;
                    }
                }
                indexMap[i] = i;
            }

            altMetaDataSet.indexMap = indexMap;
            altMetaDataSet.visibleColumns = cColumns;

            metaData = altMetaDataSet;
            return true;
//.........这里部分代码省略.........
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:101,代码来源:TdsParser.cs

示例12: TryProcessMetaData

        internal bool TryProcessMetaData(int cColumns, TdsParserStateObject stateObj, out _SqlMetaDataSet metaData, SqlCommandColumnEncryptionSetting columnEncryptionSetting) {
            Debug.Assert(cColumns > 0, "should have at least 1 column in metadata!");

            // Read the cipher info table first 
            SqlTceCipherInfoTable? cipherTable = null;
            if (_serverSupportsColumnEncryption) {
                if (!TryProcessCipherInfoTable (stateObj, out cipherTable)) {
                    metaData = null;
                    return false;
                }
            }

            // Read the ColumnData fields
            _SqlMetaDataSet newMetaData = new _SqlMetaDataSet(cColumns, cipherTable);
            for (int i = 0; i < cColumns; i++) {
                if (!TryCommonProcessMetaData(stateObj, newMetaData[i], cipherTable, fColMD: true, columnEncryptionSetting: columnEncryptionSetting)) {
                    metaData = null;
                    return false;
                }
            }

            // DEVNOTE: cipherTable is discarded at this point since its no longer needed.
            metaData = newMetaData;
            return true;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:25,代码来源:TdsParser.cs

示例13: Result

 internal Result(_SqlMetaDataSet metadata)
 {
     this._metadata = metadata;
     this._rowset = new ArrayList();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:5,代码来源:Result.cs

示例14: TryProcessColInfo

        // augments current metadata with table and key information
        private bool TryProcessColInfo(_SqlMetaDataSet columns, SqlDataReader reader, TdsParserStateObject stateObj, out _SqlMetaDataSet metaData) {
            Debug.Assert(columns != null && columns.Length > 0, "no metadata available!");

            metaData = null;

            for (int i = 0; i < columns.Length; i++) {
                _SqlMetaData col = columns[i];

                byte ignored;
                if (!stateObj.TryReadByte(out ignored)) { // colnum, ignore
                    return false;
                }
                if (!stateObj.TryReadByte(out col.tableNum)) {
                    return false;
                }

                // interpret status
                byte status;
                if (!stateObj.TryReadByte(out status)) {
                    return false;
                }

                col.isDifferentName = (TdsEnums.SQLDifferentName == (status & TdsEnums.SQLDifferentName));
                col.isExpression = (TdsEnums.SQLExpression == (status & TdsEnums.SQLExpression));
                col.isKey = (TdsEnums.SQLKey == (status & TdsEnums.SQLKey));
                col.isHidden = (TdsEnums.SQLHidden == (status & TdsEnums.SQLHidden));

                // read off the base table name if it is different than the select list column name
                if (col.isDifferentName) {
                    byte len;
                    if (!stateObj.TryReadByte(out len)) {
                        return false;
                    }
                    if (!stateObj.TryReadString(len, out col.baseColumn)) {
                        return false;
                    }
                }

                // Fixup column name - only if result of a table - that is if it was not the result of
                // an expression.
                if ((reader.TableNames != null) && (col.tableNum > 0)) {
                    Debug.Assert(reader.TableNames.Length >= col.tableNum, "invalid tableNames array!");
                    col.multiPartTableName = reader.TableNames[col.tableNum - 1];
                }

                // MDAC 60109: expressions are readonly
                if (col.isExpression) {
                    col.updatability = 0;
                }
            }

            // set the metadata so that the stream knows some metadata info has changed
            metaData = columns;
            return true;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:56,代码来源:TdsParser.cs

示例15: Prepare

 public override void Prepare()
 {
     SqlConnection.ExecutePermission.Demand();
     this._pendingCancel = false;
     if ((this._activeConnection == null) || !this._activeConnection.IsContextConnection)
     {
         IntPtr ptr;
         SqlStatistics statistics = null;
         SqlDataReader reader = null;
         Bid.ScopeEnter(out ptr, "<sc.SqlCommand.Prepare|API> %d#", this.ObjectID);
         statistics = SqlStatistics.StartTimer(this.Statistics);
         if ((this.IsPrepared && !this.IsDirty) || ((this.CommandType == System.Data.CommandType.StoredProcedure) || ((System.Data.CommandType.Text == this.CommandType) && (this.GetParameterCount(this._parameters) == 0))))
         {
             if (this.Statistics != null)
             {
                 this.Statistics.SafeIncrement(ref this.Statistics._prepares);
             }
             this._hiddenPrepare = false;
         }
         else
         {
             bool flag = true;
             SNIHandle target = null;
             RuntimeHelpers.PrepareConstrainedRegions();
             try
             {
                 target = SqlInternalConnection.GetBestEffortCleanupTarget(this._activeConnection);
                 this.ValidateCommand("Prepare", false);
                 this.GetStateObject();
                 if (this._parameters != null)
                 {
                     int count = this._parameters.Count;
                     for (int i = 0; i < count; i++)
                     {
                         this._parameters[i].Prepare(this);
                     }
                 }
                 reader = this.InternalPrepare(CommandBehavior.Default);
             }
             catch (OutOfMemoryException exception4)
             {
                 flag = false;
                 this._activeConnection.Abort(exception4);
                 throw;
             }
             catch (StackOverflowException exception3)
             {
                 flag = false;
                 this._activeConnection.Abort(exception3);
                 throw;
             }
             catch (ThreadAbortException exception2)
             {
                 flag = false;
                 this._activeConnection.Abort(exception2);
                 SqlInternalConnection.BestEffortCleanup(target);
                 throw;
             }
             catch (Exception exception)
             {
                 flag = ADP.IsCatchableExceptionType(exception);
                 throw;
             }
             finally
             {
                 if (flag)
                 {
                     this._hiddenPrepare = false;
                     if (reader != null)
                     {
                         this._cachedMetaData = reader.MetaData;
                         reader.Close();
                     }
                     this.PutStateObject();
                 }
             }
         }
         SqlStatistics.StopTimer(statistics);
         Bid.ScopeLeave(ref ptr);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:81,代码来源:SqlCommand.cs


注:本文中的System.Data.SqlClient._SqlMetaDataSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。