<dvbbs7> ================================
ALTER PROCEDURE dv_list
@boardid int=1,@pagenow int=1, --当前页数 @pagesize int=1, --定义每页面帖子数目@tl int=0, --按时间段查询@topicmode int=0, --专题@totalrec int output
ASset nocount ondeclare @int_topnum intdeclare @int_timenum intdeclare @var_times varchar(5000)
if @pagenow>1 if @topicmode>0 begin select @int_timenum=(@pagenow-1)*@pagesize set rowcount @int_timenum select @var_times=lastposttime from Dv_Topic where boardID=@boardID and istop = 0 and mode=@topicmode ORDER BY lastposttime desc
set rowcount @pagesize select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode from dv_topic where boardID=@boardID and istop = 0 and mode=@topicmode and lastposttime < @var_times ORDER BY lastposttime desc
set nocount off return end else begin select @int_timenum=(@pagenow-1)*@pagesize set rowcount @int_timenum select @var_times=lastposttime from Dv_Topic where boardID=@boardID and istop = 0 ORDER BY lastposttime desc
set rowcount @pagesize select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode from dv_topic where boardID=@boardID and istop = 0 and lastposttime < @var_times ORDER BY lastposttime desc
set nocount off return end
else if @topicmode>0 begin set rowcount @pagesize select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode from Dv_topic where boardID=@boardid and istop = 0 and mode=@topicmode ORDER BY lastposttime desc end else begin set rowcount @pagesize select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode from Dv_topic where boardID=@boardid and istop = 0 ORDER BY lastposttime desc end
================================
ALTER PROCEDURE dv_toplist
@pagenow int ,@pagesize int ,@reture_value int output,@intUserRecordCount int output
as/*定义局部变量*/declare @intBeginID intdeclare @intEndID intdeclare @intPageCount intdeclare @intRowCount int
/*关闭计数*/set nocount on
/*求总用户数*/select @intUserRecordCount = count(*) from [dv_user]if (@intUserRecordCount = 0) --如果没有用户,则返回零set @reture_value =0 /*判断页数是否正确*/if (@pagenow - 1) * @pagesize > @intUserRecordCountset @reture_value =1--return (-1)
/*求开始userID*/set @intRowCount = (@pagenow - 1) * @pagesize + 1/*限制条数*/set rowcount @intRowCountselect @intBeginID = userid from [dv_user] order by userid desc
/*结束userID*/set @intRowCount = @pagenow * @pagesize/*限制条数*/set rowcount @intRowCountselect @intEndID = userid from [dv_user] order by userid desc
/*恢复系统变量*/set rowcount 0set nocount off
select username,useremail,userclass,UserIM,UserPost,JoinDate,userwealth,userid from [dv_user] where userid between @intEndID and @intBeginID order by userid descreturn(@@rowcount)--select @@rowcount
<zbbs>================================================ALTER PROCEDURE zbbs_topic@page_size int,@page_now int,@board int,@rsc int output
ASdeclare @intCount intdeclare @lasttime datetimedeclare @affrow intSET NOCOUNT ON
select @intCount=count(*) from z_topic where board=@board and topicid=0
if not (@page_size*(@page_now)<@intCount)set @page_now=@intCount/@page_size-1
if @intCount=0beginset @page_now=0set @intCount=1endset @affrow= @page_now*@page_size+1set rowcount @affrowselect @lasttime=lasttime from z_topic where board=@board and topicid=0 order by lasttime descset rowcount @page_sizeselect * from z_topic where board=@board and lasttime<=@lasttime and topicid=0 order by lasttime desc set @rsc=@intCount
RETURN
================================================ALTER PROCEDURE zbbs_topic2@page_size int,@page_now int,@board int,@rsc int output
ASdeclare @intBeginID intdeclare @intEndID intdeclare @intRowCount intdeclare @intCount intSET NOCOUNT ON
select @intCount=count(*) from z_topic where board=@board
if not (@page_size*(@page_now)<@intCount)set @page_now=@intCount/@page_size-1
set @intRowCount=@page_now*@page_size+1set rowcount @intRowCountselect @intBeginID = id from z_topic where board=@board order by id desc
set @intRowCount=(@page_now+1)*@page_sizeset rowcount @intRowCountselect @intEndID=id from z_topic where board=@board order by id desc
set rowcount 0set nocount off
select * from z_topic where board=@board and (id between @intEndID and @intBeginID) order by lasttime desc set @rsc=@intCount
RETURN