Skip to content

Commit

Permalink
[#11] Demo code should link to relevant sections of the manual - Demo…
Browse files Browse the repository at this point in the history
…12StoredProcedures
  • Loading branch information
lukaseder committed Jan 11, 2024
1 parent e56e10d commit 78e134d
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public class Demo12StoredProcedures extends AbstractDemo {

@Test
public void procedures() {
// Calling stored procedures and functions ("routines") is very easy with jOOQ and its code generator. Every
// routine has a corresponding generated stub in Java, which you can call with a Configuration, and jOOQ will
// take care of binding all the IN/OUT parameters.

title("Standalone procedure calls require a configuration argument");
println("Inventory 1 in stock: " + Routines.inventoryInStock(configuration, 1L));

Expand All @@ -35,6 +39,19 @@ public void procedures() {
.orderBy(FILM.FILM_ID, STORE.STORE_ID)
.limit(10)
.fetch();

// More information here:
// - https://www.jooq.org/doc/latest/manual/code-generation/codegen-procedures/
// - https://www.jooq.org/doc/latest/manual/sql-execution/stored-procedures/
//
// And also various use-cases described in these blog posts:
// - https://blog.jooq.org/the-best-way-to-call-stored-procedures-from-java-with-jooq/
// - https://blog.jooq.org/calling-procedures-with-default-parameters-using-jdbc-or-jooq/
// - https://blog.jooq.org/postgresqls-table-valued-functions/
// - https://blog.jooq.org/access-pl-sql-procedures-from-java-with-jooq-a-jpublisher-alternative/
// - https://blog.jooq.org/use-jooq-to-read-write-oracle-plsql-record-types/
// - https://blog.jooq.org/using-oracle-aq-in-java-wont-get-any-easier-than-this/
// - https://blog.jooq.org/how-to-pass-a-table-valued-parameter-to-a-t-sql-function-with-jooq/
}

@Test
Expand All @@ -55,6 +72,9 @@ public void proceduralLanguage() {
//
// ctx.selectFrom(ACTOR).where(ACTOR.ACTOR_ID.gt(200L)).fetch();
//

// More information here:
// - https://www.jooq.org/doc/latest/manual/sql-building/procedural-statements/
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class Demo12StoredProcedures : AbstractDemo() {

@Test
fun procedures() {
// Calling stored procedures and functions ("routines") is very easy with jOOQ and its code generator. Every
// routine has a corresponding generated stub in Java, which you can call with a Configuration, and jOOQ will
// take care of binding all the IN/OUT parameters.

title("Standalone procedure calls require a configuration argument")
println("Inventory 1 in stock: " + inventoryInStock(configuration, 1L))

Expand Down Expand Up @@ -44,6 +48,19 @@ class Demo12StoredProcedures : AbstractDemo() {
.orderBy(STORE.STORE_ID)
.limit(10)
.fetch()

// More information here:
// - https://www.jooq.org/doc/latest/manual/code-generation/codegen-procedures/
// - https://www.jooq.org/doc/latest/manual/sql-execution/stored-procedures/
//
// And also various use-cases described in these blog posts:
// - https://blog.jooq.org/the-best-way-to-call-stored-procedures-from-java-with-jooq/
// - https://blog.jooq.org/calling-procedures-with-default-parameters-using-jdbc-or-jooq/
// - https://blog.jooq.org/postgresqls-table-valued-functions/
// - https://blog.jooq.org/access-pl-sql-procedures-from-java-with-jooq-a-jpublisher-alternative/
// - https://blog.jooq.org/use-jooq-to-read-write-oracle-plsql-record-types/
// - https://blog.jooq.org/using-oracle-aq-in-java-wont-get-any-easier-than-this/
// - https://blog.jooq.org/how-to-pass-a-table-valued-parameter-to-a-t-sql-function-with-jooq/
}


Expand All @@ -67,6 +84,9 @@ class Demo12StoredProcedures : AbstractDemo() {
// .where(ACTOR.ACTOR_ID.gt(200L))
// .fetch()
//

// More information here:
// - https://www.jooq.org/doc/latest/manual/sql-building/procedural-statements/
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class Demo12StoredProcedures extends AbstractDemo {

@Test
def procedures(): Unit = {
// Calling stored procedures and functions ("routines") is very easy with jOOQ and its code generator. Every
// routine has a corresponding generated stub in Java, which you can call with a Configuration, and jOOQ will
// take care of binding all the IN/OUT parameters.

title("Standalone procedure calls require a configuration argument")
println("Inventory 1 in stock: " + Routines.inventoryInStock(configuration, 1L))

Expand All @@ -37,11 +41,25 @@ class Demo12StoredProcedures extends AbstractDemo {
.orderBy(FILM.FILM_ID, STORE.STORE_ID)
.limit(10)
.fetch

// More information here:
// - https://www.jooq.org/doc/latest/manual/code-generation/codegen-procedures/
// - https://www.jooq.org/doc/latest/manual/sql-execution/stored-procedures/
//
// And also various use-cases described in these blog posts:
// - https://blog.jooq.org/the-best-way-to-call-stored-procedures-from-java-with-jooq/
// - https://blog.jooq.org/calling-procedures-with-default-parameters-using-jdbc-or-jooq/
// - https://blog.jooq.org/postgresqls-table-valued-functions/
// - https://blog.jooq.org/access-pl-sql-procedures-from-java-with-jooq-a-jpublisher-alternative/
// - https://blog.jooq.org/use-jooq-to-read-write-oracle-plsql-record-types/
// - https://blog.jooq.org/using-oracle-aq-in-java-wont-get-any-easier-than-this/
// - https://blog.jooq.org/how-to-pass-a-table-valued-parameter-to-a-t-sql-function-with-jooq/
}

@Test
def proceduralLanguage(): Unit = {
title("The procedural language API allows for creating procedures or anonymous blocks")

// This is a commercial only feature. Check out the commercial demo for details

// val i = `var`("i", BIGINT)
Expand All @@ -53,6 +71,9 @@ class Demo12StoredProcedures extends AbstractDemo {
// .execute
// ctx.selectFrom(ACTOR).where(ACTOR.ACTOR_ID.gt(200L)).fetch
//

// More information here:
// - https://www.jooq.org/doc/latest/manual/sql-building/procedural-statements/
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public class Demo12StoredProcedures extends AbstractDemo {

@Test
public void procedures() {
// Calling stored procedures and functions ("routines") is very easy with jOOQ and its code generator. Every
// routine has a corresponding generated stub in Java, which you can call with a Configuration, and jOOQ will
// take care of binding all the IN/OUT parameters.

title("Standalone procedure calls require a configuration argument");
println("Inventory 1 in stock: " + Routines.inventoryInStock(configuration, 1L));

Expand All @@ -35,6 +39,19 @@ public void procedures() {
.orderBy(FILM.FILM_ID, STORE.STORE_ID)
.limit(10)
.fetch();

// More information here:
// - https://www.jooq.org/doc/latest/manual/code-generation/codegen-procedures/
// - https://www.jooq.org/doc/latest/manual/sql-execution/stored-procedures/
//
// And also various use-cases described in these blog posts:
// - https://blog.jooq.org/the-best-way-to-call-stored-procedures-from-java-with-jooq/
// - https://blog.jooq.org/calling-procedures-with-default-parameters-using-jdbc-or-jooq/
// - https://blog.jooq.org/postgresqls-table-valued-functions/
// - https://blog.jooq.org/access-pl-sql-procedures-from-java-with-jooq-a-jpublisher-alternative/
// - https://blog.jooq.org/use-jooq-to-read-write-oracle-plsql-record-types/
// - https://blog.jooq.org/using-oracle-aq-in-java-wont-get-any-easier-than-this/
// - https://blog.jooq.org/how-to-pass-a-table-valued-parameter-to-a-t-sql-function-with-jooq/
}

@Test
Expand All @@ -55,6 +72,9 @@ public void proceduralLanguage() {

ctx.selectFrom(ACTOR).where(ACTOR.ACTOR_ID.gt(200L)).fetch();
/* [/pro] */

// More information here:
// - https://www.jooq.org/doc/latest/manual/sql-building/procedural-statements/
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class Demo12StoredProcedures : AbstractDemo() {

@Test
fun procedures() {
// Calling stored procedures and functions ("routines") is very easy with jOOQ and its code generator. Every
// routine has a corresponding generated stub in Java, which you can call with a Configuration, and jOOQ will
// take care of binding all the IN/OUT parameters.

title("Standalone procedure calls require a configuration argument")
println("Inventory 1 in stock: " + inventoryInStock(configuration, 1L))

Expand Down Expand Up @@ -44,6 +48,19 @@ class Demo12StoredProcedures : AbstractDemo() {
.orderBy(STORE.STORE_ID)
.limit(10)
.fetch()

// More information here:
// - https://www.jooq.org/doc/latest/manual/code-generation/codegen-procedures/
// - https://www.jooq.org/doc/latest/manual/sql-execution/stored-procedures/
//
// And also various use-cases described in these blog posts:
// - https://blog.jooq.org/the-best-way-to-call-stored-procedures-from-java-with-jooq/
// - https://blog.jooq.org/calling-procedures-with-default-parameters-using-jdbc-or-jooq/
// - https://blog.jooq.org/postgresqls-table-valued-functions/
// - https://blog.jooq.org/access-pl-sql-procedures-from-java-with-jooq-a-jpublisher-alternative/
// - https://blog.jooq.org/use-jooq-to-read-write-oracle-plsql-record-types/
// - https://blog.jooq.org/using-oracle-aq-in-java-wont-get-any-easier-than-this/
// - https://blog.jooq.org/how-to-pass-a-table-valued-parameter-to-a-t-sql-function-with-jooq/
}


Expand All @@ -67,6 +84,9 @@ class Demo12StoredProcedures : AbstractDemo() {
.where(ACTOR.ACTOR_ID.gt(200L))
.fetch()
/* [/pro] */

// More information here:
// - https://www.jooq.org/doc/latest/manual/sql-building/procedural-statements/
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class Demo12StoredProcedures extends AbstractDemo {

@Test
def procedures(): Unit = {
// Calling stored procedures and functions ("routines") is very easy with jOOQ and its code generator. Every
// routine has a corresponding generated stub in Java, which you can call with a Configuration, and jOOQ will
// take care of binding all the IN/OUT parameters.

title("Standalone procedure calls require a configuration argument")
println("Inventory 1 in stock: " + Routines.inventoryInStock(configuration, 1L))

Expand All @@ -37,11 +41,25 @@ class Demo12StoredProcedures extends AbstractDemo {
.orderBy(FILM.FILM_ID, STORE.STORE_ID)
.limit(10)
.fetch

// More information here:
// - https://www.jooq.org/doc/latest/manual/code-generation/codegen-procedures/
// - https://www.jooq.org/doc/latest/manual/sql-execution/stored-procedures/
//
// And also various use-cases described in these blog posts:
// - https://blog.jooq.org/the-best-way-to-call-stored-procedures-from-java-with-jooq/
// - https://blog.jooq.org/calling-procedures-with-default-parameters-using-jdbc-or-jooq/
// - https://blog.jooq.org/postgresqls-table-valued-functions/
// - https://blog.jooq.org/access-pl-sql-procedures-from-java-with-jooq-a-jpublisher-alternative/
// - https://blog.jooq.org/use-jooq-to-read-write-oracle-plsql-record-types/
// - https://blog.jooq.org/using-oracle-aq-in-java-wont-get-any-easier-than-this/
// - https://blog.jooq.org/how-to-pass-a-table-valued-parameter-to-a-t-sql-function-with-jooq/
}

@Test
def proceduralLanguage(): Unit = {
title("The procedural language API allows for creating procedures or anonymous blocks")

// This is a commercial only feature. Check out the commercial demo for details
/* [pro] */
val i = `var`("i", BIGINT)
Expand All @@ -53,6 +71,9 @@ class Demo12StoredProcedures extends AbstractDemo {
.execute
ctx.selectFrom(ACTOR).where(ACTOR.ACTOR_ID.gt(200L)).fetch
/* [/pro] */

// More information here:
// - https://www.jooq.org/doc/latest/manual/sql-building/procedural-statements/
}

@After
Expand Down

0 comments on commit 78e134d

Please sign in to comment.