?? mysqlunit.java
字號:
/* * MySqlUnit.java * * Created on 2001年5月18日, 上午10:49 */package zc.face;import java.io.*;import java.sql.*;/** * * @author Administrator * @version */class MySqlUnit { /** Creates new MySqlUnit */ public static String printMetaData(ResultSet rs) throws SQLException { ResultSetMetaData md=rs.getMetaData(); int colCount=md.getColumnCount(); String colLabel[]=new String[colCount+1]; int colDisplaySize[]=new int[colCount+1]; String colTypeName[]=new String[colCount+1]; System.out.println("database colCount="+colCount); StringBuffer sb=new StringBuffer(); for(int i=1;i<=colCount;i++){ colLabel[i]=md.getColumnLabel(i); colDisplaySize[i]=md.getColumnDisplaySize(i); colTypeName[i]=md.getColumnTypeName(i); sb.append("Label:"+colLabel[i]+"DisplaySize:"+colDisplaySize[i]+"TypeName:"+colTypeName[i]+"\r\n"); } return sb.toString(); } public static String printResultSet(ResultSet rs) throws IOException,SQLException { ResultSetMetaData md=rs.getMetaData(); int colCount=md.getColumnCount(); String colLabel[]=new String[colCount+1]; for(int i=1;i<=colCount;i++) colLabel[i]=md.getColumnLabel(i); StringBuffer sb=new StringBuffer(); while(rs.next()){ for(int i=1;i<=colCount;i++) sb.append(colLabel[i]+":"+rs.getObject(i)+" "); sb.append("\r\n"); } //if(!rs.next( )) // System.out.println("查詢成功"); // else // System.out.println("查詢失敗"); return sb.toString( ); } }
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -