I'm trying to use execution of dynamic SQL feature and providing my
own metadata parameter adapter for oracle jdbc driver..
After some code diggng several questions arised:
1. Should statement ID (Symbol type) be unique? Or it must be?
2. If it should be unique across all statements, it might be a problem
for dynamic SQLs.
3. MetadataAdapter.procedureMetadata, which i need to override for
realizing custom MetadataAdapter, recieves id: Symbol, cs:
CallableStatement. CallableStatement i can't use for getting parameter
metadata because of oracle jdbc driver restriction.
And when using
Symbol with dynamic SQL, i fall into question 2.
4. procedureMetadata should return some data based on index of
parameter. It's good if i can use CallableStatement, but if i need to
provide custom parameter description it's better to operate on param
names (because it's orbroker's task to map names to param indexes)
5. Maybe better solution is to pass param info with statement's Token
object (when user constructs Token)?
> Stored procedure calls cannot be dynamic, if that's what you are trying to
> do.
Arrrgh.!) Yes, that's possible. Can i overcome it in some way? maybe
via providing custom Registrant?
> You first need to figure out if you can even do what you're trying to do in
> plain JDBC. I cannot work around incomplete JDBC implementations. If you can
> do it in JDBC, then let me know and I can work from that.
I understand)
> I can provide a mapping of parameter name to index or vice versa. Let me
> know your desired implementation of MetadataAdapter.
>
>>
>> 5. Maybe better solution is to pass param info with statement's Token
>> object (when user constructs Token)?
>
> That may be an option. What should "param info" look like?
I propose to add paramInfo to Token object (which should consist of
paramName, SQL type and paramMode - IN or OUT), and modify
DefaultMetadataAdapter for using this info if it's presented for some
of parameters
2011/1/24 Nils Kilden-Pedersen <nil...@gmail.com>:
> The Symbol id should be unique per statement. It is what distinguishes theHmm.. ok. So what should i pass when using on-fly created SQLs?
> statements.
> Stored procedure calls cannot be dynamic, if that's what you are trying toArrrgh.!) Yes, that's possible. Can i overcome it in some way? maybe
> do.
via providing custom Registrant?
I propose to add paramInfo to Token object (which should consist ofparamName, SQL type and paramMode - IN or OUT), and modify
DefaultMetadataAdapter for using this info if it's presented for some
of parameters
> Hmm, I will think about it, but I don't see how that's different in any
> substantive way compared to what you can already do with MetadataAdapter.
> Your own metadata adapter could just take a map of id->paramInfo, no?
It's just more convenient and not depended on statement ID.
Also some inconvenience appears due to unclear transformations between
names and indexes.
So let you decide - just give a way to calculate indexes by name and
vice versa, or include param info in Token object.
Thank you,
Nicholas