JP4728675B2 - System and method for building unordered and ordered collections in a data store - Google Patents

System and method for building unordered and ordered collections in a data store Download PDF

Info

Publication number
JP4728675B2
JP4728675B2 JP2005097507A JP2005097507A JP4728675B2 JP 4728675 B2 JP4728675 B2 JP 4728675B2 JP 2005097507 A JP2005097507 A JP 2005097507A JP 2005097507 A JP2005097507 A JP 2005097507A JP 4728675 B2 JP4728675 B2 JP 4728675B2
Authority
JP
Japan
Prior art keywords
type
collection
column
query
user
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2005097507A
Other languages
Japanese (ja)
Other versions
JP2005316980A (en
Inventor
ラタクリシュナン バラジ
セジン ベイシム
エイチ.エム.デニュイ ブルーノ
ジェイ.カニンガム コナー
ヴィ.チュリン デニス
ワイ.アルトゥドブ デニス
トミック ドラゲン
エイ.ブレイキー ジョセ
エヌ.ゼーリガー オリバー
ベンカテシュ ラマチャンドラン
ステファニ ステファノ
ユゥ ウェイ
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Microsoft Corp
Original Assignee
Microsoft Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from US11/027,416 external-priority patent/US7437371B2/en
Application filed by Microsoft Corp filed Critical Microsoft Corp
Publication of JP2005316980A publication Critical patent/JP2005316980A/en
Application granted granted Critical
Publication of JP4728675B2 publication Critical patent/JP4728675B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/40Data acquisition and logging

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

本発明は、コンピュータシステムにおけるデータ記憶、およびデータベースシステムにおいてユーザ定義タイプ(UDT:user-defined type)をサポートするシステムに関する。UDTは、ある特定のコントラクト(specific contract)を構築(implement)するマネージドタイプ(managed type)を登録(register)することによってデータストア(data store)のスカラタイプシステム(群)(scalar type system(s))を拡張(extend)するために、リレーショナルデータベース(relational database)エンジンおよびファイルシステムと共に利用される拡張機構(extensibility mechanism)である。より詳細には、本発明は、スカラ(scalar)であると共に照会可能(queriable)であるUDTにより、データベースシステムでの多重集合(multiset)および順序つきコレクション(ordered collection)の構築(implementation)に関する。   The present invention relates to data storage in computer systems and systems that support user-defined types (UDTs) in database systems. A UDT is a scalar type system (s) for a data store by registering a managed type that implements a specific contract. )) Is an extensibility mechanism used in conjunction with a relational database engine and file system to extend. More particularly, the present invention relates to the implementation of multisets and ordered collections in a database system with UDTs that are both scalar and queriable.

ユーザ定義タイプ(user-defined type)   User-defined type

当業者には公知であり理解されているように、MICROSOFT SQLサーバは、豊富な管理および開発ツール、ETL(抽出、変換、挿入)(extraction-transformation-loading)ツール、ビジネスインテリジェンスおよび分析サービス、ならびに他の機能を提供する包括的なデータベース管理プラットフォームである。さらに、MICROSOFT WINDOWS(登録商標).NETフレームワークの共通言語ランタイム(common language runtime)(CLR)は、SQLサーバデータベースに最近統合された。   As known and understood by those skilled in the art, the MICROSOFT SQL Server is a rich management and development tool, ETL (extraction-transformation-loading) tool, business intelligence and analysis services, and It is a comprehensive database management platform that provides other functions. Further, MICROSOFT WINDOWS (registered trademark). The NET framework's common language runtime (CLR) has recently been integrated into the SQL server database.

CLRは、MICROSOFT.NETフレームワークの核心部であり、すべての.NETコード用の実行環境を提供する。CLRにおいて実行されるコードは、「マネージドコード(managed code)」と呼ばれる。CLRは、ジャストインタイムの(JIT:just-in-time)コンパイル、メモリの割り振りおよび管理、タイプの安全性の実施、例外処理、スレッド管理、ならびにセキュリティを含む、プログラム実行に必要とされる様々な関数およびサービスを提供する。CLRは現在、.NETルーチンを初めて呼び出すときにSQLサーバによってロードされる。   CLR is a MICROSOFT. It is the core of the NET framework. Provides an execution environment for NET code. The code executed in the CLR is called “managed code”. CLR is required for program execution, including just-in-time (JIT) compilation, memory allocation and management, type safety enforcement, exception handling, thread management, and security. Functions and services. CLR is currently. It is loaded by the SQL server when the NET routine is called for the first time.

以前のバージョンのSQLサーバでは、データベースプログラマは、サーバ側でコードを書くとき、Transact−SQLを使うことしかできなかった。Transact−SQLは、国際標準化機構(ISO)および米国規格協会(ANSI)によって定義されている、構造化照会言語(「SQL」)の拡張である。Transact−SQLを用いると、データベース開発者は、データベースおよびテーブルを作成し、修正し、削除することができ、かつデータベースに格納されたデータを挿入し、取得し、修正し、削除することができる。Transact−SQLは、直接的な構造データアクセスおよび処理用に特に設計されている。Transact−SQLは、構造データアクセスおよび管理において他のものより優れているが、VISUAL BASIC.NETおよびC#のように成熟したプログラミング言語ではない。たとえば、Transact−SQLは、配列、コレクション、for−eachループ、ビットシフト、またはクラスをサポートしない。   In previous versions of the SQL server, database programmers could only use Transact-SQL when writing code on the server side. Transact-SQL is an extension of the Structured Query Language (“SQL”) defined by the International Organization for Standardization (ISO) and the American National Standards Institute (ANSI). With Transact-SQL, database developers can create, modify, and delete databases and tables, and can insert, retrieve, modify, and delete data stored in databases . Transact-SQL is specifically designed for direct structural data access and processing. Although Transact-SQL is superior to others in structural data access and management, Visual BASIC. It is not a mature programming language like NET and C #. For example, Transact-SQL does not support arrays, collections, for-each loops, bit shifts, or classes.

SQLサーバデータベースに統合されたCLRを用いることによって、データベース開発者は、Transact−SQLのみでは遂行することが不可能または困難だったタスクを実施することができるようになった。VISUAL BASIC.NETおよびC#はともに、配列、構造化例外処理、およびコレクションをフルサポートする最新プログラミング言語である。開発者は、CLR統合を利用して、論理がより複雑であり、VISUAL BASIC.NETおよびC#などの言語を用いる計算タスクにより適したコードを書くことができる。こうしたプログラミング言語は、カプセル化、継承、および多態性などのオブジェクト指向能力を提供する。関連するコードは、クラスおよび名前空間に容易に編成することができる。   By using CLR integrated into the SQL server database, database developers can now perform tasks that were impossible or difficult to accomplish with Transact-SQL alone. VISUAL BASIC. Both NET and C # are modern programming languages with full support for arrays, structured exception handling, and collections. Developers can take advantage of CLR integration and the logic is more complex, and Visual BASIC. Code more suitable for computational tasks using languages such as NET and C # can be written. Such programming languages provide object-oriented capabilities such as encapsulation, inheritance, and polymorphism. Related code can be easily organized into classes and namespaces.

マネージドコード(managed code)は、Transact−SQLよりも大量の演算および複雑な実行論理に適しており、ストリング処理および正規表現を含む多くの複合タスクの拡張サポートを特色とする。データベース開発者は、.NETフレームワーク(.NET Framework)のベースクラスライブラリ(BCL:Base Class Library)中にある機能を用いて、格納されたどの手順、トリガ、またはユーザ定義関数からも容易に利用することができる、予め構築された数千個のクラスおよびルーチンを利用することができる。   Managed code is more suitable for transactional and complex execution logic than Transact-SQL and features extended support for many complex tasks including string processing and regular expressions. Database developers: It can be used easily from any stored procedure, trigger, or user-defined function using the functions in the base class library (BCL) of the NET framework (.NET Framework). Thousands of built classes and routines can be used.

マネージドコードの別の利益は、タイプの安全性(type safety)である。マネージドコードが実行される前に、CLRは、コードが安全であることを確かめる。このプロセスは、「検証(verification)」として知られる。検証の間、CLRは、コードが実行するのに安全であることを保障するためにいくつかの検査を実施する。たとえば、コードは、書き込みを受けていないメモリが読み出しを受けないよう保障するために調べられる。CLRは、バッファオーバーフローも防止する。   Another benefit of managed code is type safety. Before the managed code is executed, the CLR verifies that the code is secure. This process is known as “verification”. During verification, the CLR performs several checks to ensure that the code is safe to execute. For example, the code is examined to ensure that a memory that has not been written does not receive a read. CLR also prevents buffer overflow.

マネージドコードを書くとき、展開単位は、アセンブリと呼ばれる。アセンブリは、動的リンクライブラリ(DLL:dynamic link library)としてパッケージされる。マネージDLLアセンブリは、SQLサーバによってロードしホストすることができる。CREATE ASSEMBLYステートメントは、サーバにアセンブリを登録するのに用いられる。以下に例を挙げる。   When writing managed code, the deployment unit is called an assembly. The assembly is packaged as a dynamic link library (DLL). A managed DLL assembly can be loaded and hosted by an SQL server. The CREATE ASSEMBLY statement is used to register the assembly with the server. Examples are given below.

Figure 0004728675
Figure 0004728675

この例において、FROM句は、ロードするアセンブリのパス名を指定する。   In this example, the FROM clause specifies the path name of the assembly to load.

SQLサーバは従来、整数、浮動小数、日付、時間、および文字列などの「組み込み(built-in)」スカラタイプ(scalar type)をサポートしていた。こうした組み込みタイプは、+、−、*、/など1組の組み込み演算ならびにこうしたタイプに対する組み込み関数も伴う。こうしたタイプ、演算、および関数は、製品によって構築されパッケージされ、ユーザは独自のタイプを定義することができないという意味で、「組み込み」である。   SQL servers have traditionally supported "built-in" scalar types such as integers, floats, dates, times, and strings. Such built-in types also involve a set of built-in operations such as +, −, *, /, as well as built-in functions for these types. These types, operations, and functions are “built-in” in the sense that they are built and packaged by the product and users cannot define their own types.

SQLサーバなどのデータベースシステムは、データベースシステムにおいてスカラタイプとして働くが、他のものの中でもXおよびY座標からなる「ポイント」タイプを作成するようなより複雑な構造および動作を含む新しいタイプをユーザが作成できるように、データベースシステムのタイプシステムをユーザが拡張できるようにすることが望ましい。この点において、SQL標準および一部のデータベース管理システム(DBMS:database management system)製品は、いくつかの形のタイプの拡張性を記述するのに「ユーザ定義タイプ(user-defined type)」という用語を用いている。たとえば、SQL−99標準は、既存のSQL組み込みデータタイプの値である内部表現をもつようにユーザによって定義することができるタイプである「区別(distinct)タイプ」について述べている。区別タイプは、比較および算術演算子、タイプの変換、ならびに集約(列)関数(たとえば、max、min、average)を、既存のスカラタイプと任意選択で共有することができる。区別タイプは、その値に対して制約を定義させることができる。さらに、区別タイプは、ユーザ定義関数により区別タイプ特有の新しい関数を定義することによって、既存のスカラタイプの動作を超える動作を公開することができる。タイプの検査に関して、区別タイプおよび既存スカラタイプは、異なるタイプであるとみなされる。   Database systems, such as SQL Server, act as scalar types in database systems, but users create new types that include more complex structures and operations, such as creating "point" types consisting of X and Y coordinates, among other things It would be desirable to allow the user to extend the type system of the database system so that it can. In this regard, the SQL standard and some database management system (DBMS) products use the term “user-defined type” to describe some form of extensibility. Is used. For example, the SQL-99 standard describes a “distinct type”, a type that can be defined by a user to have an internal representation that is the value of an existing SQL built-in data type. A distinction type can optionally share comparison and arithmetic operators, type conversions, and aggregation (column) functions (eg, max, min, average) with existing scalar types. A distinction type can have a constraint defined on its value. Furthermore, a distinction type can expose behavior beyond that of existing scalar types by defining a new function specific to the distinction type with a user-defined function. With respect to type checking, distinct types and existing scalar types are considered to be different types.

