Advertisement
Guest User

[dbo].[CGGA_character_gameinfo_update]

a guest
May 26th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. USE [gc]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[CGGA_character_gameinfo_update] Script Date: 26/05/2015 22:33:08 ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. ALTER PROCEDURE [dbo].[CGGA_character_gameinfo_update]
  9. @iLoginUID_ [int],
  10. @iCharType_ [tinyint],
  11. @iExp_ [bigint],
  12. @iWin_ [int],
  13. @iLose_ [int],
  14. @iOK [int] = 0
  15. AS
  16. set nocount on
  17. set transaction isolation level read uncommitted
  18.  
  19. /*
  20. 20081229. microcat.
  21.  
  22. L"{ call dbo.CGGA_character_gameinfo_update ( %d, %d, %d, %d, %d ) }"
  23.  
  24. { call dbo.CGGA_character_gameinfo_update ( @1, @2, @3, @4, @5 ) }
  25. @1 ; @iLoginUID_ int
  26. @2 ; @iCharType_ tinyint
  27. 0 ; 엘리시스
  28. 1 ; 리르
  29. 2 ; 아르메
  30. 3 ; 라스
  31. 4 ; 라이언
  32. 5 ; 로난
  33. 6 ; 에이미
  34. 7 ; 진
  35. @3 ; @iExp_ bigint ; 차이값만 주쇼
  36. @4 ; @iWin_ int ; 차이값만 주쇼
  37. @5 ; @iLose_ int ; 차이값만 주쇼
  38.  
  39. 1 return ( @1 )
  40. @1 ; OK int
  41. 0 ; 성공
  42. -1 ; 유저 정보가 없음
  43. -2 ; 캐릭터가 없음
  44. -101이하 ; 트랜잭션 에러
  45. */
  46.  
  47. declare
  48. @strLogin nvarchar(20)
  49. select
  50. @strLogin = Login
  51. from dbo.Users
  52. where
  53. LoginUID = @iLoginUID_
  54.  
  55. if @strLogin is null
  56. begin select @iOK = -1 goto end_proc end
  57.  
  58. if not exists
  59. (
  60. select *
  61. from dbo.Characters
  62. where
  63. Login = @strLogin
  64. and CharType = @iCharType_
  65. )
  66. begin select @iOK = -2 goto end_proc end
  67.  
  68. begin transaction
  69.  
  70. update a
  71. with (updlock)
  72. set
  73. [Exp] = [Exp] + @iExp_
  74. , Level = dbo.zbLevel_Exp([Exp] + @iExp_)
  75. , Win = Win + @iWin_
  76. , Lose = Lose + @iLose_
  77. from dbo.Characters
  78. as a
  79. with (updlock)
  80. where
  81. Login = @strLogin
  82. and CharType = @iCharType_
  83.  
  84. if @@error <> 0
  85. begin select @iOK = -101 goto fail_tran end
  86.  
  87. if @iWin_ + @iLose_ > 0
  88. begin
  89. execute @iOK = dbo.RCR_rank_character_collect
  90. @iLoginUID_
  91. , @iCharType_
  92. , @iWin_
  93. , @iLose_
  94.  
  95. if @iOK <> 0
  96. begin select @iOK = -102 goto fail_tran end
  97. end
  98.  
  99. commit transaction
  100.  
  101. goto end_proc
  102.  
  103. fail_tran:
  104. rollback transaction
  105.  
  106. end_proc:
  107. select
  108. @iOK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement