--- Steven Caswell <[EMAIL PROTECTED]> wrote:
> In the SQL world I grew up in, "query" was used loosely to mean any DML.
> I don't
> have a problem with QueryRunner, though I wouldn't oppose
> StatementRunner.
> 
> What if we took a different approach and split up the existing
> QueryRunner based
> on functionality:
> - Rename QueryRunner to StatementRunner, keeping the non-update and
> non-query
> methods
> - Move the query methods to a new QueryRunner class that extends
> StatementRunner
> - Move the update methods to a new UpdateRunner class that extends
> StatementRunner
> 
> This gives good separation of concerns and resolves the question about
> what is a
> "query".

Not if you view executing all SQL statements as one concern.  The
java.sql.Statement interface supports all kinds of SQL, why shouldn't
QueryRunner?  DbUtils should be easy to use; having to create multiple
objects to run certain kinds of queries is not easy.  For example:

QueryRunner run = new QueryRunner(dataSource);
run.query("SELECT...",handler);
run.update("UPDATE...");

is much simpler than having to keep track of multiple objects like this:

StatementRunner run = new StatementRunner(dataSource);
run.query("SELECT...",handler);

UpdateRunner run2 = new UpdateRunner(dataSource);
run2.update("UPDATE...");

The method names are self-explanatory enough that it's easy to see what
kind of SQL is being executed.

David

> 
> Quoting "Shapira, Yoav" <[EMAIL PROTECTED]>:
> 
> > 
> > Howdy,
> > I thought in the SQL world, an update is just a specific type of
> query?
> > In that case QueryRunner is not so bad.  StatementRunner is not bad
> > either.  StatementExecutor might be nice.
> > 
> > Runner or Executor are too general IMHO.  Executor is used by Doug
> Lea's
> > concurrent framework, so in JDK 1.5 there will be a
> > java.util.concurrent.Executor, and I'd like to avoid the small chance
> of
> > name confusion.
> > 
> > Yoav Shapira
> > Millennium ChemInformatics
> > 
> > 
> > >-----Original Message-----
> > >From: __matthewHawthorne [mailto:[EMAIL PROTECTED]
> > >Sent: Wednesday, October 29, 2003 12:44 PM
> > >To: Jakarta Commons Developers List
> > >Subject: [dbutils] better name for QueryRunner?
> > >
> > >Especially since it is such an integral class, could
> > >org.apache.commons.dbutils.QueryRunner use a more accurate name,
> since
> > >it performs both queries and updates?
> > >
> > ><brainstorm>
> > >   Executor
> > >   Runner
> > >   StatementRunner
> > ></brainstorm>
> > >
> > >I can't think of any others.  I have a similar class in my own stash
> > >that I named DatabaseHandler, but that doesn't seem to fit.
> > >
> > >Any other thoughts, suggestions?
> > >
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> > 
> > This e-mail, including any attachments, is a confidential business
> > communication, and may contain information that is confidential,
> proprietary
> > and/or privileged.  This e-mail is intended only for the individual(s)
> to
> > whom it is addressed, and may not be saved, copied, printed, disclosed
> or
> > used by anyone else.  If you are not the(an) intended recipient,
> please
> > immediately delete this e-mail from your computer system and notify
> the
> > sender.  Thank you.
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> Steven Caswell
> (Hobbit name Mungo Knotwise of Michel Delving)
> [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to