[#691] Add support for Oracle CURSOR REF IN / INOUT parameters - This works already. Only integration tests needed
This commit is contained in:
parent
ae892047c5
commit
98de6b1fc9
@ -41,6 +41,8 @@ import static junit.framework.Assert.assertNull;
|
||||
import static org.jooq.impl.Factory.one;
|
||||
import static org.jooq.impl.Factory.substring;
|
||||
import static org.jooq.impl.Factory.trueCondition;
|
||||
import static org.jooq.test.oracle.generatedclasses.Routines.f691cursorIn;
|
||||
import static org.jooq.test.oracle.generatedclasses.Routines.f691cursorOut;
|
||||
import static org.jooq.test.oracle.generatedclasses.Tables.T_639_NUMBERS_TABLE;
|
||||
import static org.jooq.test.oracle.generatedclasses.Tables.T_658_REF;
|
||||
import static org.jooq.test.oracle.generatedclasses.Tables.T_725_LOB_TEST;
|
||||
@ -798,6 +800,11 @@ public class jOOQOracleTest extends jOOQAbstractTest<
|
||||
assertEquals("Orwell", author1.getLastName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCursorINOUT() throws Exception {
|
||||
assertEquals(4, (int) create().select(f691cursorIn(f691cursorOut())).fetchOne(0, Integer.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTypedSequences() throws Exception {
|
||||
assertEquals(Byte.valueOf("1"), ora().nextval(Sequences.S_961_BYTE));
|
||||
|
||||
@ -59,6 +59,8 @@ DROP FUNCTION f378/
|
||||
DROP PROCEDURE p_get_two_cursors/
|
||||
DROP PROCEDURE p_get_one_cursor/
|
||||
DROP FUNCTION f_get_one_cursor/
|
||||
DROP FUNCTION f691cursor_out/
|
||||
DROP FUNCTION f691cursor_in/
|
||||
DROP PACKAGE library/
|
||||
|
||||
DROP TYPE t_address_type/
|
||||
@ -862,6 +864,35 @@ BEGIN
|
||||
END f_get_one_cursor;
|
||||
/
|
||||
|
||||
CREATE OR REPLACE FUNCTION f691cursor_out
|
||||
RETURN library_types.t_cursor_type
|
||||
IS
|
||||
books library_types.t_cursor_type;
|
||||
BEGIN
|
||||
OPEN books FOR SELECT * FROM t_book;
|
||||
RETURN books;
|
||||
END f691cursor_out;
|
||||
/
|
||||
|
||||
CREATE OR REPLACE FUNCTION f691cursor_in (c IN library_types.t_cursor_type)
|
||||
RETURN NUMBER
|
||||
IS
|
||||
book t_book%rowtype;
|
||||
result number := 0;
|
||||
BEGIN
|
||||
LOOP
|
||||
FETCH c INTO book;
|
||||
EXIT WHEN c%notfound;
|
||||
|
||||
result := result + 1;
|
||||
END LOOP;
|
||||
|
||||
CLOSE c;
|
||||
|
||||
RETURN result;
|
||||
END f691cursor_in;
|
||||
/
|
||||
|
||||
CREATE OR REPLACE FUNCTION f_author_exists (author_name VARCHAR2)
|
||||
RETURN NUMBER
|
||||
IS
|
||||
|
||||
@ -347,6 +347,66 @@ public final class Routines {
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke F691CURSOR_IN
|
||||
*
|
||||
* @param c
|
||||
* @throws org.jooq.exception.DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
public static java.math.BigDecimal f691cursorIn(org.jooq.Configuration configuration, org.jooq.Result<org.jooq.Record> c) {
|
||||
org.jooq.test.oracle.generatedclasses.routines.F691cursorIn f = new org.jooq.test.oracle.generatedclasses.routines.F691cursorIn();
|
||||
f.setC(c);
|
||||
|
||||
f.execute(configuration);
|
||||
return f.getReturnValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get F691CURSOR_IN as a field
|
||||
*
|
||||
* @param c
|
||||
*/
|
||||
public static org.jooq.Field<java.math.BigDecimal> f691cursorIn(org.jooq.Result<org.jooq.Record> c) {
|
||||
org.jooq.test.oracle.generatedclasses.routines.F691cursorIn f = new org.jooq.test.oracle.generatedclasses.routines.F691cursorIn();
|
||||
f.setC(c);
|
||||
|
||||
return f.asField();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get F691CURSOR_IN as a field
|
||||
*
|
||||
* @param c
|
||||
*/
|
||||
public static org.jooq.Field<java.math.BigDecimal> f691cursorIn(org.jooq.Field<org.jooq.Result<org.jooq.Record>> c) {
|
||||
org.jooq.test.oracle.generatedclasses.routines.F691cursorIn f = new org.jooq.test.oracle.generatedclasses.routines.F691cursorIn();
|
||||
f.setC(c);
|
||||
|
||||
return f.asField();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke F691CURSOR_OUT
|
||||
*
|
||||
* @throws org.jooq.exception.DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
public static org.jooq.Result<org.jooq.Record> f691cursorOut(org.jooq.Configuration configuration) {
|
||||
org.jooq.test.oracle.generatedclasses.routines.F691cursorOut f = new org.jooq.test.oracle.generatedclasses.routines.F691cursorOut();
|
||||
|
||||
f.execute(configuration);
|
||||
return f.getReturnValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get F691CURSOR_OUT as a field
|
||||
*
|
||||
*/
|
||||
public static org.jooq.Field<org.jooq.Result<org.jooq.Record>> f691cursorOut() {
|
||||
org.jooq.test.oracle.generatedclasses.routines.F691cursorOut f = new org.jooq.test.oracle.generatedclasses.routines.F691cursorOut();
|
||||
|
||||
return f.asField();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke P_ARRAYS1
|
||||
*
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.oracle.generatedclasses.routines;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.0"},
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class F691cursorIn extends org.jooq.impl.AbstractRoutine<java.math.BigDecimal> {
|
||||
|
||||
private static final long serialVersionUID = -2038350156;
|
||||
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.Parameter<java.math.BigDecimal> RETURN_VALUE = createParameter("RETURN_VALUE", org.jooq.impl.SQLDataType.NUMERIC);
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.Parameter<org.jooq.Result<org.jooq.Record>> C = createParameter("C", org.jooq.impl.SQLDataType.RESULT);
|
||||
|
||||
/**
|
||||
* Create a new routine call instance
|
||||
*/
|
||||
public F691cursorIn() {
|
||||
super(org.jooq.SQLDialect.ORACLE, "F691CURSOR_IN", org.jooq.test.oracle.generatedclasses.Test.TEST, org.jooq.impl.SQLDataType.NUMERIC);
|
||||
|
||||
setReturnParameter(RETURN_VALUE);
|
||||
addInParameter(C);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the <code>C</code> parameter to the routine
|
||||
*/
|
||||
public void setC(org.jooq.Result<org.jooq.Record> value) {
|
||||
setValue(C, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the <code>C</code> parameter to the function
|
||||
* <p>
|
||||
* Use this method only, if the function is called as a {@link org.jooq.Field} in a {@link org.jooq.Select} statement!
|
||||
*/
|
||||
public void setC(org.jooq.Field<org.jooq.Result<org.jooq.Record>> field) {
|
||||
setField(C, field);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.oracle.generatedclasses.routines;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.0"},
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class F691cursorOut extends org.jooq.impl.AbstractRoutine<org.jooq.Result<org.jooq.Record>> {
|
||||
|
||||
private static final long serialVersionUID = -2054639187;
|
||||
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.Parameter<org.jooq.Result<org.jooq.Record>> RETURN_VALUE = createParameter("RETURN_VALUE", org.jooq.impl.SQLDataType.RESULT);
|
||||
|
||||
/**
|
||||
* Create a new routine call instance
|
||||
*/
|
||||
public F691cursorOut() {
|
||||
super(org.jooq.SQLDialect.ORACLE, "F691CURSOR_OUT", org.jooq.test.oracle.generatedclasses.Test.TEST, org.jooq.impl.SQLDataType.RESULT);
|
||||
|
||||
setReturnParameter(RETURN_VALUE);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user