mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 16:15:06 +00:00
HHH-7041: Fixed error in Pattern regexp and removed static from protected methods
This commit is contained in:
parent
081b2c5a14
commit
e1a78dfd4a
@ -44,7 +44,7 @@ public class SQLServer2005Dialect extends SQLServerDialect {
|
||||
/**
|
||||
* Regular expression for stripping alias
|
||||
*/
|
||||
private static final Pattern ALIAS_PATTERN = Pattern.compile( "\\sas[^,]+(,?)" );
|
||||
private static final Pattern ALIAS_PATTERN = Pattern.compile( "\\sas\\s[^,]+(,?)" );
|
||||
|
||||
public SQLServer2005Dialect() {
|
||||
// HHH-3965 fix
|
||||
@ -147,7 +147,7 @@ public String getLimitString(String querySqlString, boolean hasOffset) {
|
||||
*
|
||||
* @param sql an sql query
|
||||
*/
|
||||
protected static void replaceDistinctWithGroupBy(StringBuilder sql) {
|
||||
protected void replaceDistinctWithGroupBy(StringBuilder sql) {
|
||||
int distinctIndex = sql.indexOf( DISTINCT );
|
||||
int selectEndIndex = sql.indexOf( FROM );
|
||||
if (distinctIndex > 0 && distinctIndex < selectEndIndex) {
|
||||
@ -164,7 +164,7 @@ protected static void replaceDistinctWithGroupBy(StringBuilder sql) {
|
||||
*
|
||||
* @return the fields of the select statement without their alias
|
||||
*/
|
||||
protected static CharSequence getSelectFieldsWithoutAliases(StringBuilder sql) {
|
||||
protected CharSequence getSelectFieldsWithoutAliases(StringBuilder sql) {
|
||||
String select = sql.substring( sql.indexOf( SELECT ) + SELECT.length(), sql.indexOf( FROM ) );
|
||||
|
||||
// Strip the as clauses
|
||||
@ -178,7 +178,7 @@ protected static CharSequence getSelectFieldsWithoutAliases(StringBuilder sql) {
|
||||
*
|
||||
* @return a string without the as statements
|
||||
*/
|
||||
protected static String stripAliases(String str) {
|
||||
protected String stripAliases(String str) {
|
||||
Matcher matcher = ALIAS_PATTERN.matcher( str );
|
||||
return matcher.replaceAll( "$1" );
|
||||
}
|
||||
@ -189,7 +189,7 @@ protected static String stripAliases(String str) {
|
||||
* @param sql the initial sql query without the order by clause
|
||||
* @param orderby the order by clause of the query
|
||||
*/
|
||||
protected static void insertRowNumberFunction(StringBuilder sql, CharSequence orderby) {
|
||||
protected void insertRowNumberFunction(StringBuilder sql, CharSequence orderby) {
|
||||
// Find the end of the select statement
|
||||
int selectEndIndex = sql.indexOf( FROM );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user