Schema Change

To extend the logical schema for the Data Warehouse, an arbitrary session of the OLE DB Provider for Commerce Server must be designated as a schema change session. Turning the schema change mode on denotes a schema change session. Changes to the schema are allowed only when in schema change mode, and the changes can only modify existing components of the schema; inserting data is not permitted. While in this mode, provider commands and URLs are accessible to alter the schema.

The __Commit attribute determines whether the changes for the particular catalog object being modified are to be stored in the meta-data catalog when the CommitSchema command is performed. The CommitSchema command persists the session changes to the actual schema tables, provided all changes pass validation. This should be performed when all the individual schema change operations have been performed. This commits all pending schema changes to the persistent storage within SQL in a single transaction.

When extending the schema, perform the following steps:

  1. Designate the current OLE DB Provider for Commerce Server session as a schema change session. Turn the schema change mode on by setting the SchemaMode attribute to 1 (one). This is performed through a Command object from an OLE DB Provider for Commerce Server session. For an example of setting the schema change mode, see Creating a New Class.

    Ee824881.note(en-US,CS.20).gifNote

    • The SchemaMode attribute accepts values of On, True, or 1 to turn the schema change mode on. Values other than On, True, or 1 set the schema change mode to off.
  2. Create a new instance in the schema object you want (Class, Member, and so forth).

  3. Set the attributes on the row that represents the schema object. Depending on which schema object you are setting, these attributes will be different. For example, if you are defining a new relation, you will need to set an attribute that designates if the relation is one-to-many (1:M) or many-to-many (M:M).

  4. Set the persistence of the new row using the __Commit attribute. If you want the values to be set in the row, set the __Commit column of the row to 1 (one), indicating that changes will be accepted. If you want to ignore the changes, set the __Commit row to 0 (zero) so the changes will be ignored.

  5. If you are using ADO 2.5 or later, use the rec.fields.update method to initiate the call to the OLE DB Provider for Commerce Server.

  6. Repeat steps 2 through 5 for each additional object to be added.

  7. Commit the session changes by running the CommitSchema command.

  8. Turn the schema change mode off by setting the SchemaMode attribute to 0 (zero). This turns off the schema change mode for that OLE DB Provider for Commerce Server session.

Commit

The __Commit attribute determines whether and when the data inserted into a row will be persisted. It allows the user to determine whether the changes made by the provider are accepted or rejected.

When setting row data in the OLE DB Provider for Commerce Server when the Fastload property is set to True, the data is buffered. Two values, Flush (do not save current row) and Save and Flush, explicitly (and synchronously) flush the data to the database.

It is recommended for C++ applications that have high load requirements to use the row reuse feature of the _Commit attribute. Normally, an application creates an instance of a blank row using the IcreateRow interface, populates the column data, commits the data, releases the row, and recreates a new row, reducing the amount of time spent in COM. The Reuse Row value allows the client to reuse the same row over and over without having to release and recreate a new row.

In order to reuse rows, set the __Commit column value to 0x201 (Save with Reuse) after populating the column data for the row. If setting the __Commit column succeeds, the row column data can be repopulated and reused.

Similar to setting the __Commit attribute to 0 (zero), the Ignore value does not persist the data in the row but still allows the row to be reused.

The following table lists the valid values for the __Commit attribute, and provides a brief description of each.

Action Value Description
Discard 0x00 Discards the row.
Save 0x01 Saves the current row.
Flush 0x02 Flushes the buffers. Must be called on a row with only the __Commit column set.
Save and Flush 0x04 Saves the current row and flushes the buffers.
Ignore 0x100 Makes the row nonpersistent.
Reuse Row 0x200 Reuses the row multiple times without rebinding.

Copyright © 2005 Microsoft Corporation.
All rights reserved.