From 504ca269088d54fbbd924ad6d58f9d7b8eb3a4ae Mon Sep 17 00:00:00 2001
From: Lukas Eder If you use the generated convenience methods, however, things are much simpler, still:
- It might not be very clear, what defines a procedure and what
- defines a
- function in those RDBMS that support these objects. Most
- often, a function
- has a mandatory return value, whereas procedures can
- return OUT parameters.
- Oracle allows for mixing those concepts.
- Postgres omits the term procedure, etc.
+ jOOQ does not formally distinguish procedures from functions.
+ jOOQ only knows about routines, which can have return values
+ and/or OUT parameters. This is the best option to handle the
+ variety of stored procedure / function support across the
+ various supported RDBMS. For more details, read on about this
+ topic, here:
- For jOOQ, the following applies:
-
// The function has a generic type parameter <T> bound to its return value
-public class FAuthorExists extends StoredFunctionImpl<BigDecimal> {
+public class FAuthorExists extends org.jooq.impl.AbstractRoutine<BigDecimal> {
// Much like Tables, functions have static parameter definitions
public static final Parameter<String> AUTHOR_NAME = // [...]
@@ -1841,7 +1841,7 @@ public class FAuthorExists extends StoredFunctionImpl<BigDecimal> {
public void setAuthorName(Field<String> value) { // [...]
}
-public class PAuthorExists extends StoredProcedureImpl {
+public class PAuthorExists extends org.jooq.impl.AbstractRoutine<java.lang.Void> {
// In procedures, IN, OUT, IN OUT parameters are all represented
// as static parameter definitions as well
@@ -1855,7 +1855,7 @@ public class PAuthorExists extends StoredProcedureImpl {
public BigDecimal getResult() { // [...]
}
-public class PAuthorExists_2 extends StoredProcedureImpl {
+public class PAuthorExists_2 extends org.jooq.impl.AbstractRoutine<java.lang.Void> {
public static final Parameter<String> AUTHOR_NAME = // [...]
public static final Parameter<BigDecimal> RESULT = // [...]
public static final Parameter<BigDecimal> ID = // [...]
@@ -1878,8 +1878,8 @@ assertEquals(BigDecimal.ONE, p.getResult());
-// Every schema has a single Functions class with convenience methods
-public final class Functions {
+// Every schema has a single Routines class with convenience methods
+public final class Routines {
// Convenience method to directly call the stored function
public static BigDecimal fAuthorExists(Configuration configuration, String authorName) { // [...]
@@ -1888,10 +1888,6 @@ public final class Functions {
// Field<BigDecimal>, such that it can be used in SQL
public static Field<BigDecimal> fAuthorExists(Field<String> authorName) { // [...]
public static Field<BigDecimal> fAuthorExists(String authorName) { // [...]
-}
-
-// Every schema has a single Procedures class with convenience methods
-public final class Procedures {
// Procedures with 0 OUT parameters create void methods
// Procedures with 1 OUT parameter create methods as such:
@@ -1909,39 +1905,18 @@ assertEquals(BigDecimal.ONE, Procedures.pAuthorExists(configuration, "Paulo"));<
jOOQ's understanding of procedures vs functions
-
+lukaseder.wordpress.com/2011/10/17/what-are-procedures-and-functions-after-all/
+
@@ -3226,12 +3201,21 @@ Field<Integer> position(Field<String> search); Field:
+// Every-day functions Field<Integer> count(); Field<Integer> countDistinct(); Field<T> max(); Field<T> min(); Field<BigDecimal> sum(); -Field<BigDecimal> avg();+Field<BigDecimal> avg(); + +// Statistical functions +Field<BigDecimal> median(); +Field<BigDecimal< stddevPop(); +Field<BigDecimal< stddevSamp(); +Field<BigDecimal< varPop(); +Field<BigDecimal< varSamp(); +
A typical example of how to use an aggregate operator is when generating the next key on insertion of an ID. When you want to diff --git a/jOOQ-website/manual/DSL/FUNCTIONS/index.php b/jOOQ-website/manual/DSL/FUNCTIONS/index.php index a17eb7a8cc..410bb147b2 100644 --- a/jOOQ-website/manual/DSL/FUNCTIONS/index.php +++ b/jOOQ-website/manual/DSL/FUNCTIONS/index.php @@ -68,12 +68,21 @@ Field<Integer> position(Field<String> search); Field:
+// Every-day functions Field<Integer> count(); Field<Integer> countDistinct(); Field<T> max(); Field<T> min(); Field<BigDecimal> sum(); -Field<BigDecimal> avg();+Field<BigDecimal> avg(); + +// Statistical functions +Field<BigDecimal> median(); +Field<BigDecimal< stddevPop(); +Field<BigDecimal< stddevSamp(); +Field<BigDecimal< varPop(); +Field<BigDecimal< varSamp(); +
A typical example of how to use an aggregate operator is when generating the next key on insertion of an ID. When you want to diff --git a/jOOQ-website/manual/META/PROCEDURE/index.php b/jOOQ-website/manual/META/PROCEDURE/index.php index d9bef008b8..15dcf7565f 100644 --- a/jOOQ-website/manual/META/PROCEDURE/index.php +++ b/jOOQ-website/manual/META/PROCEDURE/index.php @@ -64,7 +64,7 @@ CREATE OR REPLACE PROCEDURE p_author_exists_2 (author_name VARCHAR2, result OUT
// The function has a generic type parameter <T> bound to its return value
-public class FAuthorExists extends StoredFunctionImpl<BigDecimal> {
+public class FAuthorExists extends org.jooq.impl.AbstractRoutine<BigDecimal> {
// Much like Tables, functions have static parameter definitions
public static final Parameter<String> AUTHOR_NAME = // [...]
@@ -74,7 +74,7 @@ public class FAuthorExists extends StoredFunctionImpl<BigDecimal> {
public void setAuthorName(Field<String> value) { // [...]
}
-public class PAuthorExists extends StoredProcedureImpl {
+public class PAuthorExists extends org.jooq.impl.AbstractRoutine<java.lang.Void> {
// In procedures, IN, OUT, IN OUT parameters are all represented
// as static parameter definitions as well
@@ -88,7 +88,7 @@ public class PAuthorExists extends StoredProcedureImpl {
public BigDecimal getResult() { // [...]
}
-public class PAuthorExists_2 extends StoredProcedureImpl {
+public class PAuthorExists_2 extends org.jooq.impl.AbstractRoutine<java.lang.Void> {
public static final Parameter<String> AUTHOR_NAME = // [...]
public static final Parameter<BigDecimal> RESULT = // [...]
public static final Parameter<BigDecimal> ID = // [...]
@@ -111,8 +111,8 @@ assertEquals(BigDecimal.ONE, p.getResult());
If you use the generated convenience methods, however, things are much simpler, still:
-// Every schema has a single Functions class with convenience methods
-public final class Functions {
+// Every schema has a single Routines class with convenience methods
+public final class Routines {
// Convenience method to directly call the stored function
public static BigDecimal fAuthorExists(Configuration configuration, String authorName) { // [...]
@@ -121,10 +121,6 @@ public final class Functions {
// Field<BigDecimal>, such that it can be used in SQL
public static Field<BigDecimal> fAuthorExists(Field<String> authorName) { // [...]
public static Field<BigDecimal> fAuthorExists(String authorName) { // [...]
-}
-
-// Every schema has a single Procedures class with convenience methods
-public final class Procedures {
// Procedures with 0 OUT parameters create void methods
// Procedures with 1 OUT parameter create methods as such:
@@ -142,39 +138,18 @@ assertEquals(BigDecimal.ONE, Procedures.pAuthorExists(configuration, "Paulo"));<
jOOQ's understanding of procedures vs functions
- It might not be very clear, what defines a procedure and what
- defines a
- function in those RDBMS that support these objects. Most
- often, a function
- has a mandatory return value, whereas procedures can
- return OUT parameters.
- Oracle allows for mixing those concepts.
- Postgres omits the term procedure, etc.
+ jOOQ does not formally distinguish procedures from functions.
+ jOOQ only knows about routines, which can have return values
+ and/or OUT parameters. This is the best option to handle the
+ variety of stored procedure / function support across the
+ various supported RDBMS. For more details, read on about this
+ topic, here:
- For jOOQ, the following applies:
-
-
diff --git a/jOOQ-website/src/main/resources/manual.xml b/jOOQ-website/src/main/resources/manual.xml
index c982402996..8fbb0c027e 100644
--- a/jOOQ-website/src/main/resources/manual.xml
+++ b/jOOQ-website/src/main/resources/manual.xml
@@ -1650,7 +1650,7 @@ CREATE OR REPLACE PROCEDURE p_author_exists_2 (author_name VARCHAR2, result OUT
If you use the generated convenience methods, however, things are much simpler, still:
- It might not be very clear, what defines a procedure and what - defines a - function in those RDBMS that support these objects. Most - often, a function - has a mandatory return value, whereas procedures can - return OUT parameters. - Oracle allows for mixing those concepts. - Postgres omits the term procedure, etc. + jOOQ does not formally distinguish procedures from functions. + jOOQ only knows about routines, which can have return values + and/or OUT parameters. This is the best option to handle the + variety of stored procedure / function support across the + various supported RDBMS. For more details, read on about this + topic, here:
- For jOOQ, the following applies: + lukaseder.wordpress.com/2011/10/17/what-are-procedures-and-functions-after-all/
-@@ -3023,12 +3000,21 @@ Field<Integer> position(Field<String> search);
A typical example of how to use an aggregate operator is when generating the next key on insertion of an ID. When you want to