ADBA feedback
Douglas Surber
douglas.surber at oracle.com
Fri Apr 27 14:31:07 UTC 2018
Row.get is identifier based. An implementation may choose to interpret the identifier as a 1-based integer, AoJ does for example, but there is nothing in the spec one way or another.
LOB position is a better argument. SQL clearly is 1-based so LOB position definitely needs to be 1-based. That suggests that because ROW_NUMBER is 1-based Row.rowNumber should also be 1 based. I don’t like it but I find this argument convincing. I’ll make the change.
The other place indexes appear is MultiOperation (previously called DynamicMultiOperation). The index is the number of results that precedes the result being processed, which is zero based. This is easy to describe in the JavaDoc. Making it 1-based requires a bit more verbiage but is doable. I’ll make this change also.
I don’t think there are any other indexes in ADBA.
Douglas
> On Apr 27, 2018, at 7:13 AM, Mark Rotteveel <mark at lawinegevaar.nl> wrote:
>
> On 27-4-2018 16:10, Douglas Surber wrote:
>> Where is ADBA 1-based? I don’t think there are any other places where it uses indexes at all.
>
> I'm going by the example Lukas posted mentioning that "Row.get() is still 1-based".
>
> In any case, I think closer alignment to SQL and existing JDBC practices might be more important, so my choice would be to go for 1-based.
>
> Mark
>
>>> On Apr 27, 2018, at 3:02 AM, Mark Rotteveel <mark at lawinegevaar.nl> wrote:
>>>
>>> On 26-4-2018 22:44, Douglas Surber wrote:
>>>>> 6) Why is Row.rowNumber() zero based? That's very confusing. E.g. Row.get()
>>>>> is still 1-based, and all SQL databases that support either ROWNUM or
>>>>> ROW_NUMBER() OVER () functions will produce 1-based row numbers
>>>> Because everything else in Java is zero based. If the consensus is to change this, that’s fine with me.
>>>
>>> Given JDBC is 1-based, the SQL standard is 1-based, and other parts of ADBA are also 1-based, I think following the principle of least surprise and use 1-based here as well would be a better choice.
>>>
>>> The only part where this runs afoul is things like `Result.getIdentifiers` returning a (0-based) array. Maybe add an explicit warning about it being 0-based there.
>>>
>>> The alternative would be to make the whole of ADBA 0-based, but that is likely more confusing for people used to JDBC and SQL 1-based behavior.
>>>
>>> Mark
>>> --
>>> Mark Rotteveel
>
>
> --
> Mark Rotteveel
More information about the jdbc-spec-discuss
mailing list