Microsoft SQL Server 2008 R2 Unleashed- P189

Microsoft SQL Server 2008 R2 Unleashed- P189:SQL Server 2005 provided a number of significant new features and enhancements over what was available in SQL Server 2000. This is not too surprising considering there was a five-year gap between these major SQL Server 2008 is not as much of a quantum leap forward from SQL Server 2005 | 1844 CHAPTER 46 SQLCLR Developing SQL Server Objects in .NET When MatchAll is invoked it returns an instance of the RegexReader class. In its constructor RegexReader sets the passed-in regular expression input string and options to its data members. Then at initialization time SQL Server invokes RegexReader s GetEnumerator instance method which returns an instance of RegexEnumerator which does all the real work utilizing the members of the RegexReader object that is passed into its constructor and set to its private _reader object. Reset is called in RegexEnumerator s constructor so that it can initialize its members in the following way RegexEnumerator uses a private Regex object _rex for performing the match and stores the resulting array of Match Match in a private object _match . The ordinal number of the match is kept in _matchIndex and initialized to 0 in case there are no matches . When Reset is complete it is up to SQL Server to iterate through the matches by calling MoveNext . MoveNext does the work of re-creating the row represented as a private array of object called _current for every successful match stored in _match _match 0 is set to the value of _matchIndex incremented on a per-match basis and corresponds to the output table column defined in the TableDefinition named parameter MatchIndex. _match 1 is set to the value of an XML document that is built for every match and contains subnodes for each group and group capture. This value corresponds to the output table column GroupList. When SQL Server uses the RegexEnumerator it first calls MoveNext and then uses the Current property. Next execution passes to the method specified in FillRowMethodName FillMatchAll . Finally the CLR passes the latest value of _current to FillMatchAll as the row parameter. Each out parameter of FillMatchAll is set to the value for the columns in the output row. NOTE If this implementation seems daunting the best way to overcome that is to walk though the .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.