/**************************************************************************** * 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
.
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 field | Name of the constant | Type of the instance |
---|---|---|
JPTOOLSLOGTABLE.TIMESTAMP | JPTOOLSLOGTABLE_TIMESTAMP | java.lang.Long |
JPTOOLSLOGTABLE.LOG_LEVEL | JPTOOLSLOGTABLE_LOG_LEVEL | java.lang.Long |
JPTOOLSLOGTABLE.THREAD_NAME | JPTOOLSLOGTABLE_THREAD_NAME | java.lang.String |
JPTOOLSLOGTABLE.CONTEXT_NAME | JPTOOLSLOGTABLE_CONTEXT_NAME | java.lang.String |
JPTOOLSLOGTABLE.METHOD_NAME | JPTOOLSLOGTABLE_METHOD_NAME | java.lang.String |
JPTOOLSLOGTABLE.LINE_NUMBER | JPTOOLSLOGTABLE_LINE_NUMBER | java.lang.Long |
JPTOOLSLOGTABLE.VERSION | JPTOOLSLOGTABLE_VERSION | java.lang.String |
JPTOOLSLOGTABLE.HIERARCHY_LEVEL | JPTOOLSLOGTABLE_HIERARCHY_LEVEL | java.lang.Long |
JPTOOLSLOGTABLE.LOG_INFORMATION | JPTOOLSLOGTABLE_LOG_INFORMATION | java.lang.String |
JPTOOLSLOGTABLE.FORMATED_MESSAGE | JPTOOLSLOGTABLE_FORMATED_MESSAGE | java.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 * |
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 */
/****************************************************************************/