Creates a new user-defined object type.
The Administrator can create a type for any category except the Program and Attachment categories, because these categories can contain only the Programs and Comments types respectively, which the Information Catalog Manager automatically creates in the information catalog.
Authorization
Administrator
Syntax
APIRET APIENTRY FLGCreateType( PFLGHEADERAREA pObjTypeStruct,
PFLGEXTCODE pExtCode );
Parameters
See Appendix D, Information Catalog Manager reason codes for an explanation of the returned reason codes.
Input structure
To use FLGCreateType, you must define the input structure shown in Figure 53. This structure contains only the header area and the definition area.
Figure 53. FLGCreateType input structure
For an explanation of the meanings of the byte offsets, see The Information Catalog Manager API input structure.
Usage
Prerequisites:
Before you can call the FLGCreateType API to create a new object type, you need to call the FLGCreateReg API to register this new type.
You need to specify the object type identifier returned by the FLGCreateReg API when you call FLGCreateType.
Input requirements:
Header area
The object type that you specify in the header of the input structure must be registered, but not yet created.
Definition area
The order of these additional properties in the definition area does not matter because the Information Catalog Manager uses the property short names in bytes 118-125 as a key to ensure that all required properties are always specified. However, the order of the properties in the definition area for the FLGCreateType call is the order in which the Information Catalog Manager returns the properties to the calling application.
Controlling updates to your information catalog
To keep your program as synchronized as possible with your information catalog, you should include a call to FLGCommit (see FLGCommit) after FLGCreateType completes successfully. If FLGCreateType does not complete successfully, you should include a call to FLGRollback (see FLGRollback).
Figure 54 shows the C language code required to issue the FLGCreateType API call.
This sample code creates a new object type. This new object type is of the Elemental category, as indicated by E in the structure header area, with an object type ID of 000044. Along with the Information Catalog Manager-required properties, this object type contains three additional required properties: imagecolor, imagesize, and description.
Figure 54. Sample C language call to FLGCreateType
APIRET rc; // Declare reason code
PFLGHEADERAREA pObjTypeStruct; // Pointer to the input structure
FLGEXTCODE ExtCode=0; // Declare extended code
.
. /* creating pObjTypeStruct object type by */
/* providing object type's properties */
.
rc = FLGCreateType (pObjTypeStruct,
&ExtCode); // Pass pointer to extended code
Figure 55 shows the input structure for the FLGCreateType API call. The pObjTypeStruct pointer points to the structure that carries the property information for the new object type.
Figure 55. Sample input structure for FLGCreateType
Special error handling
If FLGCreateType encounters a database error, the Information Catalog Manager rolls back the database to the last commit that occurred in your program.
If this rollback is successful, FLGCreateType returns the reason code FLG_SEVERR_DB_AUTO_ROLLBACK_COMPLETE. The extended code contains the SQL code for the database error that prompted the Information Catalog Manager to roll back the database.
Attention: If this rollback fails, FLGCreateType returns the reason code FLG_SEVERR_DB_AUTO_ROLLBACK_FAIL. The extended code contains the SQL code for the database error that prompted the Information Catalog Manager to roll back the database. In this case, your database could have severe integrity problems, and your program should call FLGTerm to exit the Information Catalog Manager.
Depending on the state of your database, you might need to recover your database using your backed-up database files. For more information about recovering your information catalog database, see the Information Catalog Manager Administration Guide.
To prevent the Information Catalog Manager from removing uncommitted changes that are not related to the FLGCreateType error, include FLGCommit calls in your program just before the call to FLGCreateReg for the object type you are creating.