XRowLocate::findColumn API definition ambiguities

Andrzej Hunt andrzej at ahunt.org
Tue Sep 10 13:56:50 PDT 2013


Hi everyone,

The definition of XRowLocate::findColumn, and its implementations, all
seem to be slightly confused.

XRowLocate doesn't specify what should happen what happens if findColumn
is called for an invalid column name. Currently some drivers return -1,
some drivers return the number of columns + 1 (they loop over all the
columns and don't check for this case). A number of implementations
actually have comments to the effect that they should return -1 or throw
an Exception.

In the case of JDBC drivers: the JDBC specification states that an
SQLException should be thrown in this case. This is therefore probably
what happens with any JDBC driver since findColumn is just passed
directly to JDBC (this also includes the HSQLDB driver which runs via
JDBC).

This means that any user of findColumn has to expect either an exception
or various invalid numerical values. (IMHO the Exception is most correct
and is what I've done for now with the Firebird driver.)

Is it OK if I rewrite the specification of findColumn to mirror that of
the JDBC specification, perhaps with a note that some drivers may still
return invalid values instead? (Of course I'd also upgrade all the
drivers to reflect the new specification -- so this note would only
apply to any external drivers -- are there any?)

Cheers,

	Andrzej



More information about the LibreOffice mailing list