SQLTuple version: 1.2.0.0

hep.aida.ref.sql
Class StmtSrc

java.lang.Object
  extended by hep.aida.ref.sql.StmtSrc

public class StmtSrc
extends Object

StmtStr prepares SQL commands for SQLTuple and SQLTupleFactory in a form of simple Strings. It tries to get SmtSrc.properties Resource from Accessor.

 $Log: StmtSrc.java,v $
 Revision 1.48  2008/07/25 13:25:03  hrivnac
 oracle schema for tags supported improved

 Revision 1.47  2007/05/23 16:38:44  hrivnac
 logical connections for Plotter; better UML

 Revision 1.46  2006/12/15 00:16:13  hrivnac
 FORWARD_ONLY allows to plot big ntuples

 Revision 1.45  2006/11/20 16:56:08  hrivnac
 fixing input params for Plotter command line

 Revision 1.44  2005/09/28 18:22:42  hrivnac
 javadoc fixed

 Revision 1.43  2005/09/28 16:21:06  hrivnac
 code cleaning

 Revision 1.42  2005/03/09 15:25:52  hrivnac
 ITuple.rows() improved

 Revision 1.41  2005/03/08 17:05:51  hrivnac
 ...

 Revision 1.40  2005/02/10 20:07:52  hrivnac
 bug fixes to support new ColMan

 Revision 1.39  2005/01/25 16:45:03  hrivnac
 Adding rows uses PreparedStatement

 Revision 1.38  2004/12/08 18:04:26  hrivnac
 uf

 Revision 1.37  2004/12/08 17:10:37  hrivnac
 more flexible SQL mapping

 Revision 1.36  2004/12/01 16:07:15  hrivnac
 better support for ColMan JAS3 plugin

 Revision 1.35  2004/11/16 22:41:37  hrivnac
 bux fixes in handling linktables

 Revision 1.34  2004/10/22 15:33:00  hrivnac
 cleaned

 Revision 1.33  2004/10/12 19:26:59  hrivnac
 MySQL Connector 3.0.14

 Revision 1.32  2004/07/06 14:24:50  hrivnac
 support for Oracle

 Revision 1.31  2004/06/18 09:17:31  hrivnac
 StmtSrc can be accessed directkly

 Revision 1.30  2004/05/22 15:12:59  hrivnac
 class id reformated

 Revision 1.29  2004/05/18 15:34:28  hrivnac
 compatible with Java 1.5.0-beta2

 Revision 1.28  2004/04/22 08:11:27  hrivnac
 StmtSrc updated

 Revision 1.27  2004/04/21 08:27:05  hrivnac
 some explicit MySQL dependencies removed

 Revision 1.26  2004/04/21 08:24:51  hrivnac
 some explicit MySQL dependencies removed

 Revision 1.25  2004/04/16 15:32:57  hrivnac
 Type.properties to setup Type.class

 Revision 1.24  2004/04/14 13:54:42  hrivnac
 potential bugs fixed

 Revision 1.23  2004/04/14 13:39:47  hrivnac
 1.5 warnings fixed

 Revision 1.22  2004/04/13 15:45:54  hrivnac
 AIDA URL introduced

 Revision 1.21  2004/02/12 16:39:40  hrivnac
 niceing

 Revision 1.20  2004/02/10 14:50:58  hrivnac
 JavaDoc tags completed

 Revision 1.19  2004/02/04 13:30:39  hrivnac
 - improvement of Enums internal mapping
 - general cleaning

 Revision 1.18  2004/01/30 18:10:30  hrivnac
 - StmtSrc.properties specified a Property
 - customised FreeHEP AIDA services included in jar file

 Revision 1.17  2004/01/29 16:39:09  hrivnac
 better support for Pol

 Revision 1.16  2004/01/27 14:09:56  hrivnac
 StmtSrc.properties loading fixed

 Revision 1.15  2003/11/26 16:09:46  hrivnac
 Functional EventSelector WebService

 Revision 1.14  2003/11/24 17:42:26  hrivnac
 Better handling of Pool Collections.

 Revision 1.13  2003/11/20 17:36:08  hrivnac
 JavaDoc links fixed

 Revision 1.12  2003/11/20 17:21:58  hrivnac
 Java 1.5 natively supported, Log4J reporting improved.

 Revision 1.11  2003/11/13 15:43:09  hrivnac
 BenchMarking introduced.

 Revision 1.10  2003/11/13 11:07:31  hrivnac
 EventSelector prototype added.

 Revision 1.9  2003/11/12 14:13:48  hrivnac
 Access to Pool Collections is provided.

 Revision 1.8  2003/11/05 19:46:22  hrivnac
 - FreeHEP 1.2.1
 - JAIDA 3.2.1

 

