Re: Returning Raw ResultSets

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Dec 22 2004 - 09:31:46 EST

  • Next message: Gritsenko Dmitry: "flattened relations intermediate table records not deleted with cascade"

    Hi Emmanuel,

    You forgot to cc: this to the list, so I am doing this here. Answering
    your questions:

    > 1// Has anybody (apart from me) ever requested this feature (that
    > cayenne provides a method of returning raw resultsets)?

    I am not aware of such requests. But it doesn't mean this is not a valid
    request.

    > 2// If I wanted to hack to current code to provide this, could anyone
    > give me a pointer as to where to start from (be it that you have been
    > using this for longer)?

    Actually it should be pretty easy. Default implementation of
    ResultIterator is DefaultResultIterator that has ResultSet as an ivar. So
    adding DefaultResultIterator.getResultSet() (and maybe "setResultSet()"
    too) should do the trick. You'll have to do some casting on the receiving
    end though.

    http://objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/access/DefaultResultIterator.html

    One thing to watch for is disposing of the resources.
    DefaultResultIterator may hold up to 3 JDBC objects internally and is
    responsible for closing them (Connection, Statement and ResultSet). You'll
    have to clean them up (see the source of DefaultResultIterator.close()).

    > 3// Does this even sound like a good feature to try to implement at all?

    It depends... I have no objections to having accessor methods added to
    DefaultResultIterator, and will commit such patch if submitted. If you
    have other ideas, please post them on cayenne-devel, we'll discuss them.

    Thanks
    Andrus

    > Andrus:
    >
    > Manay thanks for your reply; I've been able to massage the code to work
    > with the maps returned by ResultIterator. Many thanks.
    >
    > All:
    >
    > As I am dealing with different environments (not just java), and some of
    > the existing APIs I use are expecting ResultSets; I'm still looking for
    > ways to return raw resultsets--without having to use the jdbc api, as
    > that's what I am already running from :).
    >
    > 1// Has anybody (apart from me) ever requested this feature (that
    > cayenne provides a method of returning raw resultsets)?
    > 2// If I wanted to hack to current code to provide this, could anyone
    > give me a pointer as to where to start from (be it that you have been
    > using this for longer)?
    > 3// Does this even sound like a good feature to try to implement at all?
    >
    > Many Thanks.
    >
    > Emmanuel
    >
    >
    >
    > Andrus Adamchik wrote:
    >> Hi Emmanuel,
    >>
    >> To iterate over result data (instead of reading it all at once)
    >> Cayenne provides something called ResultIterator:
    >>
    >> http://objectstyle.org/cayenne/userguide/perform/result-iterator.html
    >>
    >> Default implementation of ResultIterator encapsulates a ResultSet, but
    >> provides no public access to it. If you still think you need a
    >> ResultSet, I guess you'll have to use JDBC API, but there is a good
    >> chance you can do what you need with Cayenne.
    >>
    >> Andrus
    >>
    >>
    >>>Hello:
    >>>
    >>>This might sound silly, but is there a way to return raw resultsets
    >>> using cayenne?
    >>>
    >>>Thanks,
    >>>Emmanuel
    >>>
    >>>--
    >>>
    >>>Emmanuel Okyere
    >>>CTO - Akuaba, LLC
    >>>http://akuaba.net/
    >>>http://okyere.org/
    >>>http://blogs.okyere.org/resolve
    >>>MSN: compubandit
    >>>AIM: compubndit
    >>>
    >>>Ecrasez l'infame! - Voltaire
    >>
    >>
    >>
    >>
    >>
    >>
    >
    > --
    >
    > Emmanuel Okyere II
    > CTO - Akuaba, LLC
    > http://akuaba.net/
    > http://okyere.org/
    > http://blogs.okyere.org/resolve
    > MSN: compubandit
    > AIM: compubndit
    >
    > Ecrasez l'infame! - Voltaire



    This archive was generated by hypermail 2.0.0 : Wed Dec 22 2004 - 09:31:48 EST