3.1 CRUD 操作概述

CRUD 操作以方法的形式提供,这些方法在模式对象上操作。可用的模式对象包括包含文档的集合对象,或包含行和包含文档的集合的表对象。

下表显示了集合和表对象的可用 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.