Hi Shyam,

2014-01-28 Sha <[email protected]>

> sorry for confusion Lukas,
> Whole purpose of my POC is , convert all stored procedures ( which are
> generated by a tool as flat files on the disk) to equalent java classes.
> So that it would be easy to unit test and find out any discripencies while
> compile time. i.e. respective objects are there or not , any syntax errors
> there etc.
>

OK, I understand. That is indeed a very interesting use-case for jOOQ,
which I believe not many people have thought of, so far. Unfortunately,
sql2jooq is not production-ready yet to help you automatically convert SQL
statements to jOOQ statements. We're currently working on that:
https://github.com/sqlparser/sql2jooq


> Lukas,
>   Me trying to achieve the temporary table impact using ResultSet records
> as you suggested earlier.
> But I  have a small problem in one area.
>
> Below are the details
>
> The original proc is some thing like this
> --------------------------------------------------------
>  CREATE TABLE #LEAF_TEMP
>     (
>         LEAF1_ID    numeric(15, 0)    NULL,
>         LEAF2_ID    numeric(15, 0)    NULL,
>         LEAF3_ID    numeric(15, 0)    NULL,
>         BOOK_ID       numeric(7, 0)     NOT NULL,
>         already_exists numeric(1,0)      default 0 not null
>     )
>
>
>     insert into #LEAF_TEMP
>     (
> LEAF1_ID,
> LEAF2_ID,
> LEAF3_ID,
> BOOK_ID)
>     select
>     ld.leaf1_id,
>     ld.leaf2_id,,
>     ld.leaf3_id,
>     ld.book_id
>     from leaf_detail ld
>     where ld.is_first = 1
> --------------------------
> Now trying to write the equalent JOOQ code
> something like the below
>  LeafDetail  ld = LEAF_DETAIL.as("ld");
> Result<Record4<Integer, Integer, Integer, Short>> RS_LEAF_TEMP =
> ctx.select(ld.LEAF1_ID,ld.LEAF2_ID,ld.LEAF3_ID,ld.BOOK_ID)
>
>  .from(ld).where(ld.is_first.equal((byte) 1)).fetch();
>
> ---
> But the problem is how to incorporate the missing field (already_exists
> numeric(1,0)      default 0 not null ) in the Result<R>
> i,e. adding one more field to Record4 of Result.
>

I'm not sure if I understand this question. You should just add another
column to the SELECT clause and change the Record4 type to a Record5 type.
Or, alternatively, you do not use row type safety, and just assign the
whole statement to Result<?> - which is the same as Result<? extends Record>

Does this answer your question?

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to