Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Release] (SQL)DataBase managment code

Experienced Elementalist
Joined
Jul 29, 2012
Messages
286
Reaction score
265
i'm have rewritten the database management code with strive for C language,secure,easier

Example of getting integer :
Code:
int GetLevel(void)
{
    int Level = 0;
    if (ExecGetInt("SELECT cLevel FROM CHARACTER WHERE Name = 'Test'", &Level) == false) /* Attempt get level for char with name 'Test' */
    {
        return -1; /* Failed get integer - return */
    }
    return Level; /* Success get integer */
}

Example of getting string:
Code:
char* GetName(void)
{
    char AccountName[11] = {0}
    if (ExecGetInt("SELECT AccountID FROM CHARACTER WHERE Name = 'Test'", AccountName) == false) /* Attempt get account name for char when char name 'Test' */
    {
        return NULL; /* Failed get string - return */
    }
    return &AccountName; /* Success get string */
}

Example of executing query:
Code:
bool SetLevel(void)
{
    if (Exec("UPDATE CHARACTHER SET cLevel = cLevel - 1 WHERE Name = 'Test') == false) /* Attempt set level for char when char name 'Test' */
    {
    return false; /* Failed to set level */
    }
    return true; /* Success set level */
}
 

Attachments

You must be registered for see attachments list
Last edited:
Back
Top