Re: [jira] Updated: (CAY-1282) Use #result as optional directive for only few columns (not all)

From: Evgeny Ryabitskiy (evgeny.ryabitski..mail.com)
Date: Sun Oct 11 2009 - 17:38:21 EDT

  • Next message: Aristedes Maniatis: "Re: svn commit: r824078 - /cayenne/main/trunk/pom.xml"

    If we talking about re-factor... I really wish to rewrite there
    everything to use some Collection.. like ArrayList... or maybe even
    HashSet.
    In that case I can use just really fast hashed contains() method
    instead going through all array of columns.
    So.. collections is more safe, is much more flexible in code. And in
    some cases even faster. I think usage of simple arrays is deprecated
    since Java 1.5
    But it's huge patch.. to change every ColumnDescriptor[] on some
    Collection<ColumnDescriptor>. So.. what do you think?

    > 3. The patch merges 2 strategies for creation of columns descriptor into
    > one, that requires access to ResultSetMetadata. I am not sure that
    > ResultSet.getMetaData() is a trivial operation for all JDBC drivers that we
    > support. I suspect there may be overhead accessing this data at least on
    > some DBs. While we can verify this theory.

    Yeah.. we should verify it, but I think ResultSetMetadata is formed
    when result is returned.. anyway.. It's just a getter... do you think
    ResultSetMetadata is "lazy" initialized? No sure.... I'm going to look
    at JTDS (one that we are using) drivers tomorrow.

    And.. one more idea.. any time when we don't use #result detective...
    we use ResultSetMetadata to get columns names and labels...
    So... doesn't seems that it's a big problem for JDBC drivers...
    It can be really cool if we perform some load testing and compare both
    strategies performance.

    > I am wondering if we should, as
    > in most cases we control the query syntax and don't need to consult
    > ResultSetMetadata at all.
    >
    > So maybe preserve the flow in RowDescriptorBuilder, and use your strategy
    > merging explicit and implicit column descriptors *only* when an optional
    > metadata object is initialized?

    The problem that if we don't set ResultSetMetadata like in current
    (trunk) version, without ResultSetMetadata we don't know all
    columns.. only columns that was explicitly set. That is why I need to
    have result set every time... and without it you can get old
    behavior... not presented column values in result... That is why I
    think Builder should get ResultSet every time.

    Evgeny Ryabitskiy.



    This archive was generated by hypermail 2.0.0 : Sun Oct 11 2009 - 17:40:13 EDT