JET_TABLECREATE2 Structure

Applies to: Windows | Windows Server

JET_TABLECREATE2 Structure

The JET_TABLECREATE2 structure contains the information that is needed to create a table populated with columns and indexes in an ESE database, and that designates a callback function. The JET_TABLECREATE2 structure is used by JetCreateTableColumnIndex2.

Windows XP: The JET_TABLECREATE2 structure is introduced in Windows XP.

    typedef struct tagJET_TABLECREATE2 {
      unsigned long cbStruct;
      tchar* szTableName;
      tchar* szTemplateTableName;
      unsigned long ulPages;
      unsigned long ulDensity;
      JET_COLUMNCREATE* rgcolumncreate;
      unsigned long cColumns;
      JET_INDEXCREATE* rgindexcreate;
      unsigned long cIndexes;
      tchar* szCallback;
      JET_CBTYP cbtyp;
      JET_GRBIT grbit;
      JET_TABLEID tableid;
      unsigned long cCreated;
    } JET_TABLECREATE2;

Members

cbStruct

The size of this structure in bytes (for future expansion). It must be set to sizeof( JET_TABLECREATE2 ) in bytes.

szTableName

The name of table to create.

The name must use meet the following conditions:

  • Have a value less than JET_cbNameMost, not including the terminating NULL.
  • Consist of the following set of characters: 0 through 9, A through Z, a through z, and all other punctuation except for exclamation point (!), comma (,), opening bracket ([), and closing bracket (]), that is, ASCII characters 0x20, 0x22 through 0x2d, 0x2f through 0x5a, 0x5c, and 0x5d through 0x7f.
  • Not begin with a space.
  • Consist of at least one non-space character.

szTemplateTableName

The name of an already-existing table from which to inherit base DDL (Data Definition Language). Using a template table allows easy creation of many tables with identical columns and indexes.

ulPages

The initial number of database pages to allocate for the table. Specifying a number larger than one can reduce fragmentation if many rows are inserted into this table.

ulDensity

The table density, in percentage points. The number must be either 0 or in the range of 20 through 100. Passing 0 means that the default value should be used. The default is 80.

rgcolumncreate

An array of JET_COLUMNCREATE structures, each of which corresponds to a column to be created in the new table.

cColumns

the number of JET_COLUMNCREATE elements in rgcolumncreate.

rgindexcreate

An array of JET_INDEXCREATE structures, each of which corresponds to an index to be created in the new table.

cIndexes

The number of JET_INDEXCREATE elements in rgindexcreate.

szCallback

The function that gets called during certain events. cbtyp determines when the callback function will be called.

The format of szCallback must be "module!function"—for example, "alpha!beta" refers to the beta function in the module named "alpha". The prototype of the function must match JET_CALLBACK. For more information, see JET_CALLBACK.

cbtyp

Describes the type of callback function designated by szCallback. For more information, see JET_CBTYP. This bitfield is composed of one or more of the following bits.

Value

Meaning

JET_cbtypFinalize

The callback function will be called when a column that can be finalized has gone to zero.

JET_cbtypBeforeInsert

The callback function will be called prior to record insertion.

JET_cbtypAfterInsert

The callback function will be called once the database engine has finished inserting a record.

JET_cbtypBeforeReplace

The callback function will be called prior to modification of a record.

JET_cbtypAfterReplace

The callback function will be called after finishing modification of a record.

JET_cbtypBeforeDelete

The callback function will be called prior to deletion of a record.

JET_cbtypAfterDelete

The callback function will be called after a record has been deleted.

JET_cbtypUserDefinedDefaultValue

The callback function will be called to calculate a user-defined default.

JET_cbtypOnlineDefragCompleted

The callback function will be called after a call to JetDefragment2 has completed.

JET_cbtypFreeCursorLS

The callback function will be called when the local storage that is associated with a cursor must be freed.

JET_cbtypFreeTableLS

The callback function will be called when the local storage that is associated with a table must be freed.

grbit

A group of bits that contain the options for this call, which include zero or more of the following values.

Value

Meaning

JET_bitTableCreateFixedDDL

Setting JET_bitTableCreateFixedDDL prevents DDL operations on the table (such as adding or removing columns).

JET_bitTableCreateTemplateTable

Setting JET_bitTableCreateTemplateTable causes the table to be a template table. New tables can then specify the name of this table as their template table. Setting JET_bitTableCreateTemplateTable implies JET_bitTableCreateFixedDDL.

JET_bitTableCreateNoFixedVarColumnsInDerivedTables

Must be used in conjunction with JET_bitTableCreateTemplateTable. Deprecated. Do not use.

tableid

An output field that holds the JET_TABLEID of the new table if the API call succeeds. If the API call fails, the value is undefined.

cCreated

An output field that contains the count of objects that are created if the API call succeeds. If the API call fails, the value is undefined.

The count of objects that is created is equal to the sum of columns, tables, and indexes that are successfully created.

Requirements

Requirement Value

Client

Requires Windows  Vista or Windows XP.

Server

Requires Windows Server 2008 or Windows Server 2003.

Header

Declared in Esent.h.

Unicode

Implemented as JET_TABLECREATE2_W (Unicode) and JET_TABLECREATE2_A (ANSI).

See Also

JET_CALLBACK
JET_CBTYP
JET_CONDITIONALCOLUMN
JET_ERR
JET_GRBIT
JET_INDEXCREATE
JET_TABLEID
JetCreateTable
JetCreateTableColumnIndex
JetCreateTableColumnIndex2
JetDefragment2