区別タイプ(distinct type)の利点は、容易に定義できることである。新しいタイプの内部表現が、既存の組み込みタイプを有して記述することができる1個のデータメンバーをもち、組み込みタイプが、新しいタイプにおいて必要とされる動作のほとんどを既に構築している場合、区別タイプは、魅力的な代替物である。ユーザは、タイプ、コンストラクタ、比較演算子(順序づけおよび索引づけに用いられる)、算術演算子、ならびにタイプの変換(キャスト)演算子のディスク上での格納を管理するのに必要とされる動作の構築について心配する必要がない。ユーザは、基底の組み込みタイプのどのような機能が、区別タイプにおいて公開される必要があるかを選び、任意選択で、新しいタイプにおける値または追加関数に対する制約を追加するだけでよい。区別タイプの別の利点は、ヒストグラムの計算など、組み込みタイプ用に利用可能なクエリ処理がすべて、区別タイプの列に対して容易に用いることができることである。ただし、区別タイプの欠点は、より複雑なタイプを作成するのには安易に用いることができないことである。   The advantage of the distinct type is that it can be easily defined. If the new type's internal representation has one data member that can be described with an existing built-in type, and the built-in type has already built most of the behavior required for the new type: The distinction type is an attractive alternative. The user is responsible for managing the storage of types, constructors, comparison operators (used for ordering and indexing), arithmetic operators, and type conversion (cast) operators on disk. There is no need to worry about construction. The user only needs to select what functionality of the underlying built-in type needs to be exposed in the distinct type and optionally add constraints on values or additional functions in the new type. Another advantage of the distinction type is that all query processing available for built-in types, such as histogram calculations, can be easily used for distinction type columns. However, the disadvantage of distinct types is that they cannot be used easily to create more complex types.

SQL−99標準はまた、ユーザによって定義することができるタイプであり、それぞれが異なるSQL内蔵タイプのメンバーでもユーザ定義タイプのメンバーでもよいデータメンバーからなるコレクションである、内部表現をもつ「構造タイプ(structured type)」について述べている。このタイプは、CおよびC++におけるstructの概念に似ている。SQL−99は、構造タイプを定義するスタイルについて述べている。このスタイルを用いることにより、ユーザは、内部構造について構造タイプを定義するだけでよい。システムは、そのデータメンバー、コンストラクタ、および関数においてアクセス関数およびミューテータ関数を自動的に生成して、構造タイプのインスタンスのディスク上での表現を管理する。   The SQL-99 standard is also a type that can be defined by the user and is a collection of data members, each of which may be a member of a different SQL built-in type or a member of a user-defined type. structured type) ”. This type is similar to the concept of struct in C and C ++. SQL-99 describes a style that defines structure types. By using this style, the user need only define the structure type for the internal structure. The system automatically generates access and mutator functions in its data members, constructors, and functions to manage the representation on disk of instances of structured types.

SQLで定義される構造タイプに特有の利点は、(a)タイプの基本動作(basic behavior)の定義が容易であること、および(b)より複雑なタイプを定義するための柔軟性である。しかし、構造タイプの重大な欠点は、通常、CやC++のような汎用(general-purpose)プログラミング言語で書かれた外部関数により定義される、タイプ特有のメソッドの定義が複雑なことである。構造タイプを完全に定義するために、タイプを定義する人は、SQLと他の何らかのプログラミング言語との間の妥協点を探る必要がある。   The unique advantages of structure types defined in SQL are (a) the ease of defining basic behavior of types and (b) the flexibility to define more complex types. However, a significant drawback of structured types is the complexity of defining type-specific methods, usually defined by external functions written in general-purpose programming languages such as C and C ++. In order to fully define a structure type, the person defining the type needs to seek a compromise between SQL and some other programming language.

SQL99の区別タイプ(distinct type)および構造タイプ(structured type)の特徴は、ユーザによるSQLデータベースの既存スカラタイプシステム(existing scalar type system)の拡張(extend)を可能にすることによって、ユーザにある程度の利点をもたらすが、スカラタイプとして働くがより複雑な構造および動作を含むユーザ定義タイプによりデータベースシステムのスカラタイプシステムをユーザが拡張できるようにさせる、改良システムおよび方法が必要とされている。   The distinct type and structured type features of SQL99 make it possible for the user to extend the existing scalar type system of the SQL database to some extent by allowing the user to extend the existing scalar type system. There is a need for improved systems and methods that provide advantages, but allow the user to extend the scalar type system of the database system with user-defined types that act as scalar types but include more complex structures and operations.

2004年2月10日に出願した米国特許出願第10/775,282号(整理番号MSFT−3029/307007.01)「SYSTEM AND METHOD FOR PROVIDING USER DEFINED TYPES IN A DATABASE SYSTEM」(これ以降、UDT特許出願)において開示される発明は、スカラタイプとして働くがより複雑な構造および動作を含むユーザ定義タイプを作成することによって、ユーザがデータベースシステムのスカラタイプシステムを拡張することを可能にするシステムおよび方法を対象とする。この発明によると、ユーザは、ユーザ定義タイプのインスタンスにおいて呼び出すことができるユーザ定義タイプおよびメソッドの構造を定義するクラスを構築する高度なプログラミング言語でプログラムコードを書く。この発明(および本明細書)において用いられる「構造」という用語は、ユーザ定義タイプを参照するとき、そのタイプを構築するフィールドまたはプロパティの組を包含する。UDT特許出願における各フィールドのタイプは、スカラSQLタイプでも、予め定義されたどのユーザ定義タイプでもよい。ユーザ定義タイプを定義するクラスは次いで、コンパイルされ、データベースシステムに登録される。具体的には、ユーザ定義タイプを定義するCLRクラスは、コンパイルされてアセンブリになることができ、このアセンブリは次いで、CREATE ASSEMBLYデータ定義ステートメントによりデータベースシステムに登録される。アセンブリが登録された後、ユーザは、CREATE TYPEデータ定義ステートメントを用いて、ユーザ定義タイプを定義するアセンブリにクラスを登録することができる。   US Patent Application No. 10 / 775,282 filed February 10, 2004 (reference number MSFT-3029 / 307007.01) “SYSTEM AND METHOD FOR PROVIDING USER DEFINED TYPES IN A DATABASE SYSTEM” (hereinafter UDT patent) The invention disclosed in this application is a system and method that allows a user to extend the scalar type system of a database system by creating user-defined types that act as scalar types but include more complex structures and operations. Is targeted. According to the present invention, a user writes program code in an advanced programming language that builds classes that define the structure of user-defined types and methods that can be invoked on instances of user-defined types. As used herein (and herein), the term “structure” when referring to a user-defined type encompasses the set of fields or properties that make up that type. The type of each field in the UDT patent application may be a scalar SQL type or any predefined user-defined type. The class that defines the user-defined type is then compiled and registered with the database system. Specifically, a CLR class that defines a user-defined type can be compiled into an assembly, which is then registered in the database system with a CREATE ASSEMBLY data definition statement. After the assembly is registered, the user can register the class with the assembly that defines the user-defined type using the CREATE TYPE data definition statement.

UDT特許出願の発明の場合、データベースシステムは、ユーザ定義タイプがSQLタイプシステムにおいてスカラとして働くことを可能にするためにクラスが構築しなければならないある特定のコントラクトを強制する。この発明(および本明細書)において用いられる「コントラクト(contract)」という用語は、実行されるコードが、正しく実行されることを確かめるために、特定の前提条件または要件を満たすことを調べるためにオブジェクト指向プログラミング環境において実行時に利用される技術を指す。この発明によると、ユーザ定義タイプを定義するクラスと比較されるコントラクトは、いくつかの要件を含む。第1に、クラスは、データベースストア中でユーザ定義タイプであるインスタンスを保持する複数の異なるフォーマットの1つを指定しなければならない。第2に、クラスは、ユーザ定義タイプに対してヌル値を返すことができなければならない。第3に、クラスは、ユーザ定義タイプとストリングタイプなど別のタイプとの間で変換を行う方法を提供しなければならない。こうした要件が満たされると、データベースシステムは、ユーザ定義タイプであるインスタンスを作成することを可能にする。この出願の一実施形態では、ユーザ定義タイプは、テーブルの列の値、変数、ルーチンのパラメータ、またはルーチンの戻り値としてインスタンス化することができる。データベースシステムは、ユーザ定義タイプを定義するクラスについてのメタデータを、そのタイプであるインスタンスの作成において後で使うために格納する。この発明の別の実施形態では、ユーザ定義タイプのコントラクトの検証は、そのタイプを定義するクラスを記述するメタデータを用いて実施される。   In the case of the UDT patent application invention, the database system enforces certain contracts that the class must construct to allow user-defined types to act as scalars in the SQL type system. The term “contract” as used in this invention (and herein) is used to check that the code being executed meets certain prerequisites or requirements to ensure that it executes correctly. A technology used at runtime in an object-oriented programming environment. According to the present invention, a contract that is compared to a class that defines a user-defined type includes several requirements. First, the class must specify one of several different formats that hold instances that are user-defined types in the database store. Second, the class must be able to return a null value for user-defined types. Third, the class must provide a way to convert between user-defined types and other types such as string types. When these requirements are met, the database system allows to create instances that are user-defined types. In one embodiment of this application, user-defined types can be instantiated as table column values, variables, routine parameters, or routine return values. The database system stores metadata about a class that defines a user-defined type for later use in creating an instance of that type. In another embodiment of the invention, the validation of a user-defined type contract is performed using metadata describing the class that defines the type.

ユーザ定義タイプのインスタンスを保持する、異なる複数のフォーマットは、データベースシステムのネイティブフォーマットに従ってユーザ定義タイプのインスタンスが自動的にシリアル化される第1のフォーマットと、ユーザ作成クラスによって定義されたやり方でユーザ定義タイプのインスタンスがシリアル化される第2のフォーマットとを含む。さらに、UDT特許出願の発明が、MICROSOFT.NET CLRが統合されているMICROSOFT SQLサーバ内で実施されるとき、MICROSOFT.NETフレームワークによって提供される方法に従ってユーザ定義タイプのインスタンスがシリアル化される第3のフォーマットが利用可能である。   Different formats that hold instances of user-defined types are the first format in which user-defined type instances are automatically serialized according to the native format of the database system, and in a manner defined by user-created classes. A second format in which instances of the definition type are serialized. Furthermore, the invention of the UDT patent application is MICROSOFT. When NET CLR is implemented in the integrated MICROSOFT SQL server, MICROSOFT. A third format is available in which instances of user-defined types are serialized according to the methods provided by the NET framework.

UDT特許出願の発明の場合、データベースシステムの照会言語における表現は、ユーザ定義タイプのインスタンス(群)への1つまたは複数の参照を含むことができ、そうすることによって、表現の評価がユーザ定義タイプのインスタンスにおけるメソッドの呼び出しを必要とするようになる。データベースシステムは、このような照会言語表現を受け取ると、その表現を、一連のプログラムコード命令に翻訳する。こうした命令は、実行されると、ユーザ定義タイプのインスタンスにおける、必要とされるメソッドを呼び出す。データベースシステムは次いで、照会言語表現を評価した結果として、メソッド呼び出しの結果を返す。一実施形態では、ユーザ定義タイプのインスタンスは、インスタンスにおけるメソッドの呼び出しに先立ってシリアル化解除(deserialize)される。   In the case of the invention of the UDT patent application, the representation in the query language of the database system can include one or more references to the instance (s) of the user-defined type, so that the evaluation of the representation is user-defined. Requires a method call on the type instance. When the database system receives such a query language expression, it translates the expression into a series of program code instructions. When executed, these instructions call the required methods on the user-defined type instance. The database system then returns the result of the method call as a result of evaluating the query language expression. In one embodiment, an instance of a user-defined type is deserialized prior to invoking a method on the instance.

この発明の別の特徴は、ミューテータメソッドの呼び出しによってユーザ定義タイプのインスタンスの値を変更できることである。具体的には、ユーザ定義タイプを定義するクラスのオーサーは、クラスの一部としてミューテータメソッドを含む。ユーザ定義タイプのインスタンスにおいて呼び出されると、ミューテータメソッドは、ユーザ定義タイプの値を変更することを可能にする。このプロセスは、ユーザ定義タイプのインスタンスをシリアル化解除し、インスタンスのシリアル化解除されたデータの値を変更するためにミューテータメソッドを呼び出し、次いで、変更を保持するために、修正されたユーザ定義タイプのインスタンスをシリアル化することを含むことができる。   Another feature of the present invention is that the value of an instance of a user-defined type can be changed by calling a mutator method. Specifically, the author of a class that defines a user-defined type includes a mutator method as part of the class. When called on an instance of a user-defined type, the mutator method allows the value of the user-defined type to be changed. This process deserializes an instance of a user-defined type, calls a mutator method to change the value of the instance's deserialized data, and then modifies the modified user-defined type to hold the change Can be serialized.

この発明の別の特徴は、ユーザ定義タイプインスタンスのシリアル化されたバイナリ表現がバイナリ順となることを指定する属性を、ユーザ定義タイプを定義するクラスがさらに含むことができることである。この特徴により、ユーザ定義タイプのインスタンスに対してバイナリ比較を行うことができるようになり、ユーザ定義タイプのインスタンスに対して索引づけを実施することもできるようになる。具体的には、バイナリ順であるユーザ定義タイプのインスタンスの場合、そのタイプの2つのインスタンスの何らかの比較(たとえば、>、<、または=)を必要とする照会言語表現が、データベースシステムによって受け取られると、この2つのインスタンスのシリアル化されたバイナリ表現は、どちらのインスタンスもシリアル化解除することなく、その表現を評価するのに使うことができる。さらに、バイナリ順であるユーザ定義タイプの場合、ユーザ定義タイプとして定義された列をもつ、データベースストア中のテーブルを作成することができる。次いで、列に対して索引を作成することができる。索引は、ユーザ定義タイプを参照する照会言語表現に対して作成することもできる。この場合、表現に対して計算された列が最初に生成され、次いで、計算された列に対して索引が作成される。   Another feature of the present invention is that the class defining the user-defined type can further include an attribute specifying that the serialized binary representation of the user-defined type instance is in binary order. This feature allows binary comparisons to be performed on user-defined type instances and indexing to be performed on user-defined type instances. Specifically, for instances of user-defined types that are in binary order, a query language expression that requires some comparison (eg,>, <, or =) of two instances of that type is received by the database system. And the serialized binary representation of the two instances can be used to evaluate the representation without deserializing either instance. Further, for user-defined types that are in binary order, a table in the database store can be created with columns defined as user-defined types. An index can then be created on the column. An index can also be created for query language expressions that reference user-defined types. In this case, a calculated column for the representation is first generated, and then an index is created for the calculated column.

コレクション(collection)
データ量の多いアプリケーションは、現実世界の部分を取り込むのにオブジェクトデータモデルを用いる(「オブジェクトデータモデリング(object data modeling)」としても知られる)。エンティティ(entity)(たとえば、項目に基づくハードウェア/ソフトウェアインターフェイスシステムにおける「項目(item)」)および関係は、2つの共通データモデル構成である。たとえば、作成者およびドキュメントが、2つのタイプのエンティティである場合、作成者とドキュメントの間には、いくつか例を挙げると、「すべてのドキュメントがある作成者によって書かれた」および「すべてのドキュメントがある作成者によって見直された」など、いくつかの関係が存在し得る。
Collection
Applications with large amounts of data use object data models to capture real-world parts (also known as “object data modeling”). Entities (eg, “items” in item-based hardware / software interface systems) and relationships are two common data model constructs. For example, if the author and the document are two types of entities, between the author and the document, “all documents were written by one author” and “all There can be several relationships, such as “a document has been reviewed by an author”.

エンティティは、スカラ値および/またはコレクション値(もしくは組の値)でよい1組のプロパティを含む。たとえば、作成者エンティティは、作成者の名前および誕生日に関するスカラ値プロパティ、ならびに作成者の1組のアドレスならびに1組の電話番号に関するコレクション値プロパティを含むことができる。スカラ値プロパティのような、こうしたコレクション値プロパティは、エンティティに組み込まれる。つまり、そのエンティティの一部とみなされ、単にそのエンティティから別のエンティティへ定義された関係ではない。こうしたコレクション(別名「組み込みコレクション(embedded collection)」)はそれぞれ、通常、少数のメンバー(または「要素(element)」)を含み、いくつかの例では、こうしたコレクションのメンバーは、重要度(importance)の相対順序(relative order)をもつことができる(たとえば、作成者が主アドレス、副アドレスをもつ場合、など)。本明細書で使用する順序なしコレクションは、「多重集合(multiset)」と呼ばれ、順序つきコレクション(ordered collection)は、コレクション中のメンバーの相対順序(relative order)をさらに明らかにする多重集合の拡張である「リスト(list)」と呼ばれる。   An entity includes a set of properties that can be scalar values and / or collection values (or sets of values). For example, the creator entity may include a scalar value property for the creator's name and date of birth, and a collection value property for the creator's set of addresses and a set of phone numbers. These collection value properties, such as scalar value properties, are built into entities. That is, it is considered part of that entity, not just a relationship defined from that entity to another entity. Each of these collections (aka “embedded collections”) typically includes a small number of members (or “elements”), and in some examples, the members of these collections are expressed in importance. Relative order (for example, if the creator has a primary address, secondary address, etc.). As used herein, an unordered collection is referred to as a “multiset” and an ordered collection is a multi-set that further reveals the relative order of the members in the collection. It is called an extension “list”.

拡張可能リレーショナルデータストア(extendable relational data store)
コレクション(collection)は、既存データベース製品(existing database product)に実装(implement)されているが、こうした製品は一般に、一次キー(primary key)−外部キー(foreign key)という概念(concept)など、値に基づく関係を用いてコレクションをモデル化し、このようなものであるために、リレーショナル照会可能オブジェクトとして扱うことができない。さらに、コレクションはリレーショナル照会可能オブジェクトではないので、たとえば「X市に住むすべての人の連絡先を返す」ための、コレクションへのクエリは概して、コレクションのパスすべてを巡回する必要がある。
Extendable relational data store
Collections are implemented in existing database products, but these products generally have values such as the concept of primary key-foreign key. A collection is modeled using relations based on and thus cannot be treated as a relational queryable object. Furthermore, since collections are not relational queryable objects, queries to collections, such as “return the contacts of all people living in X City”, generally need to go through the entire collection path.

拡張可能リレーショナルデータストア(ERDS: (extendable relational data store))とは、UDTの構築(implementation of UDTs)を記述している、2004年2月10日に出願した米国特許出願第10/775,282号(整理番号MSFT−3029/307007.01)「SYSTEM AND METHOD FOR PROVIDING USER DEFINED TYPES IN A DATABASE SYSTEM」において説明されているユーザ定義タイプ(UDT)としてエンティティがモデル化されることを可能にするリレーショナルデータストアである。ERDSでは、こうしたコレクションをユーザ定義タイプ(UDT)の一部としてモデル化することがより自然であり便利であろう。UDTにおいて、コレクションUDTは、そうすることが適切な場合、スカラおよびリレーション両方として扱うことができよう。   Extensible Relational Data Store (ERDS) is a US patent application Ser. No. 10 / 775,282 filed Feb. 10, 2004 that describes the implementation of UDTs. Relational that allows entities to be modeled as user-defined types (UDTs) as described in the issue (reference number MSFT-3029 / 307007.01) "SYSTEM AND METHOD FOR PROVIDING USER DEFINED TYPES IN A DATABASE SYSTEM" It is a data store. In ERDS, it would be more natural and convenient to model these collections as part of a user-defined type (UDT). In UDT, the collection UDT could be treated as both a scalar and a relation where it is appropriate to do so.

したがって、当該分野において、ERDSにおけるUDTの一部、ならびにスカラとして処理することもリレーションとして照会することもできるコレクションとして、コレクションをモデル化する方法が必要である。   Therefore, there is a need in the art for a way to model a collection as part of a UDT in ERDS, as well as a collection that can be processed as a scalar or queried as a relation.

本発明のいくつかの実施形態は、拡張リレーショナルデータストア(ERDS:extendable relational data store)のUDTフレームワークを、順序なしコレクション(多重集合)および順序つきコレクション(リスト)のサポートを含むように拡張するシステムおよび方法を対象とする。より詳細には、本発明のいくつかの実施形態では、UDTインフラストラクチャ(infrastructure)、CLRジェネリック(generic)、および新たなUNNEST演算子(operator)を用いて、同時にスカラ(scalar)であり且つリレーション(relation)である、コレクションの特別なタイプ(special type)の抽象化を作成し利用する。スカラとして、このコレクションタイプは、スカラを理解するデータストアエンジンのすべての部分(クライアントスタック(client stack)を含むがそれに限定されない)によって処理することができ、リレーションとして、このコレクションタイプ(collection type)は、他のどのタイプのリレーションのようにも照会可能(queriable)である。   Some embodiments of the present invention extend the extended relational data store (ERDS) UDT framework to include support for unordered collections (multiple sets) and ordered collections (lists). Intended for systems and methods. More particularly, in some embodiments of the present invention, a UDT infrastructure, a CLR generic, and a new UNNEST operator are simultaneously scalar and relational. Create and use a special type of collection abstraction, which is a (relation). As a scalar, this collection type can be processed by any part of the data store engine that understands the scalar (including but not limited to the client stack), and as a relation this collection type Is queriable like any other type of relation.

本発明の様々な実施形態は、スカラでありかつリレーションであるコレクションタイプを含むデータストアを対象とする。こうした実施形態の一部の場合、本方法は、(a)本質的にデータストアエンジン(data store engine)のスカラタイプシステム(scalar type system)にスカラとして登録されるコレクションタイプのための抽象化UDT(UDT abstraction)を作成すること、および(b)必要に応じて、リレーショナル照会可能オブジェクト(relational queriable object)としてコレクション(collection)を照会(query)するために前記コレクションをネスト解除(unnesting)することを含む。   Various embodiments of the present invention are directed to a data store that includes a collection type that is a scalar and a relation. In some of these embodiments, the method includes (a) an abstraction UDT for a collection type that is registered as a scalar essentially in the data store engine's scalar type system. Creating a (UDT abstraction), and (b) optionally unnesting the collection to query the collection as a relational queriable object including.

