USE [SRO_VT_SHARD]GO
/****** Object: StoredProcedure [dbo].[_AddTimedJobForPet] Script Date: 02/24/2013 12:26:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-- Edited by Mixizi Ethereal Online
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ALTER PROCEDURE [dbo].[_AddTimedJobForPet]
@CharID int,
@Category tinyint,
@JobID int,
@TimeToKeep int,
@Data1 int,
@Data2 int,
@Data3 int,
@Data4 int,
@Data5 int,
@Data6 int,
@Data7 int,
@Data8 int,
@Serial64 bigint
as
if (not exists (select ID from _CharCOS with (nolock) where ID = @CharID))
return -1
declare @NewJobID int
set @NewJobID = 0
DECLARE @rentEndTime DATETIME
DECLARE @newtime INT
SELECT @rentEndTime = RentEndTime FROM _CharCOS WHERE ID = @CharID
SET @newtime = DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE())
-- 3 days
SET @timeToKeep = @newtime + 3 * 24 * 3600
-- 24 days
SET @timeToKeep = @newtime + 24 * 24 * 3600
INSERT INTO _TimedJobForPet VALUES @CharID, @category, @jobID, @timeToKeep, @data1, @data2, @data3, @data4, @data5, @data6, @data7, @data8, @serial64, 0)
SET @NewJobID = @@identity
if (@@error <> 0 or @@rowcount = 0)
return -2
return @NewJobID
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
--@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@