[release]_ManageShardCharName Error fix in Global Manager!

10/28/2011 22:54 Miki Maus#1
Code:
USE [SRO_VT_ACCOUNT]
GO
/****** Object:  Table [dbo].[SR_CharAppoint]    Script Date: 10/29/2011 10:50:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SR_CharAppoint](
	[UserJID] [int] NOT NULL,
	[ShardID] [int] NOT NULL,
	[CharID] [varchar](64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
Just add this new table and change the _ManageShardCharNames procedure:
Code:
set ANSI_NULLS OFF
set QUOTED_IDENTIFIER OFF
GO
ALTER procedure [dbo].[_ManageShardCharName]
	@job		tinyint,
	@UserJID   	int,
	@ShardID   	smallint,
	@CharName 	varchar(64),
	@OldName 	varchar(64)
as
	-- add new char name
	if (@job = 0)
	begin
		if (not exists(select * from SR_ShardCharNames where UserJID = @UserJID and ShardID = @ShardID and CharName = @CharName))
		begin
			insert SR_ShardCharNames values(@UserJID, @ShardID, @CharName)
		end
	end
	-- remove char name
	else if (@job = 1)
	begin
		delete SR_ShardCharNames where UserJID = @UserJID and ShardID = @ShardID and CharName = @CharName
		delete SR_CharAppoint where UserJID = @UserJID and ShardID = @ShardID and CharID = @CharName
	end
	-- rename previous one
	else if (@job = 2)
	begin
		update SR_ShardCharNames set CharName = @CharName where UserJID = @UserJID and ShardID = @ShardID and CharName = @OldName
		update SR_CharAppoint set CharID = @CharName where UserJID = @UserJID and ShardID = @ShardID and CharID = @OldName
	end
that's all.
10/28/2011 23:01 18andLife#2
And what does it exactly fix? o.0
Never got such error in globalmanager (or i didn't see, lol), thanks though.
10/28/2011 23:17 Miki Maus#3
Quote:
Originally Posted by 18andLife View Post
And what does it exactly fix? o.0
Never got such error in globalmanager (or i didn't see, lol), thanks though.
The error. I had seen this error several times on my server, so needed to fix it - and shared to others in case someone happens to have it to.