From ad4f2c99702ab409db59fe7697644d3b9d3e5245 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 28 Feb 2011 22:58:38 +0000 Subject: [PATCH] Changed expressions that deal with count() results to Number because Postgres in its burning desire to support the amazing four hundred billion rows, returns a Long for count expressions. Clients using selectCount() won't be impacted, but clients doing more complex counting are going to have to sprinkle in some .intValue() calls. --- src/main/java/com/samskivert/depot/Funcs.java | 6 +++--- .../com/samskivert/depot/impl/expression/AggregateFun.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/samskivert/depot/Funcs.java b/src/main/java/com/samskivert/depot/Funcs.java index 9cb415f..131f802 100644 --- a/src/main/java/com/samskivert/depot/Funcs.java +++ b/src/main/java/com/samskivert/depot/Funcs.java @@ -57,7 +57,7 @@ public class Funcs * Creates an aggregate expression that counts the number of rows that match the other clauses * in this query. */ - public static FluentExp countStar () + public static FluentExp countStar () { return new Count(Exps.literal("*")); } @@ -66,7 +66,7 @@ public class Funcs * Creates an aggregate expression that counts the number of rows from the supplied * expression. This would usually be used in a FieldOverride and supplied with a ColumnExp. */ - public static FluentExp count (SQLExpression expr) + public static FluentExp count (SQLExpression expr) { return new Count(expr); } @@ -76,7 +76,7 @@ public class Funcs * supplied expression. This would usually be used in a FieldOverride and supplied with a * ColumnExp. */ - public static FluentExp countDistinct (SQLExpression expr) + public static FluentExp countDistinct (SQLExpression expr) { return new Count(expr, true); } diff --git a/src/main/java/com/samskivert/depot/impl/expression/AggregateFun.java b/src/main/java/com/samskivert/depot/impl/expression/AggregateFun.java index 0cad4e1..4937809 100644 --- a/src/main/java/com/samskivert/depot/impl/expression/AggregateFun.java +++ b/src/main/java/com/samskivert/depot/impl/expression/AggregateFun.java @@ -41,7 +41,7 @@ public abstract class AggregateFun extends OneArgFun } } - public static class Count extends AggregateFun { + public static class Count extends AggregateFun { public Count (SQLExpression argument) { this(argument, false); }