skip to main content
Designing and coding the IP : DDL object management : Drop Table processing
 

Drop Table processing

The SQL syntax to drop a table is:
DROP TABLE table-name [drop-option];
drop-option = CASCADE | RESTRICT
When a SQL query of this form is issued, OpenAccess SDK SQL engine maps this information to a list of schema objects of type damobj_table. 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 foreign keys information to check the optional drop-option in the delete_rule (DAM_CASCADE | DAM_RESTRICT).
pList = dam_getSchemaObjectList(hstmt, DAMOBJ_TYPE_FKEY);
damobj_stat pFkeyObj = getFirstSchemaObject(pList);
3. Use this information to drop the table.