• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[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