Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 11.03.2006, 17:01   #1
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default [FIX] Cache cannot load week playtime

The warning message cache spams when a user without time data logs in:
Quote:
Originally Posted by Cache
03/11/2006 02:30:xx.xx7, [Account.cpp][381]Error. Cannot load Week play time, account id [xxxxx]
03/11/2006 02:30:xx.xx1, [Account.cpp][321] Cannot load day uesed time for account [xxxxx]
This may have been posted before, don't know, didn't check, but it works.
I wrote this in about 2 minutes and didnt bother to make it quick to run, because you only need to do it once. It takes about 5 minutes on SQL 2000 and 15 seconds on 2005.

Code:
Declare @acc int
Set @acc = 0

WHILE(@acc < 150000)
BEGIN
INSERT lin2world.dbo.time_data (account_id, last_logout, used_sec)
VALUES (@acc, '1/1/2004 1:00:00 AM', '0')
Set @acc = @acc + 1
END
(I wrote this again from memory after 2 nights of no sleep, hope I didn't make any typos)

Edit: This should leave current time data which already exists in tact, SQL errors and continues when a duplicate row is detected in INSERT.
Shawnmb is offline  
Old 11.03.2006, 18:59   #2
hamidouch
Архивный участник
 
Join Date: Mar 2005
Posts: 475
Default

cool if it works. yea.
hamidouch is offline  
Old 11.03.2006, 19:35   #3
kiralex2
Архивный участник
 
Join Date: Jan 2006
Posts: 73
Default

How it to put?
kiralex2 is offline  
Old 11.03.2006, 19:41   #4
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

Run it in Query Analyzer (2000) or just a new query in management studio (2005).
Shawnmb is offline  
Old 11.03.2006, 19:45   #5
kiralex2
Архивный участник
 
Join Date: Jan 2006
Posts: 73
Default

Simply to execute SQL inquiry
Or it needs to be executed on lin2db or lin2world?
kiralex2 is offline  
Old 11.03.2006, 19:47   #6
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

I specified the Db object in the script itself, so you don't have to set a target, but if you really want to target Lin2World.
Shawnmb is offline  
Old 11.03.2006, 19:57   #7
superkent
Архивный участник
 
Join Date: Jun 2005
Posts: 242
Default

this is PROCEDURES? if YES, to what prosedres copy??
superkent is offline  
Old 11.03.2006, 20:00   #8
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

Just run it once, easy as that.
Shawnmb is offline  
Old 11.03.2006, 20:17   #9
superkent
Архивный участник
 
Join Date: Jun 2005
Posts: 242
Default

so this there will be one time, and it is necessary automatically
superkent is offline  
Old 11.03.2006, 20:18   #10
xarion
Архивный участник
 
Join Date: Sep 2005
Posts: 220
Default

works great, thnx author zzhhooshh
xarion is offline  
Old 11.03.2006, 20:18   #11
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

Unless you end up with over 150,000 accounts, yeah, just need it once.
Shawnmb is offline  
Old 11.03.2006, 23:23   #12
Xellos
Архивный участник
 
Join Date: Feb 2006
Posts: 88
Default

why don't u add a single insert statement to account creation scripts?
filling 150k lines into the db is . . . not really useful
Xellos is offline  
Old 11.03.2006, 23:38   #13
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

It would produce the same thing either way, this is a fix for a current issue, putting an insert line in the account creation script will only help for newly created accounts. Let alone that creating 150k rows assures the problem is solved for that number of accounts, which not many servers achieve anyways.
Shawnmb is offline  
Old 11.03.2006, 23:48   #14
kiralex2
Архивный участник
 
Join Date: Jan 2006
Posts: 73
Default

How to correct these mistakes?
http://img240.imageshack.us/img240/3487/err3hf.jpg
kiralex2 is offline  
Old 11.03.2006, 23:52   #15
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

Get a faster machine / database server? Optimize your database and data? That isn't an error, it's a warning message telling you that the query it ran took longer than your set max sql execution time. If you don't like them you can raise the value of that setting in cache's ini.

13 seconds for an item amount change? You should really consider upgrading or having a look into that issue.
Shawnmb is offline  
Old 12.03.2006, 00:12   #16
Xellos
Архивный участник
 
Join Date: Feb 2006
Posts: 88
Default

try this, it will insert missing lines into lin2world for all accounts that are defined in lin2db (maybe u have to change the script to fit your db structure)

[php:1:72ff948c5c].
INSERT INTO lin2world.dbo.time_data
SELECT a.uid, '2004-01-01', 0
FROM lin2db.dbo.user_account a
LEFT OUTER JOIN time_data t ON a.uid = t.account_id
WHERE (t.account_id IS NULL)
[/php:1:72ff948c5c]
Xellos is offline  
Old 12.03.2006, 00:13   #17
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

Generally the accounts are in numericial order, so the original post is the simplest way to do it, but yeah thanks for the feedback.
Shawnmb is offline  
Old 12.03.2006, 00:28   #18
Xellos
Архивный участник
 
Join Date: Feb 2006
Posts: 88
Default

There are entries in this table,
because the server safes the lastlogout date and total playtime in this table.

Why generating so much errors?

Filling only nescessary lines is exactly the same like an huge bulk insert? ok...
Xellos is offline  
Old 12.03.2006, 00:31   #19
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

[][][]
Shawnmb is offline  
Old 12.03.2006, 00:45   #20
Xellos
Архивный участник
 
Join Date: Feb 2006
Posts: 88
Default

so u prefer to fix a bug with creating a lot of useless data?
instead fixing the root of the bug itself?

btw - yes, I know what my script is doing

and yes... your script CAN'T overwrite data...
but it spits out a huge amount of error messages
Xellos is offline  
Old 13.12.2006, 15:14   #21
AsterisKSM
Архивный участник
 
Join Date: Jun 2006
Posts: 163
Default

after i putted this On my DB... it f****ed UP all my server... when it shows me the message [Account.cpp] etc. i get disconnect....

and sometimes..... all server crashes.... or it crash`es before loading the NPC`s... damn!

someone knows how to fix it?
AsterisKSM is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 18:33.