skip to main content
Designing and coding the IP : DDL object management : DDL function
 

DDL function

When the DDL function in the IP is called, the DDL function should perform the following steps:
1. Get information about the table (name, owner, qualifier).
pList = dam_getSchemaObjectList(hstmt, DAMOBJ_TYPE_TABLE);
damobj_table pTableObj = getFirstSchemaObject(pList);
2. Get column definitions.
pList = dam_getSchemaObjectList(hstmt, DAMOBJ_TYPE_COLUMN);
damobj_column pColumnObj = dam_getFirstSchemaObject(pList);
while ( pColumnObj ){
pColumnObj = dam_getNextSchemaObject(pList);
/* get the column attributes */
}
3. Get the index definition.
pList = dam_getSchemaObjectList(hstmt, DAMOBJ_TYPE_STAT);
damobj_stat pStatObj = dam_getFirstSchemaObject(pList);
while ( pStatObj ){
/* get the index information from pStatObj */
pStatObj = dam_getNextSchemaObject(pList);
}
4. Get foreign keys information
pList = dam_getSchemaObjectList(hstmt, DAMOBJ_TYPE_FKEY);
damobj_stat pFkeyObj = getFirstSchemaObject(pList);
while ( pFkeyObj ){
pFkeyObj = dam_getNextSchemaObject(pList);
/* get the foreign key attributes */
}
5. Use the supplied table, columns and foreign keys information to create your table.