HHH-4946 org.hibernate.test.legacy.FooBarTests testLimit failure with Ingres
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18999 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
c937d0a393
commit
e0694c871b
|
@ -3,6 +3,7 @@ package org.hibernate.dialect;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,7 +42,6 @@ public class Ingres9Dialect extends IngresDialect {
|
||||||
*/
|
*/
|
||||||
protected void registerDateTimeColumnTypes() {
|
protected void registerDateTimeColumnTypes() {
|
||||||
registerColumnType(Types.DATE, "ansidate");
|
registerColumnType(Types.DATE, "ansidate");
|
||||||
//registerColumnType(Types.TIME, "time with time zone");
|
|
||||||
registerColumnType(Types.TIMESTAMP, "timestamp(9) with time zone");
|
registerColumnType(Types.TIMESTAMP, "timestamp(9) with time zone");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ public class Ingres9Dialect extends IngresDialect {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the command used to retrieve the current timestamp from the
|
* Retrieve the command used to retrieve the current timestammp from the
|
||||||
* database.
|
* database.
|
||||||
*
|
*
|
||||||
* @return The command.
|
* @return The command.
|
||||||
|
@ -189,7 +189,7 @@ public class Ingres9Dialect extends IngresDialect {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this dialect support bind variables (i.e., prepared statement
|
* Does this dialect support bind variables (i.e., prepared statememnt
|
||||||
* parameters) for its limit/offset?
|
* parameters) for its limit/offset?
|
||||||
*
|
*
|
||||||
* @return false
|
* @return false
|
||||||
|
@ -198,18 +198,30 @@ public class Ingres9Dialect extends IngresDialect {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does the <tt>LIMIT</tt> clause take a "maximum" row number instead
|
||||||
|
* of a total number of returned rows?
|
||||||
|
*/
|
||||||
|
public boolean useMaxForLimit() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a <tt>LIMIT</tt> clause to the given SQL <tt>SELECT</tt>
|
* Add a <tt>LIMIT</tt> clause to the given SQL <tt>SELECT</tt>
|
||||||
*
|
*
|
||||||
* @return the modified SQL
|
* @return the modified SQL
|
||||||
*/
|
*/
|
||||||
public String getLimitString(String querySelect, int offset, int limit) {
|
public String getLimitString(String querySelect, int offset, int limit) {
|
||||||
StringBuffer sb = new StringBuffer(querySelect.length() + 16);
|
StringBuffer soff = new StringBuffer(" offset " + offset);
|
||||||
sb.append(querySelect.trim()).insert(6, " first " + limit);
|
StringBuffer slim = new StringBuffer(" fetch first " + limit + " rows only");
|
||||||
|
StringBuffer sb = new StringBuffer(querySelect.length() +
|
||||||
|
soff.length() + slim.length()).append(querySelect);
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
sb.append(" offset " + offset);
|
sb.append(soff);
|
||||||
}
|
}
|
||||||
|
if (limit > 0) {
|
||||||
|
sb.append(slim);
|
||||||
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue