TKDBResultInfo.java :  » Content-Management-System » webman » com » teamkonzept » lib » Java Open Source

Java Open Source » Content Management System » webman 
webman » com » teamkonzept » lib » TKDBResultInfo.java
/*
 * $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 );
    }
  }
}

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.