本発明のいくつかの実施形態は、前記コレクションに適用されるスカラ演算(scalar operation)のためにスカラとして処理され、前記コレクションに適用されるクエリ操作(query operation)のためにリレーションとして照会される、リレーショナルデータストア中のエンティティのための拡張コレクションを対象とする。こうしたある実施形態の場合、リレーショナルストア(relational store)は、拡張可能リレーショナルデータストア(extendable relational data store)であり、前記コレクションは、共通言語ランタイム(CLR:common language runtime)においてジェネリックユーザ定義タイプ(generic user-defined type)から派生されると共に、(SQLスカラタイプシステムでは)SQLスカラタイプ(SQL scalar type)でもある。こうした実施形態のいくつかでは、コレクションに対応するコレクションタイプ(collection type)およびユーザ定義タイプ(user-defined type)の両方をリレーショナルデータストアに登録(register)することが必要である。さらに、特定の実施形態では具体的には、前記コレクションに対してネスト解除演算(unnesting operation)を用いて、前記コレクションを、第1の列(column)を含むリレーショナル照会可能オブジェクト(relational queriable object)に変換し、前記第1の列の各行は、前記コレクションの単一のメンバー(single member)に対応する(すなわち、多重集合(multiset)用のコレクション)。他の実施形態は、第2の列をさらに含み、前記第2の列の各行(row)は、前記コレクションの単一のメンバーに対応し、(リスト用の)前記順序つきコレクション(ordered collection)中の前記各メンバーの順序に対応する値をもつ。いくつかの特定の実施形態の場合、多重集合(multiset)およびリスト(list)の両方は、同じ2列のリレーショナル照会可能オブジェクトを用いる(第2の列は、順序が重要でない場合は多重集合に関しては単に無視される)。   Some embodiments of the present invention are treated as scalars for scalar operations applied to the collection and queried as relations for query operations applied to the collection. Target an extended collection for entities in a relational data store. In one such embodiment, the relational store is an extendable relational data store, and the collection is a generic user-defined type (generic) in a common language runtime (CLR). It is derived from user-defined type and is also a SQL scalar type (in the SQL scalar type system). Some of these embodiments require that both the collection type and user-defined type corresponding to the collection be registered in the relational data store. Further, in a particular embodiment, specifically, the collection is made into a relational queriable object that includes a first column using an unnesting operation on the collection. And each row of the first column corresponds to a single member of the collection (ie, a collection for a multiset). Other embodiments further include a second column, wherein each row of the second column corresponds to a single member of the collection, and the ordered collection (for lists). It has a value corresponding to the order of each said member in it. For some specific embodiments, both multisets and lists use the same two-column relational queryable object (the second column is related to multiple sets if order is not important) Is simply ignored).

添付の図面と併せ読むことによって、上述の要約、ならびに好ましい実施形態の以下の詳細な説明がよりよく理解されよう。ただし、本発明は、開示する特定の方法および手段に限定されるものではない。   The foregoing summary, as well as the following detailed description of the preferred embodiments, will be better understood when read in conjunction with the appended drawings. However, the invention is not limited to the specific methods and instrumentalities disclosed.

本出願は、その内容全体が参照により本明細書に組み込まれている、2004年4月30日に出願した米国特許仮出願第60/566,740号(整理番号MSFT−3940/307228.01)「SYSTEMS AND METHODS FOR THE IMPLEMENTATION OF MULTISETS IN A DATABASE SYSTEM」の利益を主張する。さらに、本出願は、その内容が参照により本明細書に組み込まれている、2004年2月10日に出願した米国特許出願第10/775,282号(整理番号MSFT−3029/307007.01)「SYSTEM AND METHOD FOR PROVIDING USER DEFINED TYPES IN A DATABASE SYSTEM」の一部継続出願である、2004年5月3日に出願した米国特許出願第10/837,929号(整理番号MSFT−3843/307227.01)「SYSTEMS AND METHODS FOR SUPPORTING INHERITANCE FOR USER-DEFINED TYPES」の一部継続出願でもある。   This application is a US Provisional Application No. 60 / 566,740 filed Apr. 30, 2004 (Docket No. MSFT-3940 / 307228.01), the entire contents of which are incorporated herein by reference. Insist on the benefits of “SYSTEMS AND METHODS FOR THE IMPLEMENTATION OF MULTISETS IN A DATABASE SYSTEM”. Further, this application is a US patent application Ser. No. 10 / 775,282 filed Feb. 10, 2004 (Docket No. MSFT-3029 / 307007.01), the contents of which are incorporated herein by reference. No. 10 / 837,929 (reference number MSFT-3843 / 307227. Filed on May 3, 2004), which is a continuation-in-part of "SYSTEM AND METHOD FOR PROVIDING USER DEFINED TYPES IN A DATABASE SYSTEM". 01) It is also a partial continuation application of “SYSTEMS AND METHODS FOR SUPPORTING INHERITANCE FOR USER-DEFINED TYPES”.

本出願は、その内容全体が参照により本出願に組み込まれている、本発明の譲受人に譲渡された出願、すなわち2004年4月9日に出願した米国特許出願第10/821,687号(整理番号MSFT−2955/307064.01)「SYSTEMS AND METHODS FOR FRAGMENT-BASED SERIALIZATION」、2003年10月23日に出願した米国特許出願第10/692,225号(整理番号MSFT−2852/306819.01)「SYSTEM AND METHOD FOR OBJECT PERSISTENCE IN A DATABASE STORE」、および2004年3月8日に出願した米国特許出願第10/795,623号(整理番号MSFT−2960/307232.01)「STRUCTURED INDEXES ON RESULTS OF FUNCTION APPLICATIONS OVER DATA」で開示される発明に対象が関連する。   This application is assigned to the assignee of the present invention, the entire contents of which are incorporated herein by reference, ie, US patent application Ser. No. 10 / 821,687 filed on Apr. 9, 2004 ( (Reference number MSFT-2955 / 307006.01) "SYSTEMS AND METHODS FOR FRAGMENT-BASED SERIALIZATION", US patent application Ser. No. 10 / 692,225 filed on Oct. 23, 2003 (reference number MSFT-2852 / 3068.19.01). ) “SYSTEM AND METHOD FOR OBJECT PERSISTENCE IN A DATABASE STORE” and US patent application Ser. No. 10 / 795,623 filed Mar. 8, 2004 (reference number MSFT-2960 / 307232.01) “STRUCTURED INDEXES ON RESULTS The object relates to the invention disclosed in “OF FUNCTION APPLICATIONS OVER DATA”.

本発明を説明するために、本発明の例示的な構成を図面に示す。しかし、本発明は、開示する特定の方法および手段に限定されるものではない。   For the purpose of illustrating the invention, there are shown in the drawings exemplary constructions of the invention. However, the invention is not limited to the specific methods and instrumentalities disclosed.

法的要件を満たすために、本発明の主題を明確に説明する。ただし、説明自体は、本特許の範囲を限定することを意図していない。本発明者は、特許請求の対象が、本文書において説明されるものと類似した、異なるステップまたは要素を含むように、現在または将来の他の技術と共に、他の方法でも実施されることを企図している。さらに、「ステップ(step)」という用語は、本明細書において、利用される方法の異なる要素を意味するのに用いられ得るが、この用語は、個々のステップの順序が明確に記述されない限り、本明細書において開示される様々なステップの間のいかなる具体的な順序も含意すると解釈すべきでない。   In order to meet legal requirements, the subject matter of the present invention is clearly described. However, the description itself is not intended to limit the scope of this patent. The inventor contemplates that the claimed subject matter may be implemented in other ways, along with other technology now or in the future, to include different steps or elements similar to those described in this document. is doing. Furthermore, the term “step” may be used herein to mean different elements of the utilized method, but unless the order of the individual steps is explicitly stated, the term Any specific order between the various steps disclosed herein should not be construed as implying.

以下で説明する実施形態において、本発明の上記の特徴は、MICROSOFT SQLサーバデータベースシステムにおいて構築されるものとして説明していく。上述したように、SQLサーバは、マネージドコードがSQLサーバデータベースのデータストアに対して作用するように書かれ実行されることを可能にするために、MICROSOFT.NET共通言語ランタイム(CLR)を組み込む。以下で説明する実施形態は、このコンテキストにおいて作用するが、本発明は、SQLサーバ製品での実施に決して限定されないことを理解されたい。そうではなく、本発明は、オブジェクトリレーショナル拡張を伴うオブジェクト指向データベースシステムおよびリレーショナルデータベースシステムなど、データベースストアに対して作用する、オブジェクト指向プログラミングコードの実行をサポートするどのデータベースシステムにおいても実施することができる。したがって、本発明は、以下で説明する特定の実施形態に限定されず、特許請求の範囲において定義される本発明の精神および範囲内であるすべての修正形態を包含することを意図していることを理解されたい。   In the embodiments described below, the above features of the present invention will be described as being built in the MICROSOFT SQL server database system. As described above, the SQL server is MICROSOFT.NET to allow managed code to be written and executed to operate against the data store of the SQL server database. Incorporates the NET Common Language Runtime (CLR). Although the embodiments described below work in this context, it should be understood that the present invention is in no way limited to being implemented in a SQL server product. Rather, the present invention can be implemented in any database system that supports execution of object-oriented programming code that operates against a database store, such as object-oriented database systems with object-relational extensions and relational database systems. . Accordingly, the invention is not limited to the specific embodiments described below, but is intended to encompass all modifications that are within the spirit and scope of the invention as defined in the claims. I want you to understand.

コンピュータ環境(computer environment)
本発明の数多くの実施形態は、コンピュータ上で実行することができる。図1および以下の説明は、本発明を実施することができる適切なコンピューティング環境の簡潔かつ全体的な説明の提供を意図している。そうすることが必要なわけではないが、クライアントワークステーションやサーバなどのコンピュータによって実行されるプログラムモジュールなどのコンピュータ実行可能命令という一般的な状況において本発明を説明する。概して、プログラムモジュールは、特定のタスクを実施し、または特定の抽象データタイプを構築(implement)するルーチン、プログラム、オブジェクト、コンポーネント、データ構造などを含む。さらに、本発明は、ハンドヘルドデバイス、マルチプロセッサシステム、マイクロプロセッサベースの家電またはプログラム可能な家電、ネットワークPC、ミニコンピュータ、メインフレームコンピュータなど他のコンピュータシステム構成と共に実施できることが当業者には理解されよう。本発明は、通信ネットワークを介してリンクされるリモート処理デバイスによって特定のタスクが実施される分散型コンピューティング環境でも実施することができる。分散型コンピューティング環境では、プログラムモジュールは、ローカルおよびリモートメモリ記憶装置両方に置くことができる。
Computer environment
Many embodiments of the invention can be executed on a computer. FIG. 1 and the following description are intended to provide a concise and general description of a suitable computing environment in which the invention may be implemented. Although not required to do so, the invention is described in the general context of computer-executable instructions, such as program modules, being executed by a computer such as a client workstation or server. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. Further, those skilled in the art will appreciate that the present invention can be implemented with other computer system configurations such as handheld devices, multiprocessor systems, microprocessor-based or programmable home appliances, network PCs, minicomputers, mainframe computers, and the like. . The invention may also be practiced in distributed computing environments where certain tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules can be located in both local and remote memory storage devices.

