[hibernate-commits] Hibernate SVN: r18999 - core/trunk/core/src/main/java/org/hibernate/dialect.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Mon Mar 15 08:49:58 EDT 2010
Author: stliu
Date: 2010-03-15 08:49:58 -0400 (Mon, 15 Mar 2010)
New Revision: 18999
Modified:
core/trunk/core/src/main/java/org/hibernate/dialect/Ingres9Dialect.java
Log:
HHH-4946 org.hibernate.test.legacy.FooBarTests testLimit failure with Ingres
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Ingres9Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Ingres9Dialect.java 2010-03-15 10:29:22 UTC (rev 18998)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Ingres9Dialect.java 2010-03-15 12:49:58 UTC (rev 18999)
@@ -3,6 +3,7 @@
import java.sql.Types;
import org.hibernate.Hibernate;
+import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction;
/**
@@ -41,7 +42,6 @@
*/
protected void registerDateTimeColumnTypes() {
registerColumnType(Types.DATE, "ansidate");
- //registerColumnType(Types.TIME, "time with time zone");
registerColumnType(Types.TIMESTAMP, "timestamp(9) with time zone");
}
@@ -126,7 +126,7 @@
}
/**
- * Retrieve the command used to retrieve the current timestamp from the
+ * Retrieve the command used to retrieve the current timestammp from the
* database.
*
* @return The command.
@@ -189,7 +189,7 @@
}
/**
- * 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?
*
* @return false
@@ -199,17 +199,29 @@
}
/**
+ * 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>
*
* @return the modified SQL
*/
public String getLimitString(String querySelect, int offset, int limit) {
- StringBuffer sb = new StringBuffer(querySelect.length() + 16);
- sb.append(querySelect.trim()).insert(6, " first " + limit);
+ StringBuffer soff = new StringBuffer(" offset " + offset);
+ StringBuffer slim = new StringBuffer(" fetch first " + limit + " rows only");
+ StringBuffer sb = new StringBuffer(querySelect.length() +
+ soff.length() + slim.length()).append(querySelect);
if (offset > 0) {
- sb.append(" offset " + offset);
+ sb.append(soff);
}
+ if (limit > 0) {
+ sb.append(slim);
+ }
return sb.toString();
}
-
}
More information about the hibernate-commits
mailing list