From: Dave Cramer <pg@fastcrypt.com>
To: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: proposal for CallableStatements to handle multiple out
Date: Sat, 19 Jun 2004 10:30:03 -0400
Message-ID: <1087655403.15586.206.camel@localhost.localdomain> (raw)
In-Reply-To: <40D39015.8090507@opencloud.com>
References: <1087582419.15586.173.camel@localhost.localdomain>
<40D37653.8010302@opencloud.com>
<1087602030.15607.190.camel@localhost.localdomain>
<40D386F7.3040401@opencloud.com>
<1087605866.15619.193.camel@localhost.localdomain>
<40D39015.8090507@opencloud.com>
No,
What I was planning on doing is encapsulating all the code that parses
the sql, and rewrites it into a small class, StatementSqlParser
implement SqlParser, then changing the contstructor for
AbstractJdbc1Statment to
AbstractJdbc1Statement( Connection, SqlParser )
Then I could create a second class CallableSqlParser which would deal
with the differences in CallableStatements.
Dave
On Fri, 2004-06-18 at 21:00, Oliver Jowett wrote:
> Dave Cramer wrote:
> > I'd like to move all of that stuff into it's own class, as the rest of
> > my patch ends up with alot of if( instanceof CallableStatement) which
> > I'd like to avoid by putting it all in a CallableStatement
> > implementation.
>
> If I understand what you're suggesting, you want to do this:
>
> AbstractJdbc1Statement
> -> Jdbc1Statement extends AbstractJdbc1Statement
> -> AbstractJdbc1CallableStatement extends AbstractJdbc1Statement
> -> Jdbc1CallableStatement extends AbstractJdbc1CallableStatement
> -> AbstractJdbc2Statement extends AbstractJdbc1Statement
>
> The problem is then that you can't reasonably implement
> AbstractJdbc2CallableStatement: it needs to extend both
> AbstractJdbc2Statement (to get the extra JDBC2 Statement methods) and
> AbstractJdbc1CallableStatement (to get the CallableStatement
> functionality) simultaneously, and Java doesn't let you do mixins or
> multiple inheritance..
>
> A strategy-object approach would work, though. I'm not sure if it would
> be much of a win over the current approach though -- you still need all
> the CallableStatement methods in AbstractJdbc1Statement, they just turn
> into hooks that call the strategy object's implementation.
>
> Have you looked at my patch? It localizes most of the conditionalization
> of the CallableStatement case into one place (there is an
> adjustParameterIndex() method that does the index translation; it's an
> identity transform if the statement isn't a CallableStatement).
>
> I'd also prefer an explicit field on the statement to say "this
> statement is callable!" rather than relying on instanceof, it always
> struck me as too fragile to rely on exactly which classes the concrete
> JdbcN classes implement.
>
> -O
>
>
>
> !DSPAM:40d38fcd300218619219928!
>
>
--
Dave Cramer
519 939 0336
ICQ # 14675561
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: pg@fastcrypt.com, oliver@opencloud.com
Subject: Re: proposal for CallableStatements to handle multiple out
In-Reply-To: <1087655403.15586.206.camel@localhost.localdomain>
References: <1087582419.15586.173.camel@localhost.localdomain> <40D37653.8010302@opencloud.com> <1087602030.15607.190.camel@localhost.localdomain> <40D386F7.3040401@opencloud.com> <1087605866.15619.193.camel@localhost.localdomain> <40D39015.8090507@opencloud.com> <1087655403.15586.206.camel@localhost.localdomain>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox