|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
缺点:安全性不是太差了,还行,只要你充分利用系统自带的工具;唯一缺点就是执行效率慢,如何进行网站优化以后,效果会比较好。/*-----------------------------------
发生论坛分类目次内容表历程
-----------------------------------*/
CREATEPROCEDUREsp_createnew_bbscontent
@tabnamevarchar(200)=,
@boardidint
AS
declare@tri_inst_namenvarchar(100)
declare@tri_up_namenvarchar(100)
declare@tri_del_namenvarchar(100)
declare@deltabnvarchar(100)
declare@stnvarchar(2000)
select@tri_inst_name=inst_bbsContent+LTRIM(RTRIM(str(@Boardid)))
select@tri_up_name=up_bbsContent+LTRIM(RTRIM(str(@Boardid)))
select@tri_del_name=delete_bbsContent+LTRIM(RTRIM(str(@Boardid)))
select@deltab=droptable+@tabname
iflen(@tabname)=0
return
ifexists(select*fromsysobjectswhereid=object_id(@tabname)andOBJECTPROPERTY(id,NIsUserTable)=1)
execsp_executesql@deltab
select@st=CREATETABLE+@tabname+
(
AnnounceIDintidentity(1,1)NOTNULL,
ParentIDintdefault(0)NULL,
Childintdefault(0)NULL,
User_idintNULL,
boardIDintNULL,
Topicnvarchar(255)NULL,
BodyntextNULL,
DateAndTimedatetimedefault(getdate())NULL,
Hitsintdefault(0)NULL,
Lengthintdefault(0)NULL,
RootIDintdefault(0)NULL,
Layertinyintdefault(1)NULL,
Ordersintdefault(0)NULL,
Ipnvarchar(20)default(0)NULL,
Expressionnvarchar(50)NULL,
Forbidtinyintdefault(0)NULL
)
execsp_executesql@st
select@st=CREATETRIGGER+@tri_inst_name+ON+@tabname+
FORINSERT
AS
declare@ridinteger,@pidinteger
select@pid=ParentIdfrominserted
if@pid=0
begin
select@rid=@@identity
update+@tabname+setrootid=@ridwhereAnnounceID=@rid
end
execsp_executesql@st
select@st=CREATETRIGGER+@tri_up_name+ON+@tabname+
FORUPDATE
AS
declare@pidint,@ridint,@forbidtinyint
ifupdate(forbid)
begin
select@pid=parentid,@rid=rootid,@forbid=forbidfrominserted
/*假如其父没有开放则不克不及开放*/
ifexists(select*from+@tabname+whereAnnounceID=@pidandForbid!=0)
begin
rollbacktransaction
return
end
update+@tabname+setforbid=@forbidwhererootid=@ridandparentid>@pid
end
execsp_executesql@st
select@st=CREATETRIGGER+@tri_del_name+ON+@tabname+
FORDELETE
AS
declare@pidint,@ridint
select@pid=parentid,@rid=rootidfromdeleted
deletefrom+@tabname+whererootid=@ridandparentid>@pid
asp对于服务器的要求较高,一般的服务器如果访问量一大就垮了,不得不重启。 |
|