View Full Version : [FIX] Cache cannot load week playtime
The warning message cache spams when a user without time data logs in:
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.
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.
hamidouch
11.03.2006, 18:59
cool if it works. yea.
kiralex2
11.03.2006, 19:35
How it to put?
Run it in Query Analyzer (2000) or just a new query in management studio (2005).
kiralex2
11.03.2006, 19:45
Simply to execute SQL inquiry
Or it needs to be executed on lin2db or lin2world?
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.
superkent
11.03.2006, 19:57
this is PROCEDURES? if YES, to what prosedres copy??
Just run it once, easy as that.
superkent
11.03.2006, 20:17
so this there will be one time, and it is necessary automatically
works great, thnx author zzhhooshh :)
Unless you end up with over 150,000 accounts, yeah, just need it once.
why don't u add a single insert statement to account creation scripts?
filling 150k lines into the db is . . . not really useful
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.
kiralex2
11.03.2006, 23:48
How to correct these mistakes?
http://img240.imageshack.us/img240/3487/err3hf.jpg
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.
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]
Generally the accounts are in numericial order, so the original post is the simplest way to do it, but yeah thanks for the feedback.
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...
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
AsterisKSM
13.12.2006, 15:14
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?