図1に示すように、例示的な汎用コンピューティングシステムは、従来のパーソナルコンピュータ20などを含み、このコンピュータは、処理ユニット21、システムメモリ22、およびシステムメモリなど様々なシステムコンポーネントを処理ユニット21に結合するシステムバス23を含む。システムバス23は、様々なバスアーキテクチャのいずれかを使用するメモリバスまたはメモリコントローラ、周辺バス、およびローカルバスなどいくつかのタイプのバス構造のいずれでもよい。システムメモリは、ROM(読み出し専用メモリ)24およびRAM(ランダムアクセスメモリ)25を含む。BIOS26(基本入出力システム)は、たとえば起動中にパーソナルコンピュータ20内部の要素間の情報の転送を助ける基本ルーチンを含み、ROM24に格納される。パーソナルコンピュータ20は、図示していないハードディスクからの読み出しおよびそこへの書き込みを行うハードディスクドライブ27、取り外し可能磁気ディスク29からの読み出しまたはそこへの書き込みを行う磁気ディスクドライブ28、および、たとえばCD ROMや他の光学媒体などの取り外し可能光ディスク31からの読み出しまたはそこへの書き込みを行う光ディスクドライブ30をさらに含むことができる。ハードディスクドライブ27、磁気ディスクドライブ28、および光ディスクドライブ30は、それぞれハードディスクドライブインターフェイス32、磁気ディスクドライブインターフェイス33、および光ドライブインターフェイス34によって、システムバス23に接続される。こうしたドライブおよびそれに関連するコンピュータ可読媒体は、コンピュータ可読命令、データ構造、プログラムモジュール、および他のデータの不揮発性記憶をパーソナルコンピュータ20にもたらす。本明細書で説明する例示的な環境は、ハードディスク、取り外し可能磁気ディスク29、および取り外し可能光ディスク31を使用するが、コンピュータによってアクセス可能なデータを格納することができる、コンピュータ可読である他のタイプの媒体も、例示的な動作環境において使うことができることを当業者は理解されたい。このような他のタイプの媒体として、磁気カセット、フラッシュメモリカード、デジタルビデオディスク、ベルヌーイカートリッジ、RAM(ランダムアクセスメモリ)、ROM(読み出し専用メモリ)なども、例示的な動作環境において使うことができる。   As shown in FIG. 1, an exemplary general purpose computing system includes a conventional personal computer 20 or the like, which places various system components such as a processing unit 21, system memory 22, and system memory into the processing unit 21. A system bus 23 to be coupled is included. The system bus 23 may be any of several types of bus structures such as a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. The system memory includes a ROM (Read Only Memory) 24 and a RAM (Random Access Memory) 25. The BIOS 26 (basic input / output system) includes basic routines that help transfer information between elements inside the personal computer 20 during startup, for example, and is stored in the ROM 24. The personal computer 20 includes a hard disk drive 27 that reads from and writes to a hard disk (not shown), a magnetic disk drive 28 that reads from or writes to a removable magnetic disk 29, and a CD ROM, for example, It may further include an optical disk drive 30 that reads from or writes to a removable optical disk 31 such as other optical media. The hard disk drive 27, magnetic disk drive 28, and optical disk drive 30 are connected to the system bus 23 by a hard disk drive interface 32, a magnetic disk drive interface 33, and an optical drive interface 34, respectively. Such drives and associated computer readable media provide non-volatile storage of computer readable instructions, data structures, program modules, and other data to the personal computer 20. The exemplary environment described herein uses a hard disk, a removable magnetic disk 29, and a removable optical disk 31, but other types that are computer readable that can store data accessible by a computer. Those skilled in the art will appreciate that these media can also be used in an exemplary operating environment. As such other types of media, magnetic cassettes, flash memory cards, digital video disks, Bernoulli cartridges, RAM (Random Access Memory), ROM (Read Only Memory), etc. can also be used in an exemplary operating environment. .

オペレーティングシステム35、1つまたは複数のアプリケーションプログラム36、他のプログラムモジュール37、およびプログラムデータ38などいくつかのプログラムモジュールを、ハードディスク、磁気ディスク29、光ディスク31、ROM24、またはRAM25に格納することができる。ユーザは、キーボード40などの入力デバイス、およびポインティングデバイス42を介して、コマンドおよび情報をパーソナルコンピュータ20に入力することができる。他の入力デバイス(図示せず)は、マイクロホン、ジョイスティック、ゲーム用パッド、衛星パラボラアンテナ、スキャナなどを含み得る。こうしたおよび他の入力デバイスはしばしば、システムバスに結合されるシリアルポートインターフェイス46を介して処理ユニット21に接続されるが、他のインターフェイス、たとえば並列ポート、ゲームポート、USB(ユニバーサルシリアルバス)によって接続することもできる。モニタ47または他のタイプの表示デバイスも、ビデオアダプタ48などのインターフェイスを介してシステムバス23に接続される。モニタ47に加え、パーソナルコンピュータは通常、他の周辺出力デバイス(図示せず)、たとえばスピーカおよびプリンタを含む。図1の例示的なシステムは、ホストアダプタ55、SCSI(小型コンピューティングシステムインターフェイス)バス56、およびSCSIバス56に接続される外部記憶装置62も含む。   Several program modules, such as operating system 35, one or more application programs 36, other program modules 37, and program data 38, can be stored on the hard disk, magnetic disk 29, optical disk 31, ROM 24, or RAM 25. . A user can input commands and information into the personal computer 20 via an input device such as a keyboard 40 and a pointing device 42. Other input devices (not shown) may include a microphone, joystick, game pad, satellite dish, scanner, and the like. These and other input devices are often connected to the processing unit 21 via a serial port interface 46 coupled to the system bus, but connected by other interfaces such as parallel ports, game ports, USB (Universal Serial Bus). You can also A monitor 47 or other type of display device is also connected to the system bus 23 via an interface, such as a video adapter 48. In addition to the monitor 47, personal computers typically include other peripheral output devices (not shown), such as speakers and printers. The exemplary system of FIG. 1 also includes a host adapter 55, a SCSI (Small Computing System Interface) bus 56, and an external storage device 62 connected to the SCSI bus 56.

パーソナルコンピュータ20は、リモートコンピュータ49など1つまたは複数のリモートコンピュータへの論理接続を使用してネットワーク接続された環境において動作することができる。リモートコンピュータ49は、別のパーソナルコンピュータ、サーバ、ルータ、ネットワークPC、ピアデバイスまたは他の共通ネットワークノードでよく、通常、パーソナルコンピュータ20に関連して上述した要素の多くまたはすべてを含むが、図1にはメモリ記憶装置50のみを示してある。図1に示す論理接続は、LAN(ローカルエリアネットワーク)51およびWAN(ワイドエリアネットワーク)52を含む。このようなネットワーク環境は、会社、企業規模のコンピュータネットワーク、イントラネットおよびインターネットにおいてよく見られる。   Personal computer 20 can operate in a networked environment using logical connections to one or more remote computers, such as remote computer 49. The remote computer 49 may be another personal computer, server, router, network PC, peer device or other common network node, and typically includes many or all of the elements described above in connection with the personal computer 20, although FIG. Only the memory storage device 50 is shown. The logical connection shown in FIG. 1 includes a LAN (Local Area Network) 51 and a WAN (Wide Area Network) 52. Such network environments are common in companies, enterprise-wide computer networks, intranets and the Internet.

LANネットワーク環境において使われる場合、パーソナルコンピュータ20は、ネットワークインターフェイスまたはアダプタ53を介してLAN51に接続される。WANネットワーク環境において使われる場合、パーソナルコンピュータ20は通常、モデム54、または、たとえばインターネットなどのワイドエリアネットワーク52を介した通信を確立する他の手段を含む。モデム54は、内部にあっても外部にあってもよく、シリアルポートインターフェイス46を介してシステムバス23に接続される。ネットワーク接続された環境では、パーソナルコンピュータ20に関連して図示したプログラムモジュールまたはその一部は、リモートメモリ記憶装置に格納することができる。図示したネットワーク接続は例示的なものであり、コンピュータ間の通信リンクを確立する他の手段も使用できることが理解されよう。   When used in a LAN network environment, the personal computer 20 is connected to the LAN 51 via a network interface or adapter 53. When used in a WAN network environment, the personal computer 20 typically includes a modem 54 or other means of establishing communications over a wide area network 52 such as the Internet. The modem 54 may be internal or external and is connected to the system bus 23 via the serial port interface 46. In a networked environment, the program modules illustrated in connection with the personal computer 20 or portions thereof may be stored in a remote memory storage device. It will be appreciated that the network connections shown are exemplary and other means of establishing a communications link between the computers can be used.

本発明の数多くの実施形態は、コンピュータによるシステムに特に適合すると想像されるが、本文書のどの部分も、本発明をこのような実施形態に限定することを意図していない。反対に、本明細書で使用する「コンピュータシステム」という用語は、デバイスが本質的に電子、機械、論理、または仮想であるかに関わらず、情報を格納し処理することができ、かつ/またはこのようなデバイス自体の動作または実行を制御するのに、格納された情報を使うことができるあらゆるデバイスを包含することを意図する。   Although many embodiments of the present invention are envisioned to be particularly compatible with computer-based systems, no part of this document is intended to limit the present invention to such embodiments. Conversely, the term “computer system” as used herein can store and process information regardless of whether the device is electronic, mechanical, logical, or virtual in nature, and / or It is intended to encompass any device that can use stored information to control the operation or execution of such a device itself.

UDTおよびマネージドコード(managed code)
図2は、ユーザ定義タイプ(UDT:user defined type)のインスタンス(instance)のシリアル化(serialization)およびシリアル化解除(deserialization)を示すブロック図である。図に示すように、UDTのインスタンス(instance of UDT)が、メモリ中のインスタンスを表すオブジェクトのシリアル化を介して、ディスク上に保持される。アプリケーションが、UDTのインスタンスのメソッドを参照する述部または表現を含むクエリを生成すると、残された形のインスタンスがシリアル化解除され(「ハイドレーション(hydration)」とも呼ばれるプロセス)、CLRは、オブジェクトの格納された値を受け取るために完全なオブジェクト用にメモリを割り振る。CLRは次いで、アプリケーションまたはユーザが所望する動作を構築するオブジェクトにおいて、適切なメソッドを呼び出す。
UDT and managed code
FIG. 2 is a block diagram illustrating serialization and deserialization of an instance of a user defined type (UDT). As shown, an instance of UDT is maintained on disk via serialization of an object representing the instance in memory. When an application generates a query that includes a predicate or expression that references a method of an instance of UDT, the remaining form of the instance is deserialized (a process also called “hydration”), and the CLR Allocate memory for the complete object to receive the stored value. The CLR then invokes the appropriate method on the object that constructs the behavior desired by the application or user.

本明細書において上で説明したように、UDTは、SQLサーバに登録されるアセンブリで構築される、マネージドタイプ(managed type)である。UDTは、テーブル定義、変数、およびパラメータを含むネイティブタイプ(native type)を使うことができるほとんどのコンテキストにおいて使うことができる。UDTコントラクトに従う、UDTで定義されるメソッド、プロパティ、およびフィールドは、T−SQLから呼び出すことができる。本質的に、UDTは、動作を有する単純なスカラであると仮定される。この仮定は、UDTによってサポートされる単純なプログラミングモデルおよびシリアル化レイアウトに反映される。この構造は、抽象化UDTのために使われて、単純なスカラではなく複合構造および動作を有するタイプであり得る「構造化タイプ(structured type)」を作成することができる。   As explained hereinabove, UDT is a managed type that is built with assemblies registered with an SQL server. UDT can be used in most contexts where native types including table definitions, variables, and parameters can be used. Methods, properties, and fields defined in UDT that conform to the UDT contract can be called from T-SQL. In essence, the UDT is assumed to be a simple scalar with motion. This assumption is reflected in the simple programming model and serialization layout supported by UDT. This structure can be used for abstracted UDTs to create a “structured type” that can be a type with complex structure and behavior rather than a simple scalar.

コレクション(collections) - - 多重集合(multisets)
本発明の様々な実施形態は、同時にスカラ(scalar)でありリレーション(relation)である、つまり、スカラとして、(クライアントスタック(client stack)を含む)スカラを理解するデータストアエンジンのすべての部分の中を流れ、リレーションとして照会可能である、データストア抽象化(data store abstraction)(またはタイプ)を対象とする。こうした実施形態のいくつかでは、UDTインフラストラクチャ、CLRジェネリック、および新たなUNNEST演算子(operator)を同時に用いて、このような二元タイプ(dualistic type)を可能にする。
Collections--multisets
Various embodiments of the present invention are scalars and relations at the same time, that is, all parts of a data store engine that understand scalars (including client stacks) as scalars. For data store abstractions (or types) that flow through and can be queried as relations. In some of these embodiments, UDT infrastructure, CLR generics, and a new UNNEST operator are used simultaneously to enable such dualistic types.

