数据库mysql和oracel在应用中的分页实现
来源:互联网 发布:淘宝店名的重要性 编辑:程序博客网 时间:2024/05/21 15:38
oracle:
if (CommonMethod.isTextEqual(pageTurn, Constants.TURN_PAGE_YES)) { //如果传参为要分页 sqlBuffer.append("select * from (select dddddd.*,count(*) as row_num from (").append(sql).append(") dddddd <=,").append((Integer.parseInt(currPage)) * pageCount).append(
") kkkkkk where kkkkkk.row_num >= ");
sqlBuffer.append((Integer.parseInt(currPage) - 1) * pageCount + 1);
} else {
sqlBuffer.append(sql);
}
") kkkkkk where kkkkkk.row_num >= ");
sqlBuffer.append((Integer.parseInt(currPage) - 1) * pageCount + 1);
} else {
sqlBuffer.append(sql);
}
logger.info(sql);
ps = con.prepareStatement(sqlBuffer.toString());
rs = ps.executeQuery();
return CommonMethod.processResultMedaData(rs);}
finally{
close(rs,ps,con);
}
ps = con.prepareStatement(sqlBuffer.toString());
rs = ps.executeQuery();
return CommonMethod.processResultMedaData(rs);}
finally{
close(rs,ps,con);
}
select * from (
select d.*,count(*) as row _num from (
select u_user.*,u_user_org.org_no from u_user left join u_user_org on u_user.user_id = u_user_org.user_id where 1=1
) d where row_num <= currPage*pageCount )
where row_num >= (currPage-1)*pageCount+1;
!!!!上面的大于和小于等于符号不能变,应该先《=再》=这样的数据量小一些
mysql:
try{
con = dataSource.getConnection();StringBuffer sqlBuffer = new StringBuffer("");
int startIndex = (Integer.parseInt(currPage) - 1) * pageCount;
if (CommonMethod.isTextEqual(pageTurn, Constants.TURN_PAGE_YES)) {
sqlBuffer.append("select * from (select dddddd.* from (").append(sql).append(") dddddd limit ").append(startIndex).append(",").append(pageCount).append(
") kkkkkk ");
} else {
sqlBuffer.append(sql);
}
logger.info(sql);
ps = con.prepareStatement(sqlBuffer.toString());
rs = ps.executeQuery();
return CommonMethod.processResultMedaData(rs);}
finally{
close(rs,ps,con);
}
select * from (
select d.*,count(*) as row _num from (
select u_user.*,u_user_org.org_no from u_user left join u_user_org on u_user.user_id = u_user_org.user_id where 1=1
)d limit (currPage-1)*pageCount , pageCount) ;
0 0
- 数据库mysql和oracel在应用中的分页实现
- Mysql和Oracle数据库中的分页查询
- <foreach>在mysql 数据库中的应用
- Mysql与Oracel的分页查询
- oracel 备份和基本应用
- MySQL数据库查询分页实现
- koa2实现mysql数据库分页
- [笔记]Oracle、MySQL和DB2数据库分页查询的实现
- 对Jbpm数据库应用的简单分析和在Mysql上实现的demo
- 数据库分页,Oracle 和 mysql
- Oracle和mysql在实现分页上不同
- Transfer在MySQL数据库双主同步架构中的应用
- 埋在MYSQL数据库应用中的17个关键问题!
- 用mysql数据库中的用户名和密码在GUI上实现登陆的功能
- oracel数据库
- mysql 实现行号和分页
- Oracle,SQLServer,MySQL数据库中的分页
- JSP中的分页技术源码(MYSQL数据库)
- 反转单链表
- POJ 1111 Image Perimeters
- Stm32定时器中断使LED灯闪烁
- 增加product项目
- 链表知识点(十二)【逆序打印单链表】
- 数据库mysql和oracel在应用中的分页实现
- Android如何监听系统输入法弹出显示事件
- 对协方差矩阵的理解
- SQL 去除重复值进行统计问题
- hdoj 2066 一个人的旅行 【dijstra】
- openfire上——开发环境搭建
- Express 3.0新手指南入门教程
- java.io-接口学习
- Maximum Subarray-最大连续子数组和