3.1 CRUD 操作概述

CRUD 操作以方法的形式提供,这些方法对 Schema 对象进行操作。可用的 Schema 对象包括包含文档的 Collection 对象,或包含行和包含文档的 Collection 对象的 Table 对象。

下表显示了 Collection 和 Table 对象的可用 CRUD 操作。

数据库对象类

图 3.1 数据库对象 - 类图

The DatabaseObject class contains the following general functions: getSession(): XSessionObj, getSchema(): SchemaObj, getName(): String, existsInDatabase(): Boolean|Unknown. The Schema class contains the following functions: getCollections() and getTables() are browse functions. getCollection(): CollectionObj, getTable(): TableObj, and getCollectionAsTable(): TableObj are DbObject instance functions. createCollection() is a create function. The Collection class contains the following functions: add(): CollectionInsertObj, find(): CollectionFindObj, modify(): CollectionUpdateObj, and remove(): CollectionDeleteObj are CRUD functions. createIndex(), dropIndex(), and getIndexes() are index functions. newDoc() and count(): Integer are document and structure functions. The Table class contains the following functions: insert(): InsertObj, select(): SelectObj, update(): UpdateObj, and delete(): DeleteObj are relational SQL CRUD functions. dropIndex() and getIndexes() are index functions. count(): Integer is a general function.