図3は、拡張可能リレーショナルデータストア(ERDS)が二元コレクションタイプ(dualistic collection type)を提供することを可能にする全般的な方法を示すプロセスフロー図である。このようなタイプのコレクションを構築するために、ステップ302において、CLRのジェネリック特徴(generics feature)が、ジェネリックタイプ、たとえばコレクション<T>を定義するのに用いられる。このタイプは、「システムUDT」(すなわち、ある場所で定義されると、自動的にすべてのデータベースにおいて利用可能になるUDT)として作成され、SQLスカラタイプシステムの第1のクラス部分である。このようなものとして、このタイプは、列定義、変数、関数の引数、および格納された手順パラメータなど、スカラタイプがサポートされるコンテキストすべてにおいて使うことができる。こうしたタイプは、スカラ表現評価コンテキスト(scalar expression evaluation context)においてもサポートされる。   FIG. 3 is a process flow diagram illustrating a general method that allows an extensible relational data store (ERDS) to provide a dual collection type. To construct such a type of collection, at step 302, the generic features of the CLR are used to define a generic type, eg, collection <T>. This type is created as a "system UDT" (i.e., a UDT that automatically becomes available in all databases when defined at some location) and is the first class part of the SQL scalar type system. As such, this type can be used in all contexts where scalar types are supported, such as column definitions, variables, function arguments, and stored procedure parameters. These types are also supported in a scalar expression evaluation context.

ステップ304において、ジェネリックタイプは次いで、ジェネリックコレクションタイプの派生タイプ(derived type)としてのコンクリートコレクションタイプ(concrete collection type)、つまり、前記メンバーがもはやジェネリックではなく、スカラタイプまたは他の複合タイプ(complex type)として定義されるタイプを作成するのに用いることができる。この例では、コンクリートタイプはアドレス用であり、個々のメンバー(individual member)はスカラストリングタイプ(scalar string type)である。本発明の代替実施形態では、個々のメンバーは、スカラストリングタイプでなく、(番地用の)第1のストリング、(都市名用の)第2のストリング、(州用の)2つの文字、および(郵便番号用の)5桁の整数を含む複合タイプ(complex type)でもよい。   In step 304, the generic type is then a concrete collection type as a derived type of the generic collection type, i.e., the member is no longer generic, but a scalar type or other complex type. ) Can be used to create a type defined as In this example, the concrete type is for addresses and the individual members are scalar string types. In an alternative embodiment of the invention, the individual members are not of the scalar string type, but a first string (for street address), a second string (for city name), two characters (for state), and It may be a complex type containing a 5-digit integer (for zip codes).

コレクションが、ある特定のタイプ(particular type)の要素(element)を含むように宣言(declare)されると、そのUDTのサブタイプ(subtype)のどの値(value)も、そのコレクションに格納することができる(「代替可能(substitutability)」と呼ばれる)。コレクションタイプ(collection type)とその要素タイプ(element type)の間の関係は、タイプを作成する時(type creation type)にメタデータ(metadata)に記録され、照会可能なカタログビュー(queryable catalog view)を介して利用可能となり、こうすることにより、アプリケーションは、ある特定のコレクションタイプの代替可能範囲を判定するためのクエリを組み立てることができる。   When a collection is declared to contain an element of a particular type, any value of that UDT subtype is stored in that collection. (Referred to as “substitutability”). The relationship between a collection type and its element type is recorded in metadata when creating the type (type creation type) and is queryable catalog view This allows the application to construct a query to determine the range of possible replacements for a particular collection type.

ステップ306において、あるエンティティ自体がインスタンス生成されると、新たなコンクリートコレクションタイプ(concrete collection type)は、そのエンティティにおいてプロパティとして使うことができる。この時点で、順序コレクション(order collection)は、クエリが適用されない限り本質的にスカラプロパティ(scalar property)として扱われ、クエリが適用されると、データストアエンジン(data store engine)は、このコレクションタイプの特殊な特徴を認識(recognize)し、そのコレクションをリレーションとして処理する。   In step 306, when an entity itself is instantiated, the new concrete collection type can be used as a property in that entity. At this point, the order collection is essentially treated as a scalar property unless the query is applied, and when the query is applied, the data store engine Recognize special features of, and treat the collection as a relation.

コレクションをナビゲート(navigate)するために、クエリは通常、「X市に住むすべての人について返す」などの質問に答えるために、コレクション中のパス(path)を巡回(traverse)する必要がある。ただし、本発明のいくつかの実施形態の場合、クエリエンジン(query engine)は、この特殊コレクションシステムタイプ、たとえば「Collection<T>」が、リレーションセマンティクス(relation semantics)ならびにUDTに関連づけられたスカラセマンティクス(scalar semantics)の両方をもち、新たなリレーショナル演算子「UNNEST」が、必要に応じてこのスカラをリレーショナル照会可能オブジェクト(relational queryable object)に変形するのに用いられる。この演算子は、テーブル値関数がサポートされるコンテキストすべてにおいてサポートされ、UNNEST演算子を含むビュー定義が索引づけ可能である。   In order to navigate the collection, the query typically needs to traverse the paths in the collection to answer questions such as "Return for all people in X City" . However, in some embodiments of the present invention, the query engine is responsible for the special collection system type, eg, “Collection <T>”, in relation semantics and scalar semantics associated with UDT. A new relational operator “UNNEST” with both (scalar semantics) is used to transform this scalar into a relational queryable object as needed. This operator is supported in all contexts where table-valued functions are supported, and view definitions that include UNEST operators can be indexed.

図4は、エンティティにおいてコレクションに適用されるクエリを処理する方法を示すプロセスフロー図である。ステップ402において、コレクションに対してクエリが作成され、このコレクションがコレクションでなかった場合、クエリはデータストアエンジンに対してSQLエラーを生成するが、コレクションである場合、データストアエンジンは、ステップ404において、コレクションが特殊データタイプであると認識し、ステップ406において、コレクションをネスト解除(unnest)して、照会可能オブジェクトを作成する。このオブジェクトは、多重集合(multiset)用であり、この例では単列テーブル(single column table)である。ステップ408において、データストアエンジンは、クエリをこの照会可能オブジェクトに向け直す。   FIG. 4 is a process flow diagram illustrating a method for processing a query applied to a collection at an entity. In step 402, if a query is created for the collection and the collection is not a collection, the query generates an SQL error for the data store engine, but if it is a collection, the data store engine Recognize that the collection is a special data type, and in step 406 ununnes the collection to create a queryable object. This object is for a multiset, which in this example is a single column table. In step 408, the data store engine redirects the query to this queryable object.

たとえば、図5は、照会されると、照会可能オブジェクト(単列テーブル)510’にネスト解除される組み込みフィールド(embedded field)510として、他のものの中でもアドレスの多重集合を有する構造化UDT(structured UDT)である「Person」エンティティ500を示すブロック図である。Personに対するマネージドタイプ定義は、以下のようになる。   For example, FIG. 5 shows a structured UDT (structured) having multiple sets of addresses, among other things, as an embedded field 510 that is unnested in a queryable object (single column table) 510 ′ when queried. 2 is a block diagram illustrating a “Person” entity 500 that is UDT). The managed type definition for Person is as follows:

Figure 0004728675
Figure 0004728675

このタイプを作成するために、組み込みコレクションタイプが、以下のようにストアに最初に登録される。   To create this type, a built-in collection type is first registered in the store as follows:

Figure 0004728675
Figure 0004728675

次に、format.structured UDTが以下のように登録される。   Next, format. The structured UDT is registered as follows.

Figure 0004728675
Figure 0004728675

その後、アドレスの組をスカラとして返すために、以下のコマンドを使うことができる。   You can then use the following command to return the address set as a scalar:

Figure 0004728675
Figure 0004728675

同様に、UDTおよび組み込みコレクション(embedded collection)においてメソッド(method)を呼び出す(invoke)ために、以下のコマンドを使うことができる。   Similarly, the following commands can be used to invoke methods in UDTs and embedded collections.

Figure 0004728675
Figure 0004728675

アドレスがワシントン州であるすべての人を探すようにコレクションの中を照会するために、以下のコマンドを使うことができる。   To query the collection to find all people whose address is Washington, you can use the following command:

Figure 0004728675
Figure 0004728675

また、その人のすべてのアドレスの州をワシントン州に変更するようにPersonをアップデートするために、以下のコマンドを使うことができる。   You can also use the following command to update Person to change the state of all the addresses for that person to Washington:

Figure 0004728675
Figure 0004728675

同様に、コレクションにおいてミューテータメソッドを呼び出すために、以下のコマンドを使うことができる。   Similarly, to call a mutator method on a collection, you can use the following command:

Figure 0004728675
Figure 0004728675

本発明の特定の実施形態の場合、構築の枠組み(implementation framework)は、システムUDT、CLRジェネリック、およびストリームテーブル値関数インフラストラクチャを利用するUNNEST演算を用いる。   For certain embodiments of the present invention, the implementation framework uses the system UDT, CLR generics, and UNEST operations that utilize the stream table value function infrastructure.

