ActiveX Interface for ObjectStore

Chapter 6

ActiveX Interface Reference

This chapter describes the ActiveX interfaces, which are listed alphabetically by interface name. Within the entry for each interface, the methods and properties are listed alphabetically. For more information about the equivalent ObjectStore C++ API or behavior, as presented in the table in the next section, see the ObjectStore C++ API Reference.

OSAX Interfaces at a Glance

The following table provides a quick reference of equivalent interfaces.
OLE InterfaceMethods and PropertiesObjectStore C++ API or Behavior
IOSAXCollection

Item (default)

os_collection::pick()

Add

os_collection::insert()

Remove

os_collection::remove()

ElementType

C.ElementType = XClass

Cardinality() As Long

Returns number of elements

Count() As Long

Returns number of elements

IsEmpty() As Boolean

os_collection::empty()

IsOrdered() As Boolean

false

Evaluate

os_collection::query()

IOSAXDatabase

Open

os_database::open()

OpenMVCC

os_database::open_mvcc()

Close

os_database::close()

Value

Name As String, type As IOSAXType

IOSAXObjectStore

CreateDatabase

os_database::create()

OpenDatabase

os_database::open()

OpenDatabaseMVCC

os_database::open_mvcc()

BeginTrans

os_transaction::begin()

LookupDatabase

Returns unopened IOSAXDatabase

CommitTrans

os_transaction::commit()

Rollback

os_transaction::abort()

Equal

==

IsPersistent

objectstore::is_persistent()

IOSAXString

Value

Translates char* value to string

IOSAXStringConstructor

Ansi

Allocates char*; uses ANSI code page for translation

Copy

Copies char* referenced by IOSAX

OEM

Allocates char*; uses OEM code page for translation

IOSAXType

Name

String name of type

Cast

Returns its argument's referenced C++ object as an instance object of this type

IOSAXUnknownObject



For C++ objects that do not have an OSAX class; like void* in C++

The following sections describe the interfaces in more detail. They are presented in alphabetical order.

IOSAXCollection

Purpose

Represents an os_collection or a class derived from it.

When osgentyp defines an OLE class for a parameterized collection, the instance objects have two interfaces. One is IOSAXCollection. The other interface is like IOSAXCollection, except that the element arguments and return values of the element-specific methods use the element type rather than Object.

Methods

Add(element As Object)
Inserts the element into the collection, using os_collection::insert.

Cardinality() As Long
Returns the number of elements in the collection. This is the same as Count().

Count() As Long
Returns the number of elements in the collection. This is the same as Cardinality().

ElementType()
A settable property. You must set this to the element-appropriate type when you have a nonparameterized collection, such as an os_set. For example, if you have a collection of X* objects, and XClass is the class object for class X, and C is your collection, you need to say

    C.ElementType = XClass
before you can access elements from the collection.

Evaluate(query As String) As Variant
Returns a collection of the same element type that is the result of the specified query.

IsEmpty() As Boolean
Returns true if the collection is empty. Uses os_collection::empty().

IsOrdered() As Boolean
Returns true for collections that are ordered lists.

Item() As Object
Returns an element from the collection using os_collection::pick().

Remove(element As Object)
Removes the element from the collection using
os_collection::remove().

IOSAXDatabase

Purpose

Represents a database.

Methods

Close
Closes the database with os_database::close().

Open
Opens a database with os_database::open().

OpenMVCC
Opens a database for MVCC; equivalent to os_database::open_mvcc().

Value(Name As String, type As IOSAXType) As Object
Returns the value of the named root, which must have the specified type. Use a class object for the type. Class objects support the IOSAXType interface.

If the root has a typespec, the typespec is verified against the type. Otherwise, the type is assumed to be correct.

IOSAXObjectStore

Purpose

The following are general ObjectStore control methods for opening databases, transactions, and so on.

Methods

BeginInitialization() As Boolean
Returns false if ObjectStore has already been initialized. This method can be called before any other ObjectStore methods that must be called before ObjectStore is initialized.

BeginTrans([ReadOnly As Variant])
Starts a transaction using os_transaction::begin().

CommitTrans
Commits a transaction using os_transaction::commit().

CreateDatabase(Name As String,[CreateMode As Variant], [OverWrite As Variant],
[SchemaDatabase As Variant]) As IOSAXDatabase
Creates a database.

The CreateMode is an octal UNIX-style file create mode that defaults to 0664. OverWrite is an optional Boolean that defaults to false. If true, an existing database by the same name is overwritten.

SchemaDatabase specifies a database to use for schema.

Equal(First As Object, Second As Object) As Boolean
Tells if two objects refer to the same C++ pointer.

Initialize([Reserved As Variant])
Initialize ObjectStore. Should be set to 0.

InitializeTransactions()
Does nothing on ObjectStore.

IsPersistent(Obj As Object) As Boolean
Returns true if the object is stored in an ObjectStore database.

LanguageInterfaceMaintenanceRelease() As Long
Returns the maintenance release of the language interface.

LanguageInterfaceMajorRelease() As Long
Returns the major release of the language interface.

LanguageInterfaceMinorRelease() As Long
Returns the minor release of the language interface.

LanguageInterfaceName() As Long
Returns the name of the language interface.

LoadATKReference(Type As IOSAXType, RefString As Object) As Object
Returns the object corresponding to the reference from ATK.

LookupDatabase(Name As String) As IOSAXDatabase
Returns an unopened IOSAXDatabase. Name is the name of a database.

MaintenanceRelease() As Long
Returns the maintenance release number.

MajorRelease() As Long
Returns the major release number.

MinorRelease() As Long
Returns the minor release number.

OpenDatabase(Name As String, [ReadOnly As Variant], [CreateMode As Variant],
[SchemaDatabase As Variant]) As IOSAXDatabase
Opens an existing database with the given Name.

ReadOnly is an optional Boolean defaulting to false.

CreateMode is a UNIX-style protection mode defaulting to 0. If it has a nonzero value and the database does not exist, the database is created with the specified protection.

SchemaDatabase is an optional IOSAXDatabase to be used for the schema.

OpenDatabaseMVCC(Name As String)
Opens an existing database with the given Name for MVCC; equivalent to os_database::open_mvcc(Name).

ProductName() As String
Returns the name of the product.

Rollback
Rolls back a transaction using os_transaction::abort().

SetContext(Obj As Object)
Changes the context associated with this ObjectStore Server to that of Obj.

StorageSystemName() As String
Returns the name of the storage system.

IOSAXString

Purpose

Visual Basic and OLE use BSTRs to represent strings, while C++ uses char*. If OSAX converted char* to BSTR, it would need to copy all strings. Therefore, if you passed such a string from one method to another, you would be passing a twice-copied version of it, rather than the intended original.

OSAX avoids this problem with IOSAXString, which is a reference to a char*. When Visual Basic asks for the value of an IOSAXString, a copy is made and returned at that time. If an IOSAXString object is passed to something that wants an IOSAXString argument, the original char* is available.

Methods

Value() As String
Translates the char* value to a string using the ANSI code page.

IOSAXStringConstructor

Purpose

IOSAXStringConstructor is the class interface for IOSAXString. It contains methods for allocating and copying IOSAXStrings.

Methods

ANSI(init As String, [where As Variant]) As IOSAXString
Allocates a char* and initializes it with init using the ANSI code page for translation. If where is specified, it should be the database in which to allocate the string.

Copy(Value As IOSAXString, [where As Variant]) As IOSAXString
Makes a copy of the string. If where is specified, it should be the database in which to allocate the string.

OEM(init As String, [where As Variant]) As IOSAXString
Allocates a char* and initializes it with init using the OEM code page for translation. If where is specified, it should be the database in which to allocate the string.

IOSAXType

Purpose

This interface is available on all instance class objects and is used for methods that need a type, such as IOSAXDatabase.Value.

For example, the C++ class X has an IX interface for its instances and an IXClass interface for its class methods. The IXClass object also has an IOSAXType interface.

Methods

Cast(Obj As Object) As Object
Returns an OSAX object for the same C++ pointer as its argument, only using the class as its instance type. You can use this to access root values that have no associated type.

Name() As String
Returns the class name associated with the type.

IOSAXUnknownObject

Purpose

Used for instances when nothing is known about the C++ type. It is like a void* pointer in C++.



[previous]

Copyright © 1998 Object Design, Inc. All rights reserved.

Updated: 03/18/98 13:58:00