Car Not Saving
#6

does anyone know how SQL_UpdateInt works? here is the code:

pawn Code:
stock SQL_UpdateInt(index, field[], value)
{
    if ((index >= 0 && index < MAX_UPDATED_QUERIES) && E_QUERY_EXISTS[index])
    {
        new string[24];
        format(string, sizeof(string), "%d", value);
        return SQL_UpdateString(index, field, string);
    }
    return 0;
}
which then goes to this:

pawn Code:
stock SQL_UpdateString(index, field[], value[])
{
    if ((index >= 0 && index < MAX_UPDATED_QUERIES) && E_QUERY_EXISTS[index])
    {
        new string[128], File:file;
        format(string, sizeof(string), "`%s` = '%s', ", field, DB_Escape(value));
        if ((strlen(E_QUERY_DATA[index]) + strlen(string)) >= sizeof(E_QUERY_DATA[]))
        {
            new name[24];
            strunpack(name, E_QUERY_NAME[index]);
            printf("Warning: Update data buffer trying to exceed %d/%d characters (name: %s, field: %s)", strlen(E_QUERY_DATA[index]), sizeof(E_QUERY_DATA[]), name);
            return 0;
        }
        strins(E_QUERY_DATA[index], string, E_QUERY_POSITION[index]);
        file = fopen("fields.ini", io_readwrite);
        if (file || !fexist("fields.ini"))
        {
            new bool:found;
            if (!fexist("fields.ini"))
            {
                found = false;
                file = fopen("fields.ini", io_append);
            }
            else
            {
                while (fread(file, string, sizeof(string)))
                {
                    if (strcmp(string, field, false, strlen(field)) == 0)
                    {
                        found = true;
                        break;
                    }
                }
            }
            if (!found)
            {
                format(string, sizeof(string), "ALTER TABLE `Accounts` ADD COLUMN `%s` DEFAULT 0", field);
                db_query(AccountDB, string);
                fwrite(file, field);
                fwrite(file, "\r\n");
            }
            fclose(file);
        }
        return 1;
    }
    return 0;
}

is there anything wrong with these codes?
Reply


Messages In This Thread
Car Not Saving - by Donvalley - 05.08.2013, 12:33
Re: Car Not Saving - by Donvalley - 05.08.2013, 15:42
Re: Car Not Saving - by Donvalley - 06.08.2013, 04:50
Re: Car Not Saving - by Chu - 06.08.2013, 06:29
Re: Car Not Saving - by Donvalley - 06.08.2013, 06:37
Re: Car Not Saving - by Donvalley - 06.08.2013, 08:37
Re: Car Not Saving - by Donvalley - 06.08.2013, 11:37
Re: Car Not Saving - by Donvalley - 07.08.2013, 07:30
Re: Car Not Saving - by Donvalley - 08.08.2013, 09:13
Re: Car Not Saving - by Donvalley - 09.08.2013, 01:35

Forum Jump:


Users browsing this thread: 1 Guest(s)