/*********************************************************************/
/*                                                                   */
/* create_business_table - Creates the business table                */
/*                                                                   */
/*              arguments:                                           */
/*                                                                   */
/*              connection <SE_CONNECTION> - The connection handle.  */
/*              table <CHAR> - The name of the table.                */
/*              config_keyword <CHAR *> - The configuration          */
/*                                        keyword.                   */
/*                                                                   */
/*********************************************************************/

void create_business_table ( SE_CONNECTION connection, 
                             CHAR *table, 
                             CHAR *config_keyword) {

LONG rc;
SHORT num_columns = 2;
SE_REGINFO reginfo;
SE_COLUMN_DEF column_defs[] = {{"objectid",SE_INTEGER_TYPE,0,0,FALSE,SE_REGISTRATION_ROW_ID_COLUMN_TYPE_NONE},
                               {"name",SE_STRING_TYPE,65,0,FALSE,SE_REGISTRATION_ROW_ID_COLUMN_TYPE_NONE}};

/* Create the table */

rc = SE_table_create (connection, 
                               (const CHAR*) table, 
                                num_columns, 
                               (const SE_COLUMN_DEF *) column_defs,
                               (const CHAR *) config_keyword);
check_error (rc, connection, NULL, "SE_table_create");

/* In addition to creating the table, the SE_table_create */
/* function registers the table with ArcSDE. Essentially a */
/* record is added to the SDE.TABLE_REGISTRY metadata table. */
/* The following function calls modify the registration */
/* setting the OBJECTID column as the ArcSDE maintained rowid. */
 
/* Initialize the SE_REGINFO structure */

rc = SE_reginfo_create (&reginfo);
check_error (rc, NULL, NULL, "SE_reginfo_create");

/* Populate the SE_REGINFO structure with the current registration information */

rc = SE_registration_get_info (connection, table, reginfo);
check_error (rc, connection, NULL, "SE_registration_get_info");

/* Set the rowid */

rc = SE_reginfo_set_rowid_column (reginfo, "objectid", SE_REGISTRATION_ROW_ID_COLUMN_TYPE_SDE);
check_error (rc, NULL, NULL, "SE_reginfo_set_rowid_column");

/*  alter the registration  */

rc = SE_registration_alter (connection, reginfo);
check_error (rc, connection, NULL, "SE_registration_alter");

/* Release the SE_REGINFO structure */

SE_reginfo_free (reginfo); 

return;

} /* create_business_table */