![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_InkData_Delete
ALTER Proc [dbo].[cs_InkData_Delete]
(
@InkID int,
@SectionID int,
@SettingsID int
)
![](/Images/OutliningIndicators/None.gif)
as
![](/Images/OutliningIndicators/None.gif)
Delete FROM cs_InkData Where SettingsID = @SettingsID and SectionID = @SectionID and InkID = @InkID
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*删除记录*/
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_InkData_Add
ALTER Proc [dbo].[cs_InkData_Add]
(
@SectionID int,
@SettingsID int,
@UserID int,
@ApplicationType smallint,
@Ink NTEXT,
@DateUpdated datetime,
@InkID int output
)
as
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*就是添加新记录到表中,然后设置输出参数为@@Identity,*/
Insert cs_InkData (UserID, SettingsID, SectionID, Ink, DateUpdated, ApplicationType)
Values (@UserID, @SettingsID, @SectionID, @Ink, @DateUpdated, @ApplicationType)
![](/Images/OutliningIndicators/None.gif)
Select @InkID = @@Identity
![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_Image_CreateUpdateDelete
ALTER procedure [dbo].cs_Image_CreateUpdateDelete
(
@UserID int,
@Content image,
@ContentType nvarchar(64),
@ContentSize int,
@Action int,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
![](/Images/OutliningIndicators/None.gif)
BEGIN
DECLARE @ImageID int
![](/Images/OutliningIndicators/None.gif)
-- Create
-- 创建
IF @Action = 0 OR @Action = 1 -- 如果活动类型为0或1
BEGIN
-- Remove if already exists from tables: cs_Images, cs_UserAvatar
-- 查询图片ID,并从两张表中删除图片信息
SET @ImageID = (SELECT ImageID FROM cs_UserAvatar WHERE UserID = @UserID and SettingsID = @SettingsID)
DELETE cs_Images WHERE ImageID = @ImageID and SettingsID = @SettingsID
DELETE cs_UserAvatar WHERE UserID = @UserID and SettingsID = @SettingsID
![](/Images/OutliningIndicators/None.gif)
-- Add new entry
-- 添加一个新记录
INSERT INTO cs_Images VALUES (@ContentSize, @ContentType, @Content, GetDate(), @SettingsID)
SET @ImageID = @@Identity
INSERT INTO cs_UserAvatar VALUES (@UserID, @ImageID, @SettingsID)
END
ELSE IF @Action = 2 -- 如果活动类型为2
BEGIN
-- Remove if already exists from tables: cs_Images, cs_UserAvatar
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*如果存在于表中,则从表中删除他们.不过前面那个好象也没提到更新,
但是名字却是有更新这个词*/
SET @ImageID = (SELECT ImageID FROM cs_UserAvatar WHERE UserID = @UserID and SettingsID = @SettingsID)
DELETE cs_UserAvatar WHERE UserID = @UserID and SettingsID = @SettingsID
DELETE cs_Images WHERE ImageID = @ImageID and SettingsID = @SettingsID
END
END
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
posted on
2006-09-20 16:08
MainIsUsed
阅读(
194)
评论()
编辑
收藏
举报