in database-jones/Adapter/api/UserContext.js [1143:1201]
continueValidation = function() {
// are there any more?
if (projections.length > ++index) {
projection = projections[index];
if (projection.error != '') {
udebug.log('continueValidation projection.error:', projection.error);
// this projection is in error so don't process it any more
errors += projection.error;
// go on to the next projection
continueValidation();
} else {
// do the next projection; see if the domain object already has its table handler
if (projections[index].domainObject.prototype.jones.dbTableHandler) {
udebug.log('continueValidation with cached tableHandler for', projections[index].domainObject.name);
validateProjectionOnTableHandler(null, projections[index].domainObject.prototype.jones.dbTableHandler);
} else {
// get the table handler the hard way (asynchronously)
udebug.log('continueValidation with no cached tableHandler for', projections[index].domainObject.name);
getTableHandler(userContext, projections[index].domainObject, session, validateProjectionOnTableHandler);
}
}
} else {
// there are no more projections to validate -- did another user finish table handling first?
if (!userContext.user_arguments[0].validated) {
// we are the first to validate table handling -- check for errors
if (!errors) {
projection = projections[0];
// no errors yet
// we are done getting all of the table handlers for the projection; now create the sectors
projection.sectors = [];
// create the first sector; additional sectors will be created recursively
// the first sector describes the top level projection; each subsequent sector
// describes a nested projection in the top level projection
createSector([projection], [projection], projection.sectors, /*index*/ 0, /*offset*/ 0);
// now look for errors found during createSector
errors = collectErrors([userContext.user_arguments[0]], '');
// mark all projections reachable from this projections as validated
// projections will grow at the end as validated marking proceeds
if (!errors) {
// no errors in createSector
toBeValidated = [userContext.user_arguments[0]];
markValidated(toBeValidated);
udebug.log('validateProjection complete for', projections[0].domainObject.name);
callback(null);
return;
}
}
// report errors and call back user
if (errors) {
udebug.log('validateProjection had errors:\n', errors);
err = new Error(errors);
err.sqlstate = 'HY000';
}
}
callback(err);
}
};