public String generateJoinSql (String optionalSelect, Table joinTable, String joinType, String namespace, String fieldName, boolean prefixTableName) {
    """
	Constructs a join clause to use in conjunction with {@link #generateJoinSql}. By default the join type is "INNER
	JOIN" and the join field is whatever the table instance's key field is. Both of those defaults can be overridden
	with the other overloaded methods.
	@param optionalSelect optional select query to pre-select the join table
	@param joinTable the Table to join with
	@param joinType type of join (e.g., INNER JOIN, OUTER LEFT JOIN, etc.)
	@param namespace feedId (or schema prefix)
	@param fieldName the field to join on (default's to key field)
	@param prefixTableName whether to prefix this table's name with the schema (helpful if this join follows a
	previous join that renamed the table by dropping the schema/namespace
	@return a fully formed join clause that can be appended to a select statement
    """
        if (fieldName == null) {
            // Default to key field if field name is not specified
            fieldName = getKeyFieldName();
        }
        if (joinType == null) {
            // Default to INNER JOIN if no join type provided
            joinType = "INNER JOIN";
        }
        String joinTableQuery;
        String joinTableName;
        if (optionalSelect != null) {
            // If a pre-select query is provided for the join table, the join table name must not contain the namespace
            // prefix.
            joinTableName = joinTable.name;
            joinTableQuery = String.format("(%s) %s", optionalSelect, joinTableName);
        } else {
            // Otherwise, set both the join "query" and the table name to the standard "namespace.table_name"
            joinTableQuery = joinTableName = String.format("%s.%s", namespace, joinTable.name);
        }
        // If prefix table name is set to false, skip prefixing the table name.
        String tableName = prefixTableName ? String.format("%s.%s", namespace, this.name) :this.name;
        // Construct the join clause. A sample might appear like:
        // "INNER JOIN schema.join_table ON schema.this_table.field_name = schema.join_table.field_name"
        // OR if optionalSelect is specified
        // "INNER JOIN (select * from schema.join_table where x = 'y') join_table ON schema.this_table.field_name = join_table.field_name"
        return String.format("%s %s ON %s.%s = %s.%s",
                joinType,
                joinTableQuery,
                tableName, fieldName,
                joinTableName, fieldName);
    }
public String generateJoinSql (String optionalSelect, Table joinTable, String joinType, String namespace, String fieldName, boolean prefixTableName) {
        if (fieldName == null) {
            // Default to key field if field name is not specified
            fieldName = getKeyFieldName();
        }
        if (joinType == null) {
            // Default to INNER JOIN if no join type provided
            joinType = "INNER JOIN";
        }
        String joinTableQuery;
        String joinTableName;
        if (optionalSelect != null) {
            // If a pre-select query is provided for the join table, the join table name must not contain the namespace
            // prefix.
            joinTableName = joinTable.name;
            joinTableQuery = String.format("(%s) %s", optionalSelect, joinTableName);
        } else {
            // Otherwise, set both the join "query" and the table name to the standard "namespace.table_name"
            joinTableQuery = joinTableName = String.format("%s.%s", namespace, joinTable.name);
        }
        // If prefix table name is set to false, skip prefixing the table name.
        String tableName = prefixTableName ? String.format("%s.%s", namespace, this.name) :this.name;
        // Construct the join clause. A sample might appear like:
        // "INNER JOIN schema.join_table ON schema.this_table.field_name = schema.join_table.field_name"
        // OR if optionalSelect is specified
        // "INNER JOIN (select * from schema.join_table where x = 'y') join_table ON schema.this_table.field_name = join_table.field_name"
        return String.format("%s %s ON %s.%s = %s.%s",
                joinType,
                joinTableQuery,
                tableName, fieldName,
                joinTableName, fieldName);
    }
public String generateJoinSql ( String optionalSelect , Table joinTable , String joinType , String namespace , String fieldName , boolean prefixTableName ) { if ( fieldName == null ) { // Default to key field if field name is not specified fieldName = getKeyFieldName ( ) ; } if ( joinType == null ) { // Default to INNER JOIN if no join type provided joinType = "INNER JOIN" ; } String joinTableQuery ; String joinTableName ; if ( optionalSelect != null ) { // If a pre-select query is provided for the join table, the join table name must not contain the namespace // prefix. joinTableName = joinTable . name ; joinTableQuery = String . format ( "(%s) %s" , optionalSelect , joinTableName ) ; } else { // Otherwise, set both the join "query" and the table name to the standard "namespace.table_name" joinTableQuery = joinTableName = String . format ( "%s.%s" , namespace , joinTable . name ) ; } // If prefix table name is set to false, skip prefixing the table name. String tableName = prefixTableName ? String . format ( "%s.%s" , namespace , this . name ) : this . name ; // Construct the join clause. A sample might appear like: // "INNER JOIN schema.join_table ON schema.this_table.field_name = schema.join_table.field_name" // OR if optionalSelect is specified // "INNER JOIN (select * from schema.join_table where x = 'y') join_table ON schema.this_table.field_name = join_table.field_name" return String . format ( "%s %s ON %s.%s = %s.%s" , joinType , joinTableQuery , tableName , fieldName , joinTableName , fieldName ) ; }
Constructs a join clause to use in conjunction with {@link #generateJoinSql}. By default the join type is "INNER
JOIN" and the join field is whatever the table instance's key field is. Both of those defaults can be overridden
with the other overloaded methods.
@param optionalSelect optional select query to pre-select the join table
@param joinTable the Table to join with
@param joinType type of join (e.g., INNER JOIN, OUTER LEFT JOIN, etc.)
@param namespace feedId (or schema prefix)
@param fieldName the field to join on (default's to key field)
@param prefixTableName whether to prefix this table's name with the schema (helpful if this join follows a
previous join that renamed the table by dropping the schema/namespace
@return a fully formed join clause that can be appended to a select statement
Constructs a join clause to use in conjunction with {