Creates registration information in the information catalog for an object type.
This API call does not create the object type itself; it registers the object type so that the object type can be created. The registration information that FLGCreateReg stores in the information catalog includes registration values that describe the object type.
You can register 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 FLGCreateReg( PFLGHEADERAREA pObjRegStruct,
PSZ pszIconFileID,
PSZ pszObjTypeID,
PFLGEXTCODE pExtCode );
Parameters
This returned ObjTypeID is used by other API calls to identify the object type. It is set to NULL if the object type is not registered successfully.
See Appendix D, Information Catalog Manager reason codes for an explanation of the returned reason codes.
Input structure
To use FLGCreateReg, you must define the input structure shown in Figure 50. This structure contains the header area, the definition area, and the object area.
Figure 50. FLGCreateReg input structure
In the input structure, you must specify these six properties in the definition area in the order shown.
If you are using a version of the Information Catalog Manager other than English, the names of these required properties are translated, and are returned in the output structure of FLGInit.
Table 15. Properties required for object type registrations
Property short name | Property name1 | Description | Specify value in object area? | ||
---|---|---|---|---|---|
NAME | EXTERNAL NAME OF OBJ TYPE | 80-byte name of the object type; can be later modified. | Required. | ||
PTNAME | PHYSICAL TYPE NAME | 30-character name of the actual table in the information catalog that contains the object type. | Optional; default value is the value for DPNAME. | ||
DPNAME | DP NAME | 8-character short name for the object type. | You must set this value using FLGCreateReg.
Required. | ||
CREATOR | CREATOR | 8-character user ID of the administrator who creates the object type. | No; the Information Catalog Manager sets this value when FLGCreateType is issued for the object type. | ||
UPDATEBY | LAST CHANGED BY | 8-character user ID of the administrator who last modified the object type. | No; the Information Catalog Manager sets this value when FLGAppendType is issued for the object type. | ||
UPDATIME | LAST CHANGED DATE AND TIME | 26-character time stamp of the last date and time the object type was modified. | No; the Information Catalog Manager sets this value when FLGCreateType or FLGAppendType is issued for the object type. | ||
|
For a general explanation of the meanings of the byte offsets, see The Information Catalog Manager API input structure.
Usage
Restrictions
Input requirements
Header area:
All of the information shown in the header record in Figure 50 is required.
Definition area:
Object area:
Output information
The system-generated object type identification is returned in the output parameter pszObjTypeID. When the Information Catalog Manager returns this number, you use this number in subsequent calls, such as FLGDeleteReg or FLGGetReg, to uniquely identify the object type registration.
Controlling updates to your information catalog
If FLGCreateReg does not complete successfully, you should include a call to FLGRollback (see FLGRollback). Do not call FLGCommit after FLGCreateReg completes successfully--wait until you complete a call to FLGCreateType.
Figure 51 shows the C language code required to issue the FLGCreateReg call. This sample code creates registration information for a new object type called MYIMAGE that belongs to the Elemental category.
Figure 51. Sample C language call to FLGCreateReg
APIRET rc; // Declare reason code
PFLGHEADERAREA pObjRegStruct; // Pointer to the input structure
UCHAR pszIconFileID[FLG_ICON_FILE_ID_MAXLEN+1]; // Path/File name of ICON
UCHAR pszObjTypeID[FLG_OBJTYPID_LEN+1]; // Returned system-generated ID
FLGEXTCODE ExtCode = 0; // Declare extended code
.
. /* creating pObjRegStruct object Type Registration by providing values */
.
strcpy (pszIconFileID,"Y:\\FLGICON2.ICO");
rc = FLGCreateReg (pObjRegStruct, // input structure
pszIconFileID, // Path/File name of file containing the ICON
pszObjTypeID, // Returned id of registered object type
&ExtCode); // Pass extended code pointer
Figure 52 shows the input structure for the FLGCreateReg call. The pObjRegStruct pointer points to this structure, which carries the property and value information needed for registration of the new object type.
Figure 52. Sample input structure for FLGCreateReg
Special error handling
If FLGCreateReg 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, FLGCreateReg 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, FLGCreateReg 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 FLGCreateReg error, include FLGCommit calls in your program just before this call.