首页 > 数据库 > mysql教程 > 对象标识以及对象与文字

对象标识以及对象与文字

PHPz
发布: 2023-08-31 22:25:16
转载
574 人浏览过

对象标识以及对象与文字

DBMS supports object-oriented data. It ensures direct correspondence between real-world objects and their representations in the database. This correspondence ensures that objects retain their integrity and identity. It enables easy identification and manipulation. Object Data Management System (ODMS) assigns unique identity to each independent object stored in the database.

这个独特的身份通过系统生成的对象标识符(OID)来实现。该OID作为系统分配给每个对象的独特值。它对外部用户不可见。然而,系统在内部利用它来确保每个对象的唯一标识,并建立和管理对象之间的引用。在需要时,系统将OID分配给适当类型的程序变量,以进行涉及对象的操作。

Immutability and Uniqueness

Primary requirement for an Object Identifier (OID) in an Object Data Management System (ODMS) is immutability. It is crucial that the OID value assigned to a specific object remains unchanged, ensuring the preservation of the object's identity in the real world. ODMS must incorporate mechanisms for generating OIDs and enforcing their immutability. It is desirable for each OID to be unique and used only once. Even if an object is removed from the database, its OID should not be reassigned to another object.

To fulfill these requirements, OID should not depend on any attribute values of the object. This is necessary because attribute values may change or be corrected over time. In the relational model, each relation requires primary key. If the value of the primary key is altered, tuple will consider new identity. In different relations, real-world object may have different names for its key attributes. It can create challenges in determining if the keys represent the same real-world object. For example, the object identifier may be represented as "Emp_id" in one relation and as "Ssn" in another relation.

使用对象标识符(OIDs)进行高效检索

Object Identifier (OID) on the physical address of the object in storage is deemed inappropriate in a Database Management System (DBMS). This is because the physical address can change following a physical reorganization of the database. However, some early Object Data Management Systems (ODMSs) have employed the physical address as the OID in order to enhance the efficiency of object retrieval.

为了适应物理地址发生变化的情况,可以利用涉及间接指针的机制。该指针放置在原始地址上,并提供对象的新物理位置。然而,在现代实践中,将长整数分配为OID更为常见。随后,使用哈希表或类似的数据结构将OID值映射到对象在存储中的当前物理地址。这种方法确保OID不受任何物理重组的影响,同时仍能实现高效的对象检索。

Early Approaches and Challenges with OIDs

In early Object-Oriented (OO) data models, there was a requirement that all entities, including simple values and complex objects, be represented as objects. Consequently, each basic value like an integer, string, or Boolean value was assigned an Object Identifier (OID). This approach allowed identical basic values to possess different OIDs, which could be advantageous in certain situations. For instance, the integer value 50 could represent the weight in kilograms in one context and the age of a person in another context. By creating two distinct basic objects with separate OIDs, both objects could represent the integer value 50. However, while this approach held theoretical value, it proved impractical as it resulted in the generation of a large number of OIDs.

为了解决这个限制,大多数面向对象数据库系统现在支持对象和字面量(或值)的表示。每个对象必须有一个不可变的OID分配给它,以确保其唯一标识。相比之下,字面量值没有OID,只是表示其自身的值。通常,字面量值存储在对象内部,不能被其他对象引用。此外,在许多系统中,如果需要,可以创建复杂的结构化字面量值而无需相应的OID。

以上是对象标识以及对象与文字的详细内容。更多信息请关注PHP中文网其他相关文章!

来源:tutorialspoint.com
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板