package net.lisoft.service.log;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.lang.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import net.lisoft.db.DbServer;
public class LogList {
public static ResultSet getLoglist1() throws SQLException,
InstantiationException, IllegalAccessException,
ClassNotFoundException {
DbServer dServer = new DbServer();
ResultSet rs = dServer
.Execute("select top 10 * from TB_System_Log where status=0 order by id desc");
return rs;
}
public static List getLoglist2() throws SQLException,
InstantiationException, IllegalAccessException,
ClassNotFoundException {
DbServer dServer = new DbServer();
ResultSet rs = dServer
.Execute("select top 10 * from TB_System_Log where status=0 order by id desc");
return convertList(rs);
}
private static List convertList(ResultSet rs) throws SQLException {
List list = new ArrayList();
ResultSetMetaData md = rs.getMetaData();
int columnCount = md.getColumnCount(); // Map rowData;
while (rs.next()) { // rowData = new HashMap(columnCount);
Map rowData = new HashMap();
for (int i = 1; i <= columnCount; i++) {
rowData.put(md.getColumnName(i), rs.getObject(i));
}
//System.out.println(rowData.toString());
list.add(rowData);
}
return list;
}
}
标签: