indexmanager.java
来自「征服AJAX+LUCENE构建搜索引擎的源码」· Java 代码 · 共 69 行
JAVA
69 行
/*
* 创建日期 2006-3-5
*
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
package cn.edu.bit.business;
import java.util.ArrayList;
import java.sql.*;
import cn.edu.bit.data.DataQuery;
import cn.edu.bit.object.GIndex;
/**
* @author ligang
*
* TODO 要更改此生成的类型注释的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
public class IndexManager {
public ArrayList getManagerList(String param)throws Exception
{
String query = "select top 10 * from QINDEX where Content like '%"+param+"%'";
DataQuery dq = new DataQuery();
Connection con = dq.getConnection();
ArrayList al = new ArrayList();
try{
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
while(rs.next())
{
int id = rs.getInt("ID");
String content = rs.getString("Content");
GIndex gindex = new GIndex(id,content);
al.add(gindex);
}
rs.close();
stmt.close();
con.close();
return al;
}
catch(Exception e)
{
e.printStackTrace();
return null;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?