Version:
$Id: StmtSrc.java,v 1.48 2008/07/25 13:25:03 hrivnac Exp $
Author:
J.Hrivnac

Field Summary
private  Accessor _accessor
           
private  String _name
           
private static String _place
           
private  Properties _properties
           
private static Logger log
          Logging .
 
Constructor Summary
StmtSrc(Accessor accessor, String name)
          Prepare all commands.
 
Method Summary
private  String[] parseStmtString(String statementString, String[] args)
          Parse statementString.
 PreparedStatement prepare(String statementString, String[] args)
          Prepare update statement defined by the statementString.
private  String prepareStatementString(String stmtString)
          Create Statement String.
 ResultSet query(String statementString, String[] args)
          Perform query operation defined by the statementString.
 int update(String statementString, String[] args)
          Perform update operation defined by the statementString.
 int updatePrepared(PreparedStatement statement)
          Perform update operation defined by the PreparedStatement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_properties

private Properties _properties

_accessor

private Accessor _accessor

_name

private String _name

_place

private static String _place

log

private static Logger log
Logging .

Constructor Detail

StmtSrc

public StmtSrc(Accessor accessor,
               String name)
        throws SQLTupleException
Prepare all commands.

Parameters:
accessor - The Accessor to be associated with this StmtSrc.
name - The name of the NTuple/table (to be used in SQL commands).
Throws:
SQLTupleException - if the StmtSrc can't be created.
Method Detail

prepareStatementString

private String prepareStatementString(String stmtString)
Create Statement String. Replace NAME with table name.

Parameters:
stmtString - The Stmt String with formal NAME.
Returns:
The Stmt String with actual NAME.

update

public int update(String statementString,
                  String[] args)
           throws SQLTupleException
Perform update operation defined by the statementString. Use args as parameters. Multiple SQL comands are allowed.

Parameters:
statementString - The name of Stmt String (hep.aida.ref.sql.StmtStr.<statementString>[.<implemetation>]).
args - The arguments to be used in place of #* variables.
Returns:
The number of added rows (of the last SQL command in case of multiple commands).
Throws:
SQLTupleException - if the SQL command can't be created or performed.

updatePrepared

public int updatePrepared(PreparedStatement statement)
                   throws SQLTupleException
Perform update operation defined by the PreparedStatement.

Parameters:
statement - The PreparedStatement.
Returns:
The number of added rows.
Throws:
SQLTupleException - if the SQL command can't be created or performed.

prepare

public PreparedStatement prepare(String statementString,
                                 String[] args)
                          throws SQLTupleException
Prepare update statement defined by the statementString. Use args as parameters. Multiple SQL comands are allowed, but only the last one is delivered as PreparedStatement.

Parameters:
statementString - The name of Stmt String (hep.aida.ref.sql.StmtStr.<statementString>[.<implemetation>]).
args - The arguments to be used in place of #* variables.
Throws:
SQLTupleException - if the SQL command can't be created or performed.

query

public ResultSet query(String statementString,
                       String[] args)
                throws SQLTupleException
Perform query operation defined by the statementString. Uses args as parameters. Multiple SQL actions aren't allowed.

Parameters:
statementString - The name of Stmt String (hep.aida.ref.sql.StmtStr.<statementString>[.<implemetation>]).
args - The arguments to be used in place of #* variables.
Throws:
SQLupleException - if the SQL command can't be created or performed.
SQLTupleException

parseStmtString

private String[] parseStmtString(String statementString,
                                 String[] args)
                          throws SQLTupleException
Parse statementString. Uses args as parameters.

Parameters:
statementString - The name of Stmt String (hep.aida.ref.sql.StmtStr.<statementString>[.<implemetation>]).
args - The arguments to be used in place of #* variables.
Returns:
The array of statements with replaced arguments.
Throws:
SQLupleException - if the Stmt String can't be parsed.
SQLTupleException

Written by: J.Hrivnac

Documentation built November 9 2010 on Linux by hrivnac