public String generateCreate(String table) throws DatabaseException {
  StringBuffer result=new StringBuffer();
  try {
    StringBuffer sql=new StringBuffer();
    sql.append("SELECT * FROM ");
    sql.append(table);
    ResultSet rs=executeQuery(sql.toString());
    ResultSetMetaData md=rs.getMetaData();
    result.append("CREATE TABLE ");
    result.append(table);
    result.append(" ( ");
    for (int i=1; i <= md.getColumnCount(); i++) {
      if (i != 1) {
        result.append(',');
      }
      result.append(md.getColumnName(i));
      result.append(' ');
      String type=processType(md.getColumnTypeName(i),md.getPrecision(i));
      result.append(type);
    }
    result.append(" ) ");
    rs.close();
  }
 catch (  SQLException e) {
    throw (new DatabaseException(e));
  }
  return result.toString();
}

public String generateCreate ( String table ) throws DatabaseException { StringBuffer result = new StringBuffer ( ) ; try { StringBuffer sql = new StringBuffer ( ) ; sql . append ( "SELECT * FROM " ) ; sql . append ( table ) ; ResultSet rs = executeQuery ( sql . toString ( ) ) ; ResultSetMetaData md = rs . getMetaData ( ) ; result . append ( "CREATE TABLE " ) ; result . append ( table ) ; result . append ( " ( " ) ; for ( int i = 1 ; i <= md . getColumnCount ( ) ; i ++ ) { if ( i != 1 ) { result . append ( ',' ) ; } result . append ( md . getColumnName ( i ) ) ; result . append ( ' ' ) ; String type = processType ( md . getColumnTypeName ( i ) , md . getPrecision ( i ) ) ; result . append ( type ) ; } result . append ( " ) " ) ; rs . close ( ) ; } catch ( SQLException e ) { throw ( new DatabaseException ( e ) ) ; } return result . toString ( ) ; }
generate the create statement to create the specified table .