システムUDTは、ユーザ定義タイプ(UDT)インフラストラクチャを用いて構築されるシステムタイプである。システムUDTは、エンドユーザが作成したUDTと、以下のように異なる。(a)システムUDTは、すべてのデータベースにおいて利用可能であり、すべてのユーザがアクセス可能である。(b)システムUDTは、エンドユーザによって作成することも中断することもできない。(c)システムUDTは、システムにおいてそのような1つのタイプであるかのように、複数のデータベースに渡って使うことができる(すなわち、あるデータベース中のシステムタイプのインスタンスが、別のデータベースからも使用可能である)(「タイプの識別(type identity)」)。(d)システムUDTは、(System.Data.dllのように)「システム」アセンブリで構築することができ、このシステムアセンブリは、データベース以外の場所(たとえばディスク)からロードされるベースCLRインフラストラクチャの一部でよい。(e)システムUDTは、SYSスキーマの一部であり、したがって、ユーザは、システムUDTと同じ名前をもつ独自のUDTを作成することができない。   The system UDT is a system type that is built using a user-defined type (UDT) infrastructure. The system UDT differs from the UDT created by the end user as follows. (A) The system UDT is available in all databases and accessible to all users. (B) The system UDT cannot be created or interrupted by the end user. (C) A system UDT can be used across multiple databases as if it were one such type in the system (ie, an instance of a system type in one database can be ("Type identity"). (D) The system UDT can be built with a “system” assembly (like System.Data.dll), which is the base CLR infrastructure loaded from a location other than the database (eg, disk). Some may be sufficient. (E) The system UDT is part of the SYS schema, so the user cannot create his own UDT with the same name as the system UDT.

ジェネリックは、コレクションクラスライブラリ(collection class library)(MultiSet<T>など)用に使うことができるパラメータ化されたタイプ定義(parameterized type definition)であり、「ジェネリック多重集合(generic multiset)」をグローバルに一度定義し、その後、各「コンクリートインスタンス化(concrete instantiation)」(MultiSet<Address>やMultiSet<PhoneNumber>など)のためにタイプ安全な構築(type-safe implementation)を行うことを可能にする。言い換えると、MultiSet<T>は、たとえば、UDTextensions.dllにおいて一度定義されるジェネリックシステムUDTである。   Generics are parameterized type definitions that can be used for collection class libraries (such as MultiSet <T>), and globally "generic multiset" Once defined, it is then possible to perform a type-safe implementation for each “concrete instantiation” (such as MultiSet <Address> and MultiSet <PhoneNumber>). In other words, MultiSet <T> is, for example, UDExtensions. A generic system UDT defined once in dll.

UNNEST演算子は、MultiSet<T>タイプの(またはそのSQLタイプが別のコンクリート多重集合タイプである)UDTをとり、このUDTを単列テーブルに変形し、前記列の各行は、前記コレクションのメンバーに対応し、したがって、前記コレクションのメンバーのオンザフライクエリおよびナビゲーションを可能にする。本発明のある実施形態の場合、バインディングプロセス(binding process)の間、UNNEST演算によって生じた列用に、特殊な名前空間(namespace)が作成され、UNNEST演算自体は、ストリーミングテーブル値化関数(streaming table valued function)となる。この最適化(optimization)により、スカラからリレーションへの、コレクションの変形が、データのコピーを介在せずに起こり得るようになる。この手法は、結果に対するストリームモデルも提供し、そうすることによって、冗長な具現化(redundant materialization)なしで結果が利用可能になる。(ストリーミングテーブル値化関数は、2004年4月9日に出願した米国特許出願第10/821,687号(整理番号MSFT−2955/307064.01)「SYSTEMS AND METHODS FOR FRAGMENT−BASED SERIALIZATION」に記載されている。   The UNNEST operator takes a UDT of type MultiSet <T> (or its SQL type is another concrete multi-set type) and transforms this UDT into a single column table, where each row of the column is a member of the collection Thus allowing on-the-fly query and navigation of members of the collection. In one embodiment of the present invention, during the binding process, a special namespace is created for the columns generated by the UNEST operation, and the UNEST operation itself is a streaming table value function (streaming table valued function). This optimization allows collection transformations from scalars to relations to occur without intervening data copies. This approach also provides a stream model for the results so that the results can be used without redundant materialization. (The streaming table conversion function is described in U.S. Patent Application No. 10 / 821,687 filed on April 9, 2004 (reference number MSFT-2955 / 307706.01) "SYSTEMS AND METHODS FOR FRAGMENT-BASED SERIALIZATION". Has been.

コレクション - - リスト
リストとは、コレクションのメンバーの順序(order)を取り込む(capture)ように拡張(extend)されたコレクションである。多重集合(multiset)と同様に、このタイプの値は、変数、パラメータ、戻り値(return value)および列定義(column definition)を含むスカラUDT値(scalar UDT value)が許可されるすべてのコンテキストにおいて使うことができる。リストは、本質的にスカラであるコレクション値をリレーションに変形するUNNEST関数と共に機能するが、UNNESTによってもたらされるリレーショナルスキーマ(relational schema)は、少なくとも2つの列をもち、一方の列は、メンバーを含み(1行ごとに1つのメンバー)、他方の列(または擬似列(pseudo-column)もしくは仮想列(virtual column))は、前記リスト中の前記メンバーの相対順序(relative order)を指す値、たとえば、所与の要素の順序を含む。図6は、クエリが多重集合ではなくリストに向けられるときに作成される、図5からの照会可能オブジェクト510”を示す部分ブロック図である。また、多重集合の場合と同様に、TSQL DMLは、リストタイプの値に対する配列アクセス演算をサポートするように拡張される。
Collection--List A list is a collection that has been extended to capture the order of the members of the collection. Similar to multisets, this type of value is used in all contexts where scalar UDT values are allowed, including variables, parameters, return values, and column definitions. Can be used. Lists work with UNNEST functions that transform collection values that are essentially scalars into relations, but the relational schema provided by UNNEST has at least two columns, one of which contains members. (One member per row), the other column (or pseudo-column or virtual column) is a value that points to the relative order of the members in the list, eg , Including the order of a given element. FIG. 6 is a partial block diagram illustrating the queryable object 510 ″ from FIG. 5 that is created when a query is directed to a list rather than multiple sets. Also, as with multiple sets, TSQL DML is , Extended to support array access operations on list type values.

直行行列(orthogonality matrix)のそれ以外の部分(rest)(データベース間コンテキストにおける変換行列および使用を含む)に関して、このタイプ用のコントラクトは、(本明細書において後で使用する)Format.Structured UDT用のものと同じであると仮定する。さらに、「リスト」は、SQL99標準で用いられているように「配列(array)」と呼ぶこともできる。   For the rest of the orthogonality matrix (including the transformation matrix and use in an inter-database context), the contract for this type is Format. (Used later in this document). Assume that it is the same as for Structured UDT. Furthermore, a “list” can also be referred to as an “array” as used in the SQL99 standard.

以下の例は、アドレスおよび電話番号用の2つのリスト値化プロパティ(list-valued property)を含む代替UDT Personクラスを示す。   The following example shows an alternative UDT Person class that includes two list-valued properties for addresses and phone numbers.

Figure 0004728675
Figure 0004728675

上記のSqlList<Address>およびSqlList<Phone>タイプは、新たなデータ定義言語(DDL)ステートメントを用いて、SQLサーバに対して定義される。   The above SqlList <Address> and SqlList <Phone> types are defined to the SQL server using new data definition language (DDL) statements.

Figure 0004728675
Figure 0004728675

次いで、以下のステートメントが、Personテーブルの列をもつテーブルを作成する。   The following statement then creates a table with columns from the Person table.

Figure 0004728675
Figure 0004728675

このステートメントが完了すると、以下のように2つのアドレスおよび3つの電話番号を有するPersonインスタンスを作成するのに、以下のステートメントを使うことができる。   Once this statement is complete, the following statement can be used to create a Person instance with two addresses and three phone numbers as follows:

Figure 0004728675
Figure 0004728675

その後、Personsテーブル中の、主アドレスがシアトルにある人すべての副アドレスおよびセル電話を以下のように照会することができる。   Thereafter, the secondary addresses and cell phones in the Persons table for all persons whose primary address is in Seattle can be queried as follows:

Figure 0004728675
Figure 0004728675

繰り返しになるが、UNNESTは、引数としてリストをとり、各行がリストの各要素用である1組の行を生じるコンストラクトである。UNNESTは、2つの列を生じ、1列はメンバー要素用であり、もう1列はリスト中の各メンバーの相対順序(たとえば、要素の優先順位に対応する順序値)用である。   Again, UNNEST is a construct that takes a list as an argument and produces a set of rows where each row is for each element of the list. UNNEST yields two columns, one column for member elements and the other column for the relative order of each member in the list (eg, an order value corresponding to the priority of the elements).

結論
本明細書で説明した様々なシステム、方法、および技術は、ハードウェアまたはソフトウェア、あるいはそうすることが適切な場合には、両方の組み合せを用いて実施することができる。したがって、本発明の方法および装置、あるいは本発明の特定の態様または部分は、実体のある媒体、たとえばフロッピー(登録商標)ディスケット、CD−ROM、ハードドライブ、または他のどのマシン可読記憶媒体においても実施されるプログラムコード(すなわち、命令)の形をとることができ、プログラムコードがコンピュータなどのマシンにロードされると共にそれによって実行されると、マシンは本発明を実施する装置となる。プログラム可能なコンピュータ上でプログラムコードを実行する場合、コンピュータは概して、プロセッサ、プロセッサによって読取り可能な記憶媒体(揮発性、不揮発性メモリおよび/または記憶要素など)、少なくとも1つの入力デバイス、ならびに少なくとも1つの出力デバイスを含む。1つまたは複数のプログラムは好ましくは、高度な手続きタイププログラミング言語またはオブジェクト指向プログラミング言語で実施され、コンピュータシステムと通信する。ただし、プログラム(群)は、そうすることが望まれる場合、アセンブリでも機械言語でも構築することができる。いずれの場合でも、言語は、コンパイルタイプ言語でもインタープリトタイプ言語でもよく、ハードウェアの構築と組み合わせることができる。
CONCLUSION The various systems, methods, and techniques described herein may be implemented using hardware or software, or a combination of both where appropriate. Thus, the method and apparatus of the present invention, or certain aspects or portions of the present invention, may be on a tangible medium, such as a floppy diskette, CD-ROM, hard drive, or any other machine-readable storage medium. It may take the form of implemented program code (ie, instructions) that, when loaded and executed on a machine, such as a computer, the machine becomes an apparatus for implementing the invention. When executing program code on a programmable computer, the computer generally includes a processor, a processor-readable storage medium (such as volatile, non-volatile memory and / or storage elements), at least one input device, and at least one Includes one output device. The one or more programs are preferably implemented in a sophisticated procedural or object oriented programming language to communicate with the computer system. However, the program (s) can be built in either assembly or machine language if it is desired to do so. In either case, the language can be a compiled or interpreted language and can be combined with hardware construction.

本発明の方法および装置は、たとえば、電気的接続またはケーブル布線、光ファイバ、あるいは他のどの伝送の形でもよい何らかの伝送媒体を介して伝送されるプログラムコードの形で実現することもでき、プログラムコードが受信され、たとえばEPROM、ゲートアレイ、PLD(プログラム可能な論理回路)、クライアントコンピュータ、ビデオレコーダなどのマシンにロードされると共にそれによって実行されると、マシンは、本発明を実施する装置となる。汎用プロセッサで実施すると、プログラムコードは、プロセッサと結合して、本発明の索引づけ機能を実施するように動作する独自の装置を提供する。   The method and apparatus of the present invention can also be implemented in the form of program code transmitted over, for example, an electrical connection or cabling, optical fiber, or some other transmission medium that can be in the form of any transmission, When program code is received and loaded into and executed by a machine such as an EPROM, gate array, PLD (programmable logic circuit), client computer, video recorder, etc., the machine implements the present invention. It becomes. When implemented on a general-purpose processor, the program code combines with the processor to provide a unique apparatus that operates to implement the indexing functionality of the present invention.

様々な図面の好ましい実施形態に関連して本発明を説明したが、本発明から逸脱することなく本発明の同じ機能を実施するために、他の類似の実施形態を使用することもでき、説明した実施形態に修正および追加を行うことができることを理解されたい。たとえば、パーソナルコンピュータの機能をエミュレートするデジタルデバイスという状況で例示的な本発明の実施形態を説明したが、本発明は、このようなデジタルデバイスに限定されず、本出願において述べたように、有線または無線に関わらず、任意の数の既存または新興のコンピューティング装置または環境、たとえばゲーム用コンソール、ハンドヘルドコンピュータ、可搬タイプコンピュータなどにも当てはまり、通信ネットワークを介して接続され、ネットワーク経由で相互作用するこのような任意の数のコンピューティング装置に適用し得ることが当業者には理解されよう。さらに、ハンドヘルドデバイスのオペレーティングシステムおよび他のアプリケーション特有のハードウェア/ソフトウェアインターフェイスシステムを含む様々なコンピュータプラットフォームが本明細書において企図され、特に、無線ネットワーク接続された装置の数は増加し続けることを強調しておく。したがって、本発明は、どの1つの実施形態にも限定されるべきではなく、特許請求の範囲による範囲によって解釈されるべきである。   Although the invention has been described with reference to preferred embodiments in the various drawings, other similar embodiments can be used and described to implement the same functions of the invention without departing from the invention. It should be understood that modifications and additions can be made to the described embodiments. For example, while an exemplary embodiment of the present invention has been described in the context of a digital device that emulates the functionality of a personal computer, the present invention is not limited to such a digital device, as described in this application, This also applies to any number of existing or emerging computing devices or environments, whether wired or wireless, such as gaming consoles, handheld computers, portable computers, etc., connected via a communications network and connected via a network Those skilled in the art will appreciate that it can be applied to any number of such computing devices that work. Further, various computer platforms including handheld device operating systems and other application specific hardware / software interface systems are contemplated herein, particularly emphasizing that the number of wireless networked devices continues to increase. Keep it. Accordingly, the invention should not be limited to any one embodiment, but should be construed in accordance with the scope of the claims.

本発明を実施するためのコンピュータシステムを示すブロック図である。It is a block diagram which shows the computer system for implementing this invention. マネージドコードでインスタンス化されたユーザ定義タイプのインスタンスのシリアル化およびシリアル化解除を示すブロック図である。FIG. 6 is a block diagram illustrating serialization and deserialization of a user-defined type instance instantiated with managed code. 拡張可能リレーショナルデータストア(ERDS)が二元(スカラおよびリレーション)コレクションタイプを提供することを可能にする一般的な方法を示す処理フローチャートである。FIG. 5 is a process flow diagram illustrating a general method that allows an extensible relational data store (ERDS) to provide a binary (scalar and relation) collection type. エンティティにおいてコレクションに適用されるクエリを処理する方法を示すプロセスフローチャートである。FIG. 4 is a process flow diagram illustrating a method for processing a query applied to a collection at an entity. 照会されると、照会可能オブジェクトにネスト解除される組み込みフィールドとして多重集合を有する構造化UDTであるエンティティを示すブロック図である。FIG. 5 is a block diagram illustrating an entity that is a structured UDT with multiple sets as built-in fields that are unnested in a queryable object when queried. 多重集合ではなくリストに対してネスト解除される、図5の照会可能オブジェクトを示す部分ブロック図である。FIG. 6 is a partial block diagram illustrating the queryable object of FIG. 5 being unnested for a list rather than multiple sets.

符号の説明Explanation of symbols

20 コンピュータ
21 処理ユニット
22 システムメモリ
23 システムバス
27 ハードドライブ
28 フロッピー(登録商標)ドライブ
29 取り外し可能記憶装置
30 光ドライブ
32 ハードディスクドライブI/F
33 磁気ディスクドライブI/F
34 光ドライブI/F
36 アプリケーションプログラム
36’ アプリケーション
37 他のプログラム
38 プログラムデータ
40 キーボード
42 マウス
46 シリアルポートI/F
47 モニタ
48 ビデオアダプタ
49 リモートコンピュータ(群)
50 フロッピー(登録商標)ドライブ
53 ネットワークI/F
54 モデム
55 ホストアダプタ
56 SCSIバス
62 記憶装置
20 Computer 21 Processing Unit 22 System Memory 23 System Bus 27 Hard Drive 28 Floppy (registered trademark) Drive 29 Removable Storage Device 30 Optical Drive 32 Hard Disk Drive I / F
33 Magnetic disk drive I / F
34 Optical drive I / F
36 Application program 36 'Application 37 Other program 38 Program data 40 Keyboard 42 Mouse 46 Serial port I / F
47 monitor 48 video adapter 49 remote computer (s)
50 Floppy (registered trademark) drive 53 Network I / F
54 Modem 55 Host Adapter 56 SCSI Bus 62 Storage Device

Claims (9)

プロセッサ、メモリ、およびデータベースを備えたシステムにおいて、コレクション型として定義された列を有する、前記データベース中のテーブルに対するクエリを処理する方法であって、前記コレクション型は、特定の型である1または複数のネストした要素を含み、
前記プロセッサが、前記コレクション型および前記特定の型の情報を前記メモリに格納するステップと、
前記プロセッサが、前記テーブル中の前記コレクション型として定義された列に適用されるクエリを受信するステップと、
前記クエリがスカラ演算の場合、前記プロセッサが、前記コレクション型として定義された列に格納されている前記要素の組に対して前記スカラ演算を実行して、演算した結果を返すステップと、
前記クエリが照会操作の場合、前記プロセッサが、前記コレクションのネストを解除して、前記特定の型として定義された第1の列を含むオブジェクトを生成し、生成したオブジェクトに対して照会を実行し、照会した結果を返すステップであって、前記第1の列は、前記要素の組の各要素を各行に格納する、ステップと
を含むことを特徴とする方法。
A method for processing a query against a table in a database having a column defined as a collection type in a system comprising a processor, a memory, and a database, wherein the collection type is a specific type Contains nested elements,
The processor storing the collection type and the specific type of information in the memory;
The processor receiving a query applied to a column defined as the collection type in the table;
When the query is a scalar operation, the processor executes the scalar operation on the set of elements stored in the column defined as the collection type, and returns a result of the operation;
If the query is a query operation, the processor unnestes the collection to generate an object that includes a first column defined as the specific type, and executes the query on the generated object Returning the queried result, wherein the first column stores each element of the set of elements in each row.
前記特定の型は、ユーザ定義型であることを特徴とする請求項1に記載の方法。   The method of claim 1, wherein the specific type is a user-defined type. 前記コレクション型は、各要素の相対順序を保持し、
前記オブジェクトは、第2の列を含み、前記第2の列の各行は、前記第1の列に格納された要素の前記相対順序に対応する値を有することを特徴とする請求項1に記載の方法。
The collection type maintains the relative order of each element,
2. The object of claim 1, wherein the object includes a second column, and each row of the second column has a value corresponding to the relative order of elements stored in the first column. the method of.
プロセッサ、メモリ、およびデータベースを備えたシステムにおいて、コレクション型として定義された列を有する、前記データベース中のテーブルに対するクエリを処理するプログラムを記録したコンピュータ可読記録媒体であって、前記コレクション型は、特定の型である1または複数のネストした要素を含み、前記プロセッサに、
前記コレクション型および前記特定の型の情報を前記メモリに格納するステップと、
前記テーブル中の前記コレクション型として定義された列に適用されるクエリを受信するステップと、
前記クエリがスカラ演算の場合、前記コレクション型として定義された列に格納されている前記要素の組に対して前記スカラ演算を実行して、演算した結果を返すステップと、
前記クエリが照会操作の場合、前記コレクションのネストを解除して、前記特定の型として定義された第1の列を含むオブジェクトを生成し、生成したオブジェクトに対して照会を実行し、照会した結果を返すステップであって、前記第1の列は、前記要素の組の各要素を各行に格納する、ステップと
を実行させることを特徴とするコンピュータ可読記録媒体。
In a system comprising a processor, a memory, and a database, a computer-readable recording medium recording a program for processing a query against a table in the database having a column defined as the collection type, wherein the collection type is specified Including one or more nested elements of the type
Storing the collection type and the specific type of information in the memory;
Receiving a query applied to a column defined as the collection type in the table;
If the query is a scalar operation, executing the scalar operation on the set of elements stored in the column defined as the collection type, and returning the result of the operation;
When the query is a query operation, the collection is unnested to generate an object including a first column defined as the specific type, and the query is executed on the generated object, and the result of the query Wherein the first column stores each element of the set of elements in each row.
前記特定の型は、ユーザ定義型であることを特徴とする請求項4に記載のコンピュータ可読記録媒体。   The computer-readable recording medium according to claim 4, wherein the specific type is a user-defined type. 前記コレクション型は、各要素の相対順序を保持し、
前記オブジェクトは、第2の列を含み、前記第2の列の各行は、前記第1の列に格納された要素の前記相対順序に対応する値を有することを特徴とする請求項4に記載のコンピュータ可読記録媒体。
The collection type maintains the relative order of each element,
5. The object of claim 4, wherein the object includes a second column, and each row of the second column has a value corresponding to the relative order of elements stored in the first column. Computer-readable recording medium.
コレクション型として定義された列を有するテーブルを格納するデータベースであって、前記コレクション型は、特定の型である1または複数のネストした要素を含む、データベースと、
前記コレクション型および前記特定の型の情報を格納するメモリと、
前記テーブル中の前記コレクション型として定義された列に適用されるクエリを受信し、前記クエリがスカラ演算の場合、前記コレクション型として定義された列に格納されている前記要素の組に対して前記スカラ演算を実行して、演算した結果を返し、前記クエリが照会操作の場合、前記コレクションのネストを解除して、前記特定の型として定義された第1の列を含むオブジェクトを生成し、生成したオブジェクトに対して照会を実行し、照会した結果を返すプロセッサであって、前記第1の列は、前記要素の組の各要素を各行に格納する、プロセッサと
を備えたことを特徴とするシステム。
A database storing a table having columns defined as collection types, wherein the collection type includes one or more nested elements of a particular type;
A memory for storing the collection type and the information of the specific type;
Receiving a query applied to a column defined as the collection type in the table and, if the query is a scalar operation, for the set of elements stored in the column defined as the collection type; Perform a scalar operation, return the result of the operation, and if the query is a query operation, uncollect the collection to generate an object that includes the first column defined as the specific type A processor that executes a query on the object and returns a result of the query, wherein the first column comprises: a processor that stores each element of the set of elements in each row; system.
前記特定の型は、ユーザ定義型であることを特徴とする請求項7に記載のシステム。   The system of claim 7, wherein the specific type is a user-defined type. 前記コレクション型は、各要素の相対順序を保持し、
前記オブジェクトは、第2の列を含み、前記第2の列の各行は、前記第1の列に格納された要素の前記相対順序に対応する値を有することを特徴とする請求項7に記載のシステム。
The collection type maintains the relative order of each element,
8. The object of claim 7, wherein the object includes a second column, and each row of the second column has a value corresponding to the relative order of elements stored in the first column. System.
JP2005097507A 2004-04-30 2005-03-30 System and method for building unordered and ordered collections in a data store Expired - Fee Related JP4728675B2 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
US56674004P 2004-04-30 2004-04-30
US60/566,740 2004-04-30
US11/027,416 2004-12-30
US11/027,416 US7437371B2 (en) 2004-02-10 2004-12-30 Systems and methods for the implementation of unordered and ordered collections in a data store

Publications (2)

Publication Number Publication Date
JP2005316980A JP2005316980A (en) 2005-11-10
JP4728675B2 true JP4728675B2 (en) 2011-07-20

Family

ID=35444288

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005097507A Expired - Fee Related JP4728675B2 (en) 2004-04-30 2005-03-30 System and method for building unordered and ordered collections in a data store

Country Status (2)

Country Link
JP (1) JP4728675B2 (en)
KR (1) KR101030368B1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7853603B2 (en) * 2007-05-23 2010-12-14 Microsoft Corporation User-defined relevance ranking for search
JP5673431B2 (en) * 2011-08-09 2015-02-18 富士通株式会社 Information processing apparatus, information processing method, and program
CN116010376B (en) * 2022-12-30 2023-07-25 北京三维天地科技股份有限公司 Main data modeling method based on inheritance strategy

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002163290A (en) * 2000-09-27 2002-06-07 Microsoft Corp Selection of materializing view on the basis of cost for optimizing query

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5761493A (en) 1990-04-30 1998-06-02 Texas Instruments Incorporated Apparatus and method for adding an associative query capability to a programming language
KR19980069967A (en) * 1997-01-27 1998-10-26 포만제프리엘 Method and System Employing Vector Operations in Query Trees for Relational Databases
US6016497A (en) 1997-12-24 2000-01-18 Microsoft Corporation Methods and system for storing and accessing embedded information in object-relational databases

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002163290A (en) * 2000-09-27 2002-06-07 Microsoft Corp Selection of materializing view on the basis of cost for optimizing query

Also Published As

Publication number Publication date
KR20060079049A (en) 2006-07-05
JP2005316980A (en) 2005-11-10
KR101030368B1 (en) 2011-04-20

Similar Documents

Publication Publication Date Title
EP1603057A2 (en) Systems and methods for the implementation of unordered and ordered collections in data store
US7596576B2 (en) System and method for providing user defined types in a database system
US6243709B1 (en) Method and apparatus for loading stored procedures in a database corresponding to object-oriented data dependencies
US5905982A (en) Handling null values in SQL queries over object-oriented data
KR101183356B1 (en) Object persistence in a database store
US11354284B2 (en) System and method for migration of a legacy datastore
US20070027849A1 (en) Integrating query-related operators in a programming language
US7801882B2 (en) Optimized constraint and index maintenance for non updating updates
JP2011154707A (en) Extensible query language with support for rich data type
MX2008011651A (en) Mapping architecture with incremental view maintenance.
US20050065926A1 (en) Query transformation for union all view join queries using join predicates for pruning and distribution
Blakeley et al. . NET database programmability and extensibility in microsoft sql server
JP4728675B2 (en) System and method for building unordered and ordered collections in a data store
EP1040432B1 (en) Method and apparatus for loading stored procedures in a database corresponding to object-oriented data dependencies
JP5108309B2 (en) System and method for supporting user-defined type inheritance
CN100595754C (en) Systems and methods for the implementation of unordered and ordered collections in a data store
Chen Interface Between Object-Oriented Databases And Relational Databases Using B-Tree Object-Relational Access Interface

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20080326

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100723

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20101025

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20101224

RD13 Notification of appointment of power of sub attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7433

Effective date: 20110111

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A821

Effective date: 20110111

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110323

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20110408

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20110415

R150 Certificate of patent or registration of utility model

Ref document number: 4728675

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140422

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313113

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees