Example usage for org.hibernate.dialect.function StandardSQLFunction StandardSQLFunction

List of usage examples for org.hibernate.dialect.function StandardSQLFunction StandardSQLFunction

Introduction

In this page you can find the example usage for org.hibernate.dialect.function StandardSQLFunction StandardSQLFunction.

Prototype

public StandardSQLFunction(String name, Type registeredType) 

Source Link

Document

Construct a standard SQL function definition with a static return type.

Usage

From source file:hacks.VirtuosoSybaseDialect.java

License:Open Source License

public VirtuosoSybaseDialect() {
    super();//w w  w.  j  a  v a  2  s  . com
    registerColumnType(Types.BIT, "smallint"); //Sybase BIT type does not support null values
    //registerColumnType( Types.BIGINT, "numeric(19,0)" );
    registerColumnType(Types.BIGINT, "decimal");
    registerColumnType(Types.SMALLINT, "smallint");
    registerColumnType(Types.TINYINT, "tinyint");
    registerColumnType(Types.INTEGER, "int");
    registerColumnType(Types.CHAR, "char(1)");
    registerColumnType(Types.VARCHAR, "varchar($l)");
    registerColumnType(Types.FLOAT, "float");
    registerColumnType(Types.DOUBLE, "double precision");
    registerColumnType(Types.DATE, "datetime");
    registerColumnType(Types.TIME, "datetime");
    registerColumnType(Types.TIMESTAMP, "datetime");
    registerColumnType(Types.VARBINARY, "varbinary($l)");
    registerColumnType(Types.NUMERIC, "numeric($p,$s)");
    registerColumnType(Types.BLOB, "image");
    registerColumnType(Types.CLOB, "text");

    registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER));
    registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER));
    registerFunction("len", new StandardSQLFunction("len", Hibernate.LONG));
    registerFunction("lower", new StandardSQLFunction("lower"));
    registerFunction("upper", new StandardSQLFunction("upper"));
    registerFunction("str", new StandardSQLFunction("str", Hibernate.STRING));
    registerFunction("ltrim", new StandardSQLFunction("ltrim"));
    registerFunction("rtrim", new StandardSQLFunction("rtrim"));
    registerFunction("reverse", new StandardSQLFunction("reverse"));
    registerFunction("space", new StandardSQLFunction("space", Hibernate.STRING));

    registerFunction("user", new NoArgSQLFunction("user", Hibernate.STRING));

    registerFunction("current_timestamp", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP));
    registerFunction("current_time", new NoArgSQLFunction("getdate", Hibernate.TIME));
    registerFunction("current_date", new NoArgSQLFunction("getdate", Hibernate.DATE));

    registerFunction("getdate", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP));
    registerFunction("getutcdate", new NoArgSQLFunction("getutcdate", Hibernate.TIMESTAMP));
    registerFunction("day", new StandardSQLFunction("day", Hibernate.INTEGER));
    registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER));
    registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER));
    registerFunction("datename", new StandardSQLFunction("datename", Hibernate.STRING));

    registerFunction("abs", new StandardSQLFunction("abs"));
    registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER));

    registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE));
    registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE));
    registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE));
    registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE));
    registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE));
    registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE));
    registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE));
    registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE));
    registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE));
    registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE));
    registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE));
    registerFunction("pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE));
    registerFunction("square", new StandardSQLFunction("square"));
    registerFunction("rand", new StandardSQLFunction("rand", Hibernate.FLOAT));

    registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE));
    registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE));

    registerFunction("round", new StandardSQLFunction("round"));
    registerFunction("ceiling", new StandardSQLFunction("ceiling"));
    registerFunction("floor", new StandardSQLFunction("floor"));

    registerFunction("isnull", new StandardSQLFunction("isnull"));

    registerFunction("concat", new VarArgsSQLFunction(Hibernate.STRING, "(", "+", ")"));

    registerFunction("length", new StandardSQLFunction("len", Hibernate.INTEGER));
    registerFunction("trim", new SQLFunctionTemplate(Hibernate.STRING, "ltrim(rtrim(?1))"));
    registerFunction("locate", new CharIndexFunction());

    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);
}

From source file:net.sourceforge.squirrel_sql.fw.dialects.TeiidDialect.java

License:Open Source License

public TeiidDialect() {
    // Register types
    registerColumnType(Types.CHAR, "char"); //$NON-NLS-1$
    registerColumnType(Types.VARCHAR, "string"); //$NON-NLS-1$

    registerColumnType(Types.BIT, "boolean"); //$NON-NLS-1$
    registerColumnType(Types.TINYINT, "byte"); //$NON-NLS-1$
    registerColumnType(Types.SMALLINT, "short"); //$NON-NLS-1$
    registerColumnType(Types.INTEGER, "integer"); //$NON-NLS-1$
    registerColumnType(Types.BIGINT, "long"); //$NON-NLS-1$

    registerColumnType(Types.REAL, "float"); //$NON-NLS-1$
    registerColumnType(Types.FLOAT, "float"); //$NON-NLS-1$
    registerColumnType(Types.DOUBLE, "double"); //$NON-NLS-1$
    registerColumnType(Types.NUMERIC, "bigdecimal"); //$NON-NLS-1$

    registerColumnType(Types.DATE, "date"); //$NON-NLS-1$
    registerColumnType(Types.TIME, "time"); //$NON-NLS-1$
    registerColumnType(Types.TIMESTAMP, "timestamp"); //$NON-NLS-1$

    registerColumnType(Types.BLOB, "blob"); //$NON-NLS-1$
    registerColumnType(Types.VARBINARY, "blob"); //$NON-NLS-1$
    registerColumnType(Types.CLOB, "clob"); //$NON-NLS-1$
    registerColumnType(Types.JAVA_OBJECT, "object"); //$NON-NLS-1$

    registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("atan2", new StandardSQLFunction("atan2", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("ceil", new StandardSQLFunction("ceiling")); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("floor", new StandardSQLFunction("floor")); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("formatbigdecimal", new StandardSQLFunction("formatbigdecimal", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("formatbiginteger", new StandardSQLFunction("formatbiginteger", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("formatdouble", new StandardSQLFunction("formatdouble", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("formatfloat", new StandardSQLFunction("formatfloat", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("formatinteger", new StandardSQLFunction("formatinteger", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("formatlong", new StandardSQLFunction("formatlong", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("mod", new StandardSQLFunction("mod")); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("parsebigdecimal", new StandardSQLFunction("parsebigdecimal", Hibernate.BIG_DECIMAL)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("parsebiginteger", new StandardSQLFunction("parsebiginteger", Hibernate.BIG_INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("parsedouble", new StandardSQLFunction("parsedouble", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("parsefloat", new StandardSQLFunction("parsefloat", Hibernate.FLOAT)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("parseinteger", new StandardSQLFunction("parseinteger", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("parselong", new StandardSQLFunction("parselong", Hibernate.LONG)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("pi", new StandardSQLFunction("pi", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("power", new StandardSQLFunction("power", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("round", new StandardSQLFunction("round")); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE)); //$NON-NLS-1$ //$NON-NLS-2$

    registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("chr", new StandardSQLFunction("chr", Hibernate.CHARACTER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    registerFunction("initcap", new StandardSQLFunction("initcap", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("insert", new StandardSQLFunction("insert", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("lcase", new StandardSQLFunction("lcase", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("left", new StandardSQLFunction("left", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("locate", new StandardSQLFunction("locate", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("lpad", new StandardSQLFunction("lpad", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("ltrim", new StandardSQLFunction("ltrim", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("repeat", new StandardSQLFunction("repeat", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("replace", new StandardSQLFunction("replace", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("right", new StandardSQLFunction("right", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("rpad", new StandardSQLFunction("rpad", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("rtrim", new StandardSQLFunction("rtrim", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("substring", new StandardSQLFunction("substring", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("translate", new StandardSQLFunction("translate", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("ucase", new StandardSQLFunction("ucase", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$

    registerFunction("curdate", new NoArgSQLFunction("curdate", Hibernate.DATE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("curtime", new NoArgSQLFunction("curtime", Hibernate.TIME)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("now", new NoArgSQLFunction("now", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("formatdate", new StandardSQLFunction("formatdate", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("formattime", new StandardSQLFunction("formattime", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("formattimestamp", new StandardSQLFunction("formattimestamp", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("parsedate", new StandardSQLFunction("parsedate", Hibernate.DATE)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("parsetime", new StandardSQLFunction("parsetime", Hibernate.TIME)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("parsetimestamp", new StandardSQLFunction("parsetimestamp", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("timestampcreate", new StandardSQLFunction("timestampcreate", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("timestampAdd", new StandardSQLFunction("timestampAdd")); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("timestampDiff", new StandardSQLFunction("timestampDiff", Hibernate.LONG)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("modifytimezone", new StandardSQLFunction("modifytimezone", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$

    registerFunction("convert", new StandardSQLFunction("convert")); //$NON-NLS-1$ //$NON-NLS-2$

    registerFunction("to_bytes", new StandardSQLFunction("to_bytes", Hibernate.BLOB)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("to_chars", new StandardSQLFunction("to_chars", Hibernate.CLOB)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("from_unittime", new StandardSQLFunction("from_unittime", Hibernate.TIMESTAMP)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("session_id", new StandardSQLFunction("session_id", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$

    registerFunction("uuid", new StandardSQLFunction("uuid", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("unescape", new StandardSQLFunction("unescape", Hibernate.STRING)); //$NON-NLS-1$ //$NON-NLS-2$

    registerFunction("array_get", new StandardSQLFunction("uuid", Hibernate.OBJECT)); //$NON-NLS-1$ //$NON-NLS-2$
    registerFunction("array_length", new StandardSQLFunction("unescape", Hibernate.INTEGER)); //$NON-NLS-1$ //$NON-NLS-2$
}

From source file:nl.rivm.cib.epidemes.geodb.jdbc.PostgisDialectExtended.java

License:Apache License

public PostgisDialectExtended() {
    super();//from ww w . ja va2  s  .c om
    registerFunction("Transform", new StandardSQLFunction("ST_Transform", StandardBasicTypes.STRING));
    registerFunction("AsGeoJson", new StandardSQLFunction("ST_AsGeoJson", StandardBasicTypes.STRING));
    registerFunction("AsGml", new StandardSQLFunction("ST_AsGml", StandardBasicTypes.STRING));
    registerFunction("AsKml", new StandardSQLFunction("ST_AsKml", StandardBasicTypes.STRING));
    registerFunction("Srid", new StandardSQLFunction("ST_Srid", StandardBasicTypes.INTEGER));
}

From source file:org.bedework.calcore.H2Dialect.java

License:Apache License

/**
 *
 *//*ww w  .j  a  v a  2  s  . c  o m*/
public H2Dialect() {
    super();

    registerColumnType(Types.BIT, "boolean");
    registerColumnType(Types.NUMERIC, "decimal($p,$s)");

    registerFunction("quarter", new StandardSQLFunction("quarter", StandardBasicTypes.INTEGER));
}

From source file:org.bedework.util.hibernate.h2.H2Dialect.java

License:Apache License

/**
 *
 *///from w ww. j  a v a2 s.  com
public H2Dialect() {
    super();

    registerColumnType(Types.BIT, "boolean");
    registerColumnType(Types.NUMERIC, "decimal($p,$s)");

    registerFunction("quarter", new StandardSQLFunction("quarter", Hibernate.INTEGER));
}

From source file:org.csc.phynixx.sqlquery.config.h2.ExtendedH2Dialect.java

License:Apache License

public ExtendedH2Dialect() {
    super();/*  w  ww.  j  av  a 2 s  .  c o m*/
    this.registerFunction("person_name", new StandardSQLFunction("person_name", StandardBasicTypes.STRING));
    this.registerFunction("PERSON_NAME", new StandardSQLFunction("PERSON_NAME", StandardBasicTypes.STRING));
}

From source file:org.geoserver.hibernate.H2Dialect.java

License:Open Source License

public H2Dialect() {
    super();//from  w ww.ja  va 2 s.c  om
    querySequenceString = "select sequence_name from information_schema.sequences";
    try {
        Class constants = ReflectHelper.classForName("org.h2.engine.Constants");
        Integer build = (Integer) constants.getDeclaredField("BUILD_ID").get(null);
        int buildId = build.intValue();
        if (buildId < 32) {
            querySequenceString = "select name from information_schema.sequences";
        }
    } catch (Throwable e) {
        // ignore (probably H2 not in the classpath)
    }

    registerColumnType(Types.BOOLEAN, "boolean");
    registerColumnType(Types.BIGINT, "bigint");
    registerColumnType(Types.BINARY, "binary");
    registerColumnType(Types.BIT, "boolean");
    registerColumnType(Types.CHAR, "varchar($l)");
    registerColumnType(Types.DATE, "date");
    registerColumnType(Types.DECIMAL, "decimal($p,$s)");
    registerColumnType(Types.DOUBLE, "double");
    registerColumnType(Types.FLOAT, "float");
    registerColumnType(Types.INTEGER, "integer");
    registerColumnType(Types.LONGVARBINARY, "longvarbinary");
    registerColumnType(Types.LONGVARCHAR, "longvarchar");
    registerColumnType(Types.REAL, "real");
    registerColumnType(Types.SMALLINT, "smallint");
    registerColumnType(Types.TINYINT, "tinyint");
    registerColumnType(Types.TIME, "time");
    registerColumnType(Types.TIMESTAMP, "timestamp");
    registerColumnType(Types.VARCHAR, "varchar($l)");
    registerColumnType(Types.VARBINARY, "binary($l)");
    registerColumnType(Types.NUMERIC, "numeric");
    registerColumnType(Types.BLOB, "blob");
    registerColumnType(Types.CLOB, "clob");

    // select topic, syntax from information_schema.help
    // where section like 'Function%' order by section, topic

    // registerFunction("abs", new StandardSQLFunction("abs"));
    registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE));
    registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE));
    registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE));
    registerFunction("atan2", new StandardSQLFunction("atan2", Hibernate.DOUBLE));
    registerFunction("bitand", new StandardSQLFunction("bitand", Hibernate.INTEGER));
    registerFunction("bitor", new StandardSQLFunction("bitor", Hibernate.INTEGER));
    registerFunction("bitxor", new StandardSQLFunction("bitxor", Hibernate.INTEGER));
    registerFunction("ceiling", new StandardSQLFunction("ceiling", Hibernate.DOUBLE));
    registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE));
    registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE));
    registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE));
    registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE));
    registerFunction("floor", new StandardSQLFunction("floor", Hibernate.DOUBLE));
    registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE));
    registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE));
    // registerFunction("mod", new StandardSQLFunction("mod", Hibernate.INTEGER));
    registerFunction("pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE));
    registerFunction("power", new StandardSQLFunction("power", Hibernate.DOUBLE));
    registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE));
    registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE));
    registerFunction("round", new StandardSQLFunction("round", Hibernate.DOUBLE));
    registerFunction("roundmagic", new StandardSQLFunction("roundmagic", Hibernate.DOUBLE));
    registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER));
    registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE));
    // registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE));
    registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE));
    registerFunction("truncate", new StandardSQLFunction("truncate", Hibernate.DOUBLE));

    registerFunction("compress", new StandardSQLFunction("compress", Hibernate.BINARY));
    registerFunction("expand", new StandardSQLFunction("compress", Hibernate.BINARY));
    registerFunction("decrypt", new StandardSQLFunction("decrypt", Hibernate.BINARY));
    registerFunction("encrypt", new StandardSQLFunction("encrypt", Hibernate.BINARY));
    registerFunction("hash", new StandardSQLFunction("hash", Hibernate.BINARY));

    registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER));
    // registerFunction("bit_length", new StandardSQLFunction("bit_length", Hibernate.INTEGER));
    registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER));
    registerFunction("concat", new VarArgsSQLFunction(Hibernate.STRING, "(", "||", ")"));
    registerFunction("difference", new StandardSQLFunction("difference", Hibernate.INTEGER));
    registerFunction("hextoraw", new StandardSQLFunction("hextoraw", Hibernate.STRING));
    registerFunction("lower", new StandardSQLFunction("lower", Hibernate.STRING));
    registerFunction("insert", new StandardSQLFunction("lower", Hibernate.STRING));
    registerFunction("left", new StandardSQLFunction("left", Hibernate.STRING));
    // registerFunction("length", new StandardSQLFunction("length", Hibernate.INTEGER));
    // registerFunction("locate", new StandardSQLFunction("locate", Hibernate.INTEGER));
    // registerFunction("lower", new StandardSQLFunction("lower", Hibernate.STRING));
    registerFunction("lcase", new StandardSQLFunction("lcase", Hibernate.STRING));
    registerFunction("ltrim", new StandardSQLFunction("ltrim", Hibernate.STRING));
    registerFunction("octet_length", new StandardSQLFunction("octet_length", Hibernate.INTEGER));
    registerFunction("position", new StandardSQLFunction("position", Hibernate.INTEGER));
    registerFunction("rawtohex", new StandardSQLFunction("rawtohex", Hibernate.STRING));
    registerFunction("repeat", new StandardSQLFunction("repeat", Hibernate.STRING));
    registerFunction("replace", new StandardSQLFunction("replace", Hibernate.STRING));
    registerFunction("right", new StandardSQLFunction("right", Hibernate.STRING));
    registerFunction("rtrim", new StandardSQLFunction("rtrim", Hibernate.STRING));
    registerFunction("soundex", new StandardSQLFunction("soundex", Hibernate.STRING));
    registerFunction("space", new StandardSQLFunction("space", Hibernate.STRING));
    registerFunction("stringencode", new StandardSQLFunction("stringencode", Hibernate.STRING));
    registerFunction("stringdecode", new StandardSQLFunction("stringdecode", Hibernate.STRING));
    // registerFunction("substring", new StandardSQLFunction("substring", Hibernate.STRING));
    // registerFunction("upper", new StandardSQLFunction("upper", Hibernate.STRING));
    registerFunction("ucase", new StandardSQLFunction("ucase", Hibernate.STRING));

    registerFunction("stringtoutf8", new StandardSQLFunction("stringtoutf8", Hibernate.BINARY));
    registerFunction("utf8tostring", new StandardSQLFunction("utf8tostring", Hibernate.STRING));

    registerFunction("current_date", new NoArgSQLFunction("current_date", Hibernate.DATE));
    registerFunction("current_time", new NoArgSQLFunction("current_time", Hibernate.TIME));
    registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP));
    registerFunction("datediff", new NoArgSQLFunction("datediff", Hibernate.INTEGER));
    registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING));
    registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER));
    registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER));
    registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER));
    // registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER));
    // registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER));
    // registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER));
    registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING));
    registerFunction("quarter", new StandardSQLFunction("quarter", Hibernate.INTEGER));
    // registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER));
    registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER));
    // registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER));

    registerFunction("curdate", new NoArgSQLFunction("curdate", Hibernate.DATE));
    registerFunction("curtime", new NoArgSQLFunction("curtime", Hibernate.TIME));
    registerFunction("curtimestamp", new NoArgSQLFunction("curtimestamp", Hibernate.TIME));
    registerFunction("now", new NoArgSQLFunction("now", Hibernate.TIMESTAMP));

    registerFunction("database", new NoArgSQLFunction("database", Hibernate.STRING));
    registerFunction("user", new NoArgSQLFunction("user", Hibernate.STRING));

    getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);

}

From source file:org.n52.sos.config.sqlite.HibernateSQLiteDialect.java

License:Open Source License

public HibernateSQLiteDialect() {
    registerColumnType(Types.BIT, "integer");
    registerColumnType(Types.TINYINT, "tinyint");
    registerColumnType(Types.SMALLINT, "smallint");
    registerColumnType(Types.INTEGER, "integer");
    registerColumnType(Types.BIGINT, "bigint");
    registerColumnType(Types.FLOAT, "float");
    registerColumnType(Types.REAL, "real");
    registerColumnType(Types.DOUBLE, "double");
    registerColumnType(Types.NUMERIC, "numeric");
    registerColumnType(Types.DECIMAL, "decimal");
    registerColumnType(Types.CHAR, "char");
    registerColumnType(Types.VARCHAR, "varchar");
    registerColumnType(Types.LONGVARCHAR, "longvarchar");
    registerColumnType(Types.DATE, "date");
    registerColumnType(Types.TIME, "time");
    registerColumnType(Types.TIMESTAMP, "timestamp");
    registerColumnType(Types.BINARY, "blob");
    registerColumnType(Types.VARBINARY, "blob");
    registerColumnType(Types.LONGVARBINARY, "blob");
    registerColumnType(Types.BLOB, "blob");
    registerColumnType(Types.CLOB, "clob");
    registerColumnType(Types.BOOLEAN, "integer");
    registerFunction("concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", ""));
    registerFunction("mod", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "?1 % ?2"));
    registerFunction("substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING));
    registerFunction("substring", new StandardSQLFunction("substr", StandardBasicTypes.STRING));

    sqliteUniqueDelegate = new SQLiteUniqueDelegate(this);
}

From source file:org.niord.core.db.MySQLSpatialDialect.java

License:Apache License

private MySQLSpatialFunctions overrideObjectShapeFunctions(MySQLSpatialFunctions mysqlFunctions) {
    mysqlFunctions.put("contains", new StandardSQLFunction("ST_Contains", StandardBasicTypes.BOOLEAN));
    mysqlFunctions.put("crosses", new StandardSQLFunction("ST_Crosses", StandardBasicTypes.BOOLEAN));
    mysqlFunctions.put("disjoint", new StandardSQLFunction("ST_Disjoint", StandardBasicTypes.BOOLEAN));
    mysqlFunctions.put("equals", new StandardSQLFunction("ST_Equals", StandardBasicTypes.BOOLEAN));
    mysqlFunctions.put("intersects", new StandardSQLFunction("ST_Intersects", StandardBasicTypes.BOOLEAN));
    mysqlFunctions.put("overlaps", new StandardSQLFunction("ST_Overlaps", StandardBasicTypes.BOOLEAN));
    mysqlFunctions.put("touches", new StandardSQLFunction("ST_Touches", StandardBasicTypes.BOOLEAN));
    mysqlFunctions.put("within", new StandardSQLFunction("ST_Within", StandardBasicTypes.BOOLEAN));
    return mysqlFunctions;
}

From source file:org.niord.core.db.MySQLSpatialDialect.java

License:Apache License

MySQLSpatialFunctions() {
    functionsToRegister.put("dimension", new StandardSQLFunction("dimension", StandardBasicTypes.INTEGER));
    functionsToRegister.put("geometrytype", new StandardSQLFunction("geometrytype", StandardBasicTypes.STRING));
    functionsToRegister.put("srid", new StandardSQLFunction("srid", StandardBasicTypes.INTEGER));
    functionsToRegister.put("envelope", new StandardSQLFunction("envelope"));
    functionsToRegister.put("astext", new StandardSQLFunction("astext", StandardBasicTypes.STRING));
    functionsToRegister.put("asbinary", new StandardSQLFunction("asbinary", StandardBasicTypes.BINARY));
    functionsToRegister.put("isempty", new StandardSQLFunction("isempty", StandardBasicTypes.BOOLEAN));
    functionsToRegister.put("issimple", new StandardSQLFunction("issimple", StandardBasicTypes.BOOLEAN));
    // Register functions for spatial relation constructs
    functionsToRegister.put("overlaps", new StandardSQLFunction("overlaps", StandardBasicTypes.BOOLEAN));
    functionsToRegister.put("intersects", new StandardSQLFunction("intersects", StandardBasicTypes.BOOLEAN));
    functionsToRegister.put("equals", new StandardSQLFunction("equals", StandardBasicTypes.BOOLEAN));
    functionsToRegister.put("contains", new StandardSQLFunction("contains", StandardBasicTypes.BOOLEAN));
    functionsToRegister.put("crosses", new StandardSQLFunction("crosses", StandardBasicTypes.BOOLEAN));
    functionsToRegister.put("disjoint", new StandardSQLFunction("disjoint", StandardBasicTypes.BOOLEAN));
    functionsToRegister.put("touches", new StandardSQLFunction("touches", StandardBasicTypes.BOOLEAN));
    functionsToRegister.put("within", new StandardSQLFunction("within", StandardBasicTypes.BOOLEAN));
}