FileDocCategorySizeDatePackage
ConvertFunction.javaAPI DocHibernate 3.2.51209Wed Nov 08 09:56:52 GMT 2006org.hibernate.dialect.function

ConvertFunction

public class ConvertFunction extends Object implements SQLFunction
A Caché defintion of a convert function.
author
Jonathan Levinson

Fields Summary
Constructors Summary
Methods Summary
public org.hibernate.type.TypegetReturnType(org.hibernate.type.Type columnType, org.hibernate.engine.Mapping mapping)

		return Hibernate.STRING;
	
public booleanhasArguments()

		return true;
	
public booleanhasParenthesesIfNoArguments()

		return true;
	
public java.lang.Stringrender(java.util.List args, org.hibernate.engine.SessionFactoryImplementor factory)

		if ( args.size() != 2 && args.size() != 3 ) {
			throw new QueryException( "convert() requires two or three arguments" );
		}
		String type = ( String ) args.get( 1 );

		if ( args.size() == 2 ) {
			return "{fn convert(" + args.get( 0 ) + " , " + type + ")}";
		}
		else {
			return "convert(" + args.get( 0 ) + " , " + type + "," + args.get( 2 ) + ")";
		}