FileDocCategorySizeDatePackage
Sybase11JoinFragment.javaAPI DocHibernate 3.2.52596Sun Dec 05 08:04:22 GMT 2004org.hibernate.sql

Sybase11JoinFragment

public class Sybase11JoinFragment extends JoinFragment
An old Sybase-style join (before Sybase supported the ANSI style "inner join" etc syntax) This is needed for Sybase 11.9.2 and earlier, using the HQL 2.* syntax with Collections.
author
Colm O' Flaherty

Fields Summary
private StringBuffer
afterFrom
private StringBuffer
afterWhere
Constructors Summary
Methods Summary
public voidaddCondition(java.lang.String alias, java.lang.String[] columns, java.lang.String condition)

		for ( int i=0; i<columns.length; i++ ) {
			afterWhere.append(" and ")
				.append(alias)
				.append('.")
				.append( columns[i] )
				.append(condition);
		}
	
public voidaddCondition(java.lang.String alias, java.lang.String[] fkColumns, java.lang.String[] pkColumns)

		throw new UnsupportedOperationException();

	
public booleanaddCondition(java.lang.String condition)

		return addCondition(afterWhere, condition);
	
public voidaddCrossJoin(java.lang.String tableName, java.lang.String alias)

		afterFrom.append(", ")
			.append(tableName)
			.append(' ")
			.append(alias);
	
public voidaddFromFragmentString(java.lang.String fromFragmentString)

		afterFrom.append(fromFragmentString);
	
public voidaddJoin(java.lang.String tableName, java.lang.String alias, java.lang.String[] fkColumns, java.lang.String[] pkColumns, int joinType)


	            

		addCrossJoin(tableName, alias);

		for ( int j=0; j<fkColumns.length; j++) {
			//full joins are not supported.. yet!
			if (joinType==JoinFragment.FULL_JOIN ) throw new UnsupportedOperationException();

			afterWhere.append(" and ")
				.append( fkColumns[j] )
				.append( " " );

			if (joinType==LEFT_OUTER_JOIN ) afterWhere.append("*");
			afterWhere.append('=");
			if (joinType==RIGHT_OUTER_JOIN ) afterWhere.append("*");

			afterWhere.append (" ")
				.append(alias)
				.append('.")
				.append( pkColumns[j] );
		}

	
public voidaddJoin(java.lang.String tableName, java.lang.String alias, java.lang.String[] fkColumns, java.lang.String[] pkColumns, int joinType, java.lang.String on)

		addJoin(tableName, alias, fkColumns, pkColumns, joinType);
		addCondition(on);
	
public voidaddJoins(java.lang.String fromFragment, java.lang.String whereFragment)

		afterFrom.append(fromFragment);
		afterWhere.append(whereFragment);
	
public JoinFragmentcopy()

		Sybase11JoinFragment copy = new Sybase11JoinFragment();
		copy.afterFrom = new StringBuffer( afterFrom.toString() );
		copy.afterWhere = new StringBuffer( afterWhere.toString() );
		return copy;
	
public java.lang.StringtoFromFragmentString()

		return afterFrom.toString();
	
public java.lang.StringtoWhereFragmentString()

		return afterWhere.toString();