Quantcast
Channel: RaGEZONE - MMO Development Forums
Viewing all articles
Browse latest Browse all 33169

[Guide] Find missing DDJ file using SQL query

$
0
0
Tired of getting this?


I made simple query to detect if DDJ file exist to help us find missing DDJ files in our Media. (Tested in SQL2K8-R2, not sure if it works in other SQL version)

First,
Since DDJ is in client-side, you gotta restore your server's SHARD db to your local laptop/pc first and run this from local SQL server, don't do this in the server (unless you have client files uploaded there)

Second,
you have to login SQL using "sa" and not other user you made for your SRO db. (needs access to "master" db and built-in "xp_fileexist" function)

Here we go:
Spoiler:
Code:

USE [master]
GO
DECLARE @ClientPath VARCHAR(250) = 'E:\vSRO\Client\Media\icon\' -- WITH TRAILING SLASH
SET NOCOUNT ON
CREATE TABLE #DDJStatus (FilePath VARCHAR(300),FileStatus VARCHAR(30))
DECLARE DDJCursor CURSOR LOCAL FAST_FORWARD FOR
    (SELECT DISTINCT AssocFileIcon128 FROM [SRO_VT_SHARD].[dbo].[_RefObjCommon] WHERE [Service] = 1 AND AssocFileIcon128 NOT LIKE 'xxx')
OPEN DDJCursor;
DECLARE @FullPath VARCHAR(250)
DECLARE @isExists INT;
FETCH FROM DDJCursor INTO @FullPath
WHILE @@FETCH_STATUS = 0
BEGIN
    SET @FullPath = @ClientPath + @FullPath;
    EXEC xp_fileexist @FullPath, @isExists out
    IF (@isExists = 1)
    BEGIN
        INSERT INTO #DDJStatus values(@FullPath,'OK')
    END
    ELSE BEGIN
        INSERT INTO #DDJStatus values(@FullPath,'MISSING')
    END
    FETCH FROM DDJCursor INTO @FullPath
END
CLOSE DDJCursor
DEALLOCATE DDJCursor
SELECT * FROM #DDJStatus
DROP TABLE #DDJStatus
GO


You should get something like this:
Spoiler:

Save the result to file, and find the missing DDJ ;)

Good luck, hope it helps a little bit ;)

Viewing all articles
Browse latest Browse all 33169

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>