[RELEASE] VSRO v1.188 improved Log queries

Results 1 to 10 of 10
  1. #1
    Member Syloxx is offline
    MemberRank
    Aug 2014 Join Date
    GermanyLocation
    68Posts

    [RELEASE] VSRO v1.188 improved Log queries

    _AddLogChar

    Code:
    /**
    author : syloxx
    created date : 2015-03-11
    description : Log players activities.
    return value :
    0 = There is no error.
    1 = The transaction is in an uncommittable state. Rolling back transaction.
    **/
    
    
    CREATE PROCEDURE dbo._AddLogChar
          @CharID int
        , @eventID tinyint
        , @DaTa1 int
        , @DaTa2 int
        , @strPos varchar(64)
        , @desc varchar(128)
    AS
    SET NOCOUNT ON;
    SET XACT_ABORT ON;
    
    
    DECLARE @returnValue int;
    
    
    /**_# Rollback and return if inside an uncommittable transaction.*/
    IF XACT_STATE() = -1
    BEGIN
        SET @returnValue = 1;
        GOTO ErrorHandler;
    END
    
    
    BEGIN TRY
        /**_# Log players activities.*/
        INSERT dbo._LogEventChar (CharID, EventTime, EventID, Data1, Data2, EventPos, strDesc)
        VALUES  @CharID, GETDATE(), @eventID, @DaTa1, @DaTa2, CASE WHEN @strPos = '' THEN NULL ELSE @strPos END, CASE WHEN @desc = '' THEN NULL ELSE @desc END);
    END TRY
    BEGIN CATCH
        GOTO ErrorHandler;
    END CATCH;
    
    
    RETURN 0;
    
    
    ErrorHandler:
    IF XACT_STATE() <> 0
        ROLLBACK TRANSACTION;
    
    RETURN @returnValue
    _AddLogItem
    Code:
    /**
    author : syloxx
    created date : 2015-03-11
    description : Log players item interactions.
    return value :
    0 = There is no error.
    1 = The transaction is in an uncommittable state. Rolling back transaction.
    **/
    
    
    CREATE PROCEDURE dbo._AddLogItem
          @CharID int
        , @ItemRefID int
        , @ItemSerial bigint
        , @dwData int
        , @TargetStorage tinyint
        , @operation tinyint
        , @slot_From tinyint
        , @slot_To tinyint
        , @eventPos varchar(64)
        , @strDesc varchar(128)
        , @Gold bigint
    AS
    SET NOCOUNT ON;
    SET XACT_ABORT ON;
    
    
    DECLARE @returnValue int;
    
    
    /**_# Rollback and return if inside an uncommittable transaction.*/
    IF XACT_STATE() = -1
    BEGIN
        SET @returnValue = 1;
        GOTO ErrorHandler;
    END
    
    
    BEGIN TRY
        /**_# Log players item interactions.*/
        INSERT dbo._LogEventItem (EventTime, CharID, ItemRefID, dwData, TargetStorage, Operation, Slot_From, Slot_To, EventPos, strDesc, Serial64, Gold)
        VALUES (GETDATE(), @CharID, @ItemRefID, @dwData, @TargetStorage, @operation, @slot_From, @slot_To, CASE WHEN @eventPos = '' THEN NULL ELSE @eventPos END, CASE WHEN @strDesc = '' THEN NULL ELSE @strDesc END, @ItemSerial, @Gold)
    
    
        /**_# Log purchased cash items.*/
        IF @operation = 35
            INSERT dbo._LogCashItem (RefItemID, CharID, Cnt, EventTime, Serial64)
            VALUES (@ItemRefID, @CharID, @dwData, GETDATE(), @ItemSerial)
    END TRY
    BEGIN CATCH
        GOTO ErrorHandler;
    END CATCH;
    
    
    RETURN 0;
    
    
    ErrorHandler:
    IF XACT_STATE() <> 0
        ROLLBACK TRANSACTION;
    
    RETURN @returnValue
    Last edited by Syloxx; 12-03-15 at 03:36 PM.


  2. #2
    Proficient Member Dragonzee is offline
    MemberRank
    Oct 2011 Join Date
    Bashtil, Al JizLocation
    161Posts

    Re: [RELEASE] VSRO v1.188 improved Log queries

    is the way u paste it the same one in ur procedure ?

  3. #3
    Member Syloxx is offline
    MemberRank
    Aug 2014 Join Date
    GermanyLocation
    68Posts

    Re: [RELEASE] VSRO v1.188 improved Log queries

    Sorry about the formating, i had JS disabled so ragezone ignore "enter"

    leme fix that

  4. #4
    Proficient Member Dragonzee is offline
    MemberRank
    Oct 2011 Join Date
    Bashtil, Al JizLocation
    161Posts

    Re: [RELEASE] VSRO v1.188 improved Log queries

    what about SRO_VT_SYLOXX.dbo._AddErrorLog

    is it ur LOG db name or shard?

  5. #5
    Member Syloxx is offline
    MemberRank
    Aug 2014 Join Date
    GermanyLocation
    68Posts

    Re: [RELEASE] VSRO v1.188 improved Log queries

    SRO_VT_SYLOXX is my custom db name
    _AddErrorLog is a custom procedure (logs every error)

    Images:




    removed the execution now

  6. #6
    Apprentice anbelcay2 is offline
    MemberRank
    Dec 2014 Join Date
    Trujillo, PeruLocation
    8Posts

    Re: [RELEASE] VSRO v1.188 improved Log queries

    [QUOTE=Syloxx;8368153]SRO_VT_SYLOXX is my custom db name
    _AddErrorLog is a custom procedure (logs every error)

    Images:



    Please must share procedures and tables ..I would greatly appreciate it

  7. #7
    No avatar RenePunik is offline
    MemberRank
    Feb 2013 Join Date
    1,431Posts

    Re: [RELEASE] VSRO v1.188 improved Log queries

    What kinds of improvements?

  8. #8
    Member Syloxx is offline
    MemberRank
    Aug 2014 Join Date
    GermanyLocation
    68Posts

    Re: [RELEASE] VSRO v1.188 improved Log queries

    Quote Originally Posted by RenePunik View Post
    What kinds of improvements?
    -Included Errorhandling (in case you add shit in this procedure) -no useless len checks
    Last edited by Syloxx; 16-03-15 at 04:24 PM.

  9. #9
    Apprentice mohamedm00n is offline
    MemberRank
    Dec 2012 Join Date
    El Ma`Sara El-MLocation
    13Posts

    Re: [RELEASE] VSRO v1.188 improved Log queries

    copy and past in my addlogchar or just the new lines to add > same for addlogitem ??

  10. #10
    Enthusiast 0x88 is offline
    MemberRank
    May 2012 Join Date
    37Posts

    Re: [RELEASE] VSRO v1.188 improved Log queries

    this query what will help us?



Advertisement