/**************************************************************************** * File : SQLExample.java * Author : Meier Patrick * Date : 6.4.2005 * Last change : $Date: 2006/06/28 20:33:30 $ / $Author: mepux $ * Version : $Revision: 1.4 $ * * Copyright (C) 2005 by Meier Patrick * **************************************************************************** * This file is part of the jpTools library * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * **************************************************************************** * $Id: SQLExample.java,v 1.4 2006/06/28 20:33:30 mepux Exp $ **************************************************************************** */ import java.sql.ResultSet; import java.sql.SQLException; import jptools.database.AbstractSelectSQLProcessor; import jptools.util.TableContent; import jptools.logger.LogInformation; import jptools.logger.Logger; /** *

The sql-processor class SQLExample.

* * Input-parameter(s): *
    *
  1. JPTOOLSLOGTABLE.TIMESTAMP (java.lang.Long)
  2. *
  3. JPTOOLSLOGTABLE.TIMESTAMP (java.lang.Long)
  4. *
* *

The output contains in the first element of the object array * a jptools.util.TableContent object which * contains the following output parameter(s): *

* * * * * * * * * * * *
Name of the table and fieldName of the constantType of the instance
JPTOOLSLOGTABLE.TIMESTAMPJPTOOLSLOGTABLE_TIMESTAMPjava.lang.Long
JPTOOLSLOGTABLE.LOG_LEVELJPTOOLSLOGTABLE_LOG_LEVELjava.lang.Long
JPTOOLSLOGTABLE.THREAD_NAMEJPTOOLSLOGTABLE_THREAD_NAMEjava.lang.String
JPTOOLSLOGTABLE.CONTEXT_NAMEJPTOOLSLOGTABLE_CONTEXT_NAMEjava.lang.String
JPTOOLSLOGTABLE.METHOD_NAMEJPTOOLSLOGTABLE_METHOD_NAMEjava.lang.String
JPTOOLSLOGTABLE.LINE_NUMBERJPTOOLSLOGTABLE_LINE_NUMBERjava.lang.Long
JPTOOLSLOGTABLE.VERSIONJPTOOLSLOGTABLE_VERSIONjava.lang.String
JPTOOLSLOGTABLE.HIERARCHY_LEVELJPTOOLSLOGTABLE_HIERARCHY_LEVELjava.lang.Long
JPTOOLSLOGTABLE.LOG_INFORMATIONJPTOOLSLOGTABLE_LOG_INFORMATIONjava.lang.String
JPTOOLSLOGTABLE.FORMATED_MESSAGEJPTOOLSLOGTABLE_FORMATED_MESSAGEjava.lang.String
*


* *

Example: *

 * jptools.database.DatabaseManager manager;
 * // initialize database manager...
 * 
 * Object[] param = new Object[ 2 ];
 * // fillup param...
 * 
 * Object[] result = manager.executeQuery( new SQLExample(), param );
 * TableContent t = (TableContent)result[ 0 ];
 * Long data = (Long)t.get( 0, SQLExample.JPTOOLSLOGTABLE_TIMESTAMP );
 * 
* *

* This file is generated by the jptools generator framework version 0.99.7.
* Homepage: jptools.sourceforge.net
*
* * @author Meier Patrick * @version $Revision: 1.4 $ */ public class SQLExample extends AbstractSelectSQLProcessor { /** Access key for the TableContent to get the data for 'JPTOOLSLOGTABLE.LOG_INFORMATION' */ public static final String JPTOOLSLOGTABLE_LOG_INFORMATION = "JPTOOLSLOGTABLE.LOG_INFORMATION"; /** Access key for the TableContent to get the data for 'JPTOOLSLOGTABLE.THREAD_NAME' */ public static final String JPTOOLSLOGTABLE_THREAD_NAME = "JPTOOLSLOGTABLE.THREAD_NAME"; /** Access key for the TableContent to get the data for 'JPTOOLSLOGTABLE.FORMATED_MESSAGE' */ public static final String JPTOOLSLOGTABLE_FORMATED_MESSAGE = "JPTOOLSLOGTABLE.FORMATED_MESSAGE"; /** Access key for the TableContent to get the data for 'JPTOOLSLOGTABLE.METHOD_NAME' */ public static final String JPTOOLSLOGTABLE_METHOD_NAME = "JPTOOLSLOGTABLE.METHOD_NAME"; /** Access key for the TableContent to get the data for 'JPTOOLSLOGTABLE.HIERARCHY_LEVEL' */ public static final String JPTOOLSLOGTABLE_HIERARCHY_LEVEL = "JPTOOLSLOGTABLE.HIERARCHY_LEVEL"; /** Access key for the TableContent to get the data for 'JPTOOLSLOGTABLE.VERSION' */ public static final String JPTOOLSLOGTABLE_VERSION = "JPTOOLSLOGTABLE.VERSION"; /** Access key for the TableContent to get the data for 'JPTOOLSLOGTABLE.LOG_LEVEL' */ public static final String JPTOOLSLOGTABLE_LOG_LEVEL = "JPTOOLSLOGTABLE.LOG_LEVEL"; /** Access key for the TableContent to get the data for 'JPTOOLSLOGTABLE.TIMESTAMP' */ public static final String JPTOOLSLOGTABLE_TIMESTAMP = "JPTOOLSLOGTABLE.TIMESTAMP"; /** Access key for the TableContent to get the data for 'JPTOOLSLOGTABLE.CONTEXT_NAME' */ public static final String JPTOOLSLOGTABLE_CONTEXT_NAME = "JPTOOLSLOGTABLE.CONTEXT_NAME"; /** Access key for the TableContent to get the data for 'JPTOOLSLOGTABLE.LINE_NUMBER' */ public static final String JPTOOLSLOGTABLE_LINE_NUMBER = "JPTOOLSLOGTABLE.LINE_NUMBER"; /** The version number of the class. */ public static final String VERSION = "$Revision: 1.4 $"; /** Initialisation of the logger. */ private static final Logger log = Logger.getLogger( SQLExample.class ); /** The sql query. */ private static final String SQL_STATAMENT = "" + "SELECT " + " TIMESTAMP, " + " LOG_LEVEL, " + " THREAD_NAME, " + " CONTEXT_NAME, " + " METHOD_NAME, " + " LINE_NUMBER, " + " VERSION, " + " HIERARCHY_LEVEL, " + " LOG_INFORMATION, " + " FORMATED_MESSAGE " + "FROM " + " jptoolsLogTable " + "WHERE " + " TIMESTAMP BETWEEN ? AND " + " ? "; /** * Constructor for SQLExample. */ public SQLExample() { super(); setSQLStatement( SQL_STATAMENT ); } /** * Constructor for SQLExample. * * @param logInfo The additional log information. */ public SQLExample( LogInformation logInfo ) { super( logInfo ); setSQLStatement( SQL_STATAMENT ); } /** * @see jptools.database.AbstractSelectSQLProcessor#process(java.sql.ResultSet) */ protected Object[] process( ResultSet rs ) throws SQLException { Object[] result = new Object[ 1 ]; TableContent results = null; if( rs != null ) { results = new TableContent(); while( rs.next() ) { if( !results.isEmpty() ) results.newRow(); // get TIMESTAMP results.add( JPTOOLSLOGTABLE_TIMESTAMP, new java.lang.Long( rs.getLong( 1 ) ) ); // get LOG_LEVEL results.add( JPTOOLSLOGTABLE_LOG_LEVEL, new java.lang.Long( rs.getLong( 2 ) ) ); // get THREAD_NAME results.add( JPTOOLSLOGTABLE_THREAD_NAME, rs.getString( 3 ) ); // get CONTEXT_NAME results.add( JPTOOLSLOGTABLE_CONTEXT_NAME, rs.getString( 4 ) ); // get METHOD_NAME results.add( JPTOOLSLOGTABLE_METHOD_NAME, rs.getString( 5 ) ); // get LINE_NUMBER results.add( JPTOOLSLOGTABLE_LINE_NUMBER, new java.lang.Long( rs.getLong( 6 ) ) ); // get VERSION results.add( JPTOOLSLOGTABLE_VERSION, rs.getString( 7 ) ); // get HIERARCHY_LEVEL results.add( JPTOOLSLOGTABLE_HIERARCHY_LEVEL, new java.lang.Long( rs.getLong( 8 ) ) ); // get LOG_INFORMATION results.add( JPTOOLSLOGTABLE_LOG_INFORMATION, rs.getString( 9 ) ); // get FORMATED_MESSAGE results.add( JPTOOLSLOGTABLE_FORMATED_MESSAGE, rs.getString( 10 ) ); } } result[ 0 ] = results; return result; } /** * @see jptools.database.AbstractStatementProcessor#getLogger() */ protected Logger getLogger() { return log; } } /****************************************************************************/ /* EOF */ /****************************************************************************/