[Libreoffice] ODBC handles, a quibble

Terrence Enger tenger at iseries-guru.com
Tue Oct 4 09:27:11 PDT 2011

I am sorry for the length of this answer; hope it is worth

On Tue, 2011-10-04 at 11:27 +0100, Michael Meeks wrote:
> On Fri, 2011-09-30 at 14:13 -0400, Terrence Enger wrote:
> > My interest is in the fractions of seconds in times and
> > timestamps, an interest provoked by bug 34309 "Error on
> > importing a timestamp field from db2 via ODBC"
> > <https://bugs.freedesktop.org/show_bug.cgi?id=34309>.
> 	Nice - thanks for your help & testing there, looks like we're blocking
> on some input from Lionel - I guess if we don't get that in a few days,
> and it seems to work we should just commit your patch :-)

Well, the bug has been around for three years, so it cannot
be very urgent.  Moreover, I have some hesitations ...

(*) Caolán's patch gives smaller code and looks like it
    would require much less work from the machine, and in
    every case I have seen it gives the same result as my
    patch.  All these factors favour Caolán's patch.

(*) Caolán's patch fixes also
    ODatabaseMetaDataResultSet::getTimestamp.  (Hunh?  
    Why does the diff say that the changed line is in
    ODatabaseMetaDataResultSet::getShort?  I still think the
    changed function is getTimestamp.)  My patch does not do
    this, merely because I do not know where to look for a
    resulting difference in the output.  So, my patch is
    deficient in this respect.

    Perhaps it would be in order to "push down" the fix by
    creating either
      - a constructor DateTime(TIME_STRUCT) to encapsulate
        the changed factor in the calculation of hundreths
        of a second, or
      - a constructor DateTime(rtl::OUString) to encapsulate
        the string manipulations.

(*) In the hope of attracting critical feedback (but
    constructive, of course: this is after all LibreOffice
    <grin />), I sprinkled the code liberally with questions
    and comments.  Most conspicuously,
      - I cite the X/Open reference manual.  I have not seen
        any comparable citation in LO code.  Perhaps the
        citation does not belong in the code at all.
      - I express my own doubts about that manual.  This is
        a more personal expression than anything I have
        noticed elsewhere in the code.  Does it belong?
      - Since I have just asked these questions here, there
        is no more need for the TODO comment saying to ask
        these questions <grin />.

(*) I think I remember reading that a database may return a
    time with fractions of a second, but I do not know any
    database driver which actually does this.  Is my memory
    mistaken?  Is there a known database driver which
    delivers fractions of a second?  Neither patch addresses
    this issue.

    Again, the TODO comment can go away.  Perhaps the
    question itself should go away, too.

(*) Both patches discard milliseconds.  I *guess* this is
    the right thing to do, but would welcome others'
    opinions.  Anyway, there is no more need for the TODO
    comment saying to ask this question.

(*) Is this really all it takes to fix the bug?  It seems
    too simple.  Maybe I have spent too many decades working
    on less well organized code.

    A couple of forays into opengrok turned up so much that
    I gave up in despair.

Then there is the question of whether Caolán's
ODBC_FRACTION_UNITS_PER_HSECOND should be calculated the
precision (or, do I mean the "scale") of the column.  I
simply do not want to go there.

> 	It's normally better (FWIW) to post patches to the list with a [PATCH]
> in the Subject - so they annoy more people into action.

My reticence was deliberate.  With all the questions and
difficulties that my patch has, I offer it more as an
earnest of good intentions than as completed work.

> 	Wondering what's next on the hit list, there are rumours of badness
> with the form / reports designer out there apparently ;-)

I heard those rumours too, but I do not think I am competent
to address them.  UI's are complex beasts.

Of course, I shall try to deal with any suggestions arising
from the questions and hesitations I wrote about above.

My immediate task is to complete a build from recent master.
If Calc still exhibits some funny (IMO) cursor movement, I
shall work toward filing a bug report.

After that, perhaps ...

(*) Programmed testing of some part of Base.  The
    second^h^h^h^h^h^hthird step here would be reading about
    the testing infrastructure.  So, it will be a while
    before I can expect to do anything more useful than
    bother busy people with questions <sigh />.

(*) An arbitrarily chosen "TODO" from one of the hundred or
    so thrown up by `git grep` of connectivity and dbaccess.
    This seems a bit less daunting, but that is only because
    I know absolutely nothing about what I am talking about
    <sigh />.

> 	Thanks !
> 		Michael.

Thank you, Michael, for your continual patience with a noob.


More information about the LibreOffice mailing list