Added the following methods to AQConstraint in ADS-12.0.0, ADS-13.0.0, and trunk.
/** * To check if this is a primary key constraint. * * @return * true if this is a primary key constraint; false otherwise. */ public boolean isPrimaryKeyConstraint(); /** * To check if this is a foreign key constraint. * * @return * true if this is a foreign key constraint; false otherwise. */ public boolean isForeignKeyConstraint(); /** * To check if this is a check constraint. * * @return * true if this is a check constraint; false otherwise. */ public boolean isCheckConstraint(); /** * To check if this is a unique constraint. * * @return * true if this is a unique constraint; false otherwise. */ public boolean isUniqueConstraint(); /** * To get the referenced column(s) for a foreign key constraint. * * @return * An array of AQForeignKeyRefColumn objects if this is a foreign key constraint; empty array otherwise. */ public AQForeignKeyRefColumn[] extractForeignKeyRefColumns(); /** * To get the check condition for a check constraint. * * @return * The check condition if this is a check constraint; null otherwise. */ public String extractCheckCondition();
Sample code:
var table = conn.metadata.extractTable('SAMPLE', 'NORTHWIND', 'Order Details'); var constraints = table.extractConstraints(); for (var i = 0; i < constraints.length; i++) { aqua.console.println("Constraint: " + constraints[i].getName()); var columns = constraints[i].extractColumns(); for (var j = 0; j < columns.length; j++) { aqua.console.println("Column: " + columns[j].getName()); } if (constraints[i].isForeignKeyConstraint()) { var refColumns = constraints[i].extractForeignKeyRefColumns(); for (var r = 0; r < refColumns.length; r++) { aqua.console.println("Ref Column: " + refColumns[r].getDatabaseName() + "." + refColumns[r].getSchemaName() + "." + refColumns[r].getTableName() + "." + refColumns[r].getName()); } } if (constraints[i].isCheckConstraint()) { aqua.console.println("Check Condition: " + constraints[i].extractCheckCondition()); } }
Sample code:
var table = conn.metadata.extractTable('SAMPLE', 'NORTHWIND', 'Order Details'); var constraints = table.extractConstraints(); for (var i = 0; i < constraints.length; i++) { aqua.console.println("Constraint: " + constraints[i].getName()); var columns = constraints[i].extractColumns(); for (var j = 0; j < columns.length; j++) { aqua.console.println("Column: " + columns[j].getName()); } if (constraints[i].isForeignKeyConstraint()) { var refColumns = constraints[i].extractForeignKeyRefColumns(); for (var r = 0; r < refColumns.length; r++) { aqua.console.println("Ref Column: " + refColumns[r].getDatabaseName() + "." + refColumns[r].getSchemaName() + "." + refColumns[r].getTableName() + "." + refColumns[r].getName()); } } if (constraints[i].isCheckConstraint()) { aqua.console.println("Check Condition: " + constraints[i].extractCheckCondition()); } }
Issue #8572 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
No fixed build |
No time estimate |
Added the following methods to AQConstraint in ADS-12.0.0, ADS-13.0.0, and trunk.