码迷,mamicode.com
首页 > 数据库 > 详细

使用mySQL与数据库进行交互(一)

时间:2016-05-25 20:34:56      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:

public interface DAOInter {
/**一页显示的数据条数*/
public final Integer numForOnePage=5;
/**
* 对数据库进行查询操作
*
* @param sql
* 一个PreparedStatement使用的sql语句
* @param objects
* sql语句中匹配PreparedStatement的条件数组
* @param items
* 要查找的对象在数据库中的列名集合
* @return 填充值后的Map<String,String>类型的List集合
*/
public List<Map<String,String>> selectEntity(String sql, Object[] objects, String[] items);

/**
* 对数据库进行增删改操作
*
* @param sql
* 一个PreparedStatement使用的sql语句
* @param objects
* sql语句中匹配PreparedStatement的条件数组
* @return 受影响的行数,不成功则返回-1
*/
public int changeEntity(String sql, Object[] objects);
}

/**
* 重写将Object类型转换为String类型
*
* @param object
* Object类型数据
* @return String类型数据
*/
public static String stringToObject(Object object) {
String s = "";
if (object != null) {
s = object.toString();
}
return s;
}

使用mySQL与数据库进行交互(一)

标签:

原文地址:http://www.cnblogs.com/quanby/p/5528114.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!