// For each test that ran successfully, report what was found to be valid.
if (entitiesAreConsistent) {
if ([[[doc model] adaptorName] hasPrefix:@"Oracle"])
[doc appendConsistencyCheckSuccessText:[[NSAttributedString alloc] initWithString:@"All the entities have no more than 1 LONG or LONGRAW column.\n"]];
}
if (storedProceduresAreConsistent)
[doc appendConsistencyCheckSuccessText:[[NSAttributedString alloc] initWithString:@"All the stored procedures that are used for DELETE have arguments that match the primary key attributes of the entity for which they will be used.\n"]];
if (modelIsConsistent)
[doc appendConsistencyCheckSuccessText:[[NSAttributedString alloc] initWithString:@"The model has at least one entity.\n"]];
// If this is an Oracle model, make sure this entity doesn't
// have more than one blob attribute.
if ([[[entity model] adaptorName] hasPrefix:@"Oracle"]) {
int i, icount;
int numberOfBlobs = 0;
NSArray *atts = [entity attributes];
for (i = 0, icount = [atts count]; i < icount; i++) {
EOAttribute *att = [atts objectAtIndex:i];
if (![att isFlattened] && [[att externalType] hasPrefix:@"LONG"])
numberOfBlobs++;
}
if (numberOfBlobs > 1) {
[doc appendConsistencyCheckErrorText:[NSMutableAttributedString mutableAttributedStringWithBoldSubstitutionsWithFormat:@"Entity %@ has more than one LONG or LONGRAW columns and the Oracle database does not support this.\n", [entity name]]];
// Please note that mutableAttributedStringWithBoldSubstitutionsWithFormat:
// will only deal with substitutions of the form "%@" and it expects all the
// args to be NSStrings. It is limited, but very useful for generating error
[doc appendConsistencyCheckErrorText:[NSMutableAttributedString mutableAttributedStringWithBoldSubstitutionsWithFormat:@"The number of arguments for stored procedure %@ does not match the number of primary key attributes for entity %@, which lists %@ as its stored procedure for DELETE operations.\n", [sp name], [entity name], [sp name]]];
for (k = 0, kcount = [args count]; k < kcount && !matchingArg; k++) {
argIndex = [args objectAtIndex:k];
if ([[argIndex name] isEqual:[pkAtt name]])
matchingArg = argIndex;
}
if (!matchingArg) {
[doc appendConsistencyCheckErrorText:[NSMutableAttributedString mutableAttributedStringWithBoldSubstitutionsWithFormat:@"Stored procedure %@ is used by entity %@ for DELETE, but it does not have an argument named %@ to match the primary key attribute %@.\n", [sp name], [entity name], [pkAtt name], [pkAtt name]]];