View Single Post
Old 27.10.2006, 14:06   #70
Sauron
Архивный участник
 
Join Date: Feb 2005
Posts: 357
Default

Quote:
Originally Posted by hhk31257 View Post
i can't add notes (database fail error)
players always see that they have 4 petitions left for today
and that there are 11 petitions pending.

how to fix this?
thanks in advance.
Code:
/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
CREATE TABLE dbo.UserQuota
	(
	account_id int NULL,
	amount int NULL
	)  ON [PRIMARY]
GO
COMMIT

insert into UserQuota values(0,20061008);

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[up_Server_GetCurrentQuota]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
-- =============================================
-- Author:		<Sauron>
-- Create date: <10.8.2006>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[up_Server_GetCurrentQuota]
	-- Add the parameters for the stored procedure here
@accountuid int
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	declare @today int;
	set @today = (select (year(getdate()) * 100 + dbo.FormatNumber(month(getdate())))*100+dbo.FormatNumber(day(getdate())));

	if(SELECT amount FROM UserQuota WHERE account_id=0) <> @today
	begin
		DELETE FROM UserQuota WHERE account_id <> 0;
		UPDATE UserQuota SET amount = @today WHERE account_id = 0;
		SELECT 0 as amount;
 	end;
	else
		SELECT isnull( sum(amount) , 0) as amount FROM UserQuota WHERE account_id = @accountuid;

END
' 
END

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[up_Server_UpdateQuota]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
-- =============================================
-- Author:		<Sauron>
-- Create date: <10.8.2006>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[up_Server_UpdateQuota]
	-- Add the parameters for the stored procedure here
@accountuid int,
@amount int
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	declare @today int;
	set @today = (select (year(getdate()) * 100 + dbo.FormatNumber(month(getdate())))*100+dbo.FormatNumber(day(getdate())));

	if(SELECT amount FROM UserQuota WHERE account_id=0) <> @today
	begin
		DELETE FROM UserQuota WHERE account_id <> 0;
		UPDATE UserQuota SET amount = @today WHERE account_id = 0;
 	end;
	else
	begin
		if exists(select * from UserQuota where account_id = @accountuid)
			UPDATE UserQuota SET amount = amount + @amount WHERE account_id = @accountuid;
		else
			INSERT INTO UserQuota values(@accountuid,1);
	end;
END
' 
END
Quote:
Originally Posted by aralyon View Post
I'm sorry, I'm now unable to develop petition system or anything related to L2 server due to loss the server. It is nessecary to have access to live server (or test server, but I'm unable to start L2 server on my PC)
can you share petition client source? i could continue the work.
Sauron is offline