HHH-13588 Add missed functions to MySQL Dialect: weight_string, to_base64, from_base64, regexp_replace, regexp_instr, regexp_substr

This commit is contained in:
Sergey Ponomarev 2019-08-17 19:38:30 +03:00 committed by Sanne Grinovero
parent 0a1213be1a
commit 0a3f62abbf
2 changed files with 13 additions and 0 deletions

View File

@ -9,7 +9,9 @@ package org.hibernate.dialect;
import java.sql.Types;
import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.StaticPrecisionFspTimestampFunction;
import org.hibernate.type.StandardBasicTypes;
/**
* @author Gail Badner
@ -64,6 +66,11 @@ public class MySQL57Dialect extends MySQL55Dialect {
// from_unixtime(), timestamp() are functions that return TIMESTAMP that do not support a
// fractional seconds precision argument (so there's no need to override them here):
registerFunction( "weight_string", new StandardSQLFunction( "weight_string", StandardBasicTypes.STRING ) );
registerFunction( "to_base64", new StandardSQLFunction( "to_base64", StandardBasicTypes.STRING ) );
registerFunction( "from_base64", new StandardSQLFunction( "from_base64", StandardBasicTypes.STRING ) );
}
/**

View File

@ -7,6 +7,8 @@
package org.hibernate.dialect;
import org.hibernate.LockOptions;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.type.StandardBasicTypes;
/**
* @author Vlad Mihalcea
@ -33,6 +35,10 @@ public class MySQL8Dialect extends MySQL57Dialect {
registerKeyword("PERSIST_ONLY");
registerKeyword("RANK");
registerKeyword("ROW_NUMBER");
registerFunction( "regexp_replace", new StandardSQLFunction( "regexp_replace", StandardBasicTypes.STRING ) );
registerFunction( "regexp_instr", new StandardSQLFunction( "regexp_instr", StandardBasicTypes.INTEGER ) );
registerFunction( "regexp_substr", new StandardSQLFunction( "regexp_substr", StandardBasicTypes.STRING ) );
}
@Override