You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Steven Caswell <st...@mungoknotwise.com> on 2003/11/02 15:34:07 UTC

RE: [dbutils] better name for QueryRunner?

That makes sense, and I don't have a strong feeling either way. Just thought
it would be worth mentioning. Do we have a consensus that QueryRunner is a
reasonable name?


Steven Caswell
Sun Certified Java Programmer
steve@mungoknotwise.com
a.k.a Mungo Knotwise of Michel Delving
"One ring to rule them all, one ring to find them..."


> -----Original Message-----
> From: David Graham [mailto:grahamdavid1980@yahoo.com] 
> Sent: Thursday, October 30, 2003 9:07 AM
> To: Jakarta Commons Developers List
> Subject: RE: [dbutils] better name for QueryRunner?
> 
> 
> 
> --- Steven Caswell <st...@mungoknotwise.com> 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" <Yo...@mpi.com>:
> > 
> > > 
> > > 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:matth@phreaker.net]
> > > >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: 
> commons-dev-unsubscribe@jakarta.apache.org
> > > >For additional commands, e-mail: 
> commons-dev-help@jakarta.apache.org
> > > 
> > > 
> > > 
> > > 
> > > 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: commons-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> commons-dev-help@jakarta.apache.org
> > > 
> > > 
> > 
> > 
> > Steven Caswell
> > (Hobbit name Mungo Knotwise of Michel Delving) 
> steve@mungoknotwise.com
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Exclusive Video Premiere - Britney Spears 
> http://launch.yahoo.com/promos/britneyspears/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org