/*
* $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/lib/TKDBResultInfo.java,v 1.6 2001/11/09 12:27:12 markus Exp $
*
*/
package com.teamkonzept.lib;
import java.sql.*;
/**
* Die Namen der Tabellen aus dem DB-Result werden in einem Array
* abgelegt und die Typen
* @author
* @version
*/
public class TKDBResultInfo {
public String colNames[] = null;
public int colTypes[] = null;
public int colCount = 0;
/**
* Konstruktor
*
* @param ResultSet rs, Ausfuehrung eines Querys (SQL) =>
* ein ResultSet-Object wurde kreiert und wird uebergeben
*/
public TKDBResultInfo( ResultSet rs ) {
//super(); implzit!!
extractResultSetInfos( rs );
}
/**
* Dies wird benoetigt fuer die column headings(JDBCD)
* Die Namen der Tabellen aus dem DB-Result werden in einem Array
* abgelegt und die Typen
*
* @param ResultSet rs, Ausfuehrung eines Querys (SQL) =>
* ein ResultSet-Object wurde kreiert und wird uebergeben (JDBCD)
*/
public void extractResultSetInfos( ResultSet rs ) {
try {
ResultSetMetaData rsmd = rs.getMetaData();
colCount = rsmd.getColumnCount();
if( colCount <= 0 ) return;
colNames = new String[ colCount ];
colTypes = new int[ colCount ];
for( int i=1; i<=colCount; i++ ){
colNames[i-1] = rsmd.getColumnLabel(i).toUpperCase();
colTypes[i-1] = rsmd.getColumnType(i);
}
}
catch (SQLException ex) {
TKDBLogger.logSQLException( ex );
}
}
}
|