Converting to MySQL issues
#1

Hi all,

Currently I'm having a problem in which I'm completely lost.

I'm trying to convert a script to MySQL, which is going quite fine, but I'm stuck in one of the functions.
The function concerned is the property loader (which receives all the houses from the database):

pawn Код:
public OnGameModeInit()
{
...
    new MySQL:connection = mysql_init(LOG_ONLY_ERRORS, 1);
    ConnectToDB();
...
    LoadProperty();
...
}
The LoadProperty() function:

pawn Код:
public LoadProperty()
{
    mysql_query("SELECT * FROM `property`");
    mysql_store_result();

    if(mysql_num_rows() > 0)
    {
        new buffer[256];
        new field[33][256];
        new idx;

        while(mysql_fetch_row(buffer))
        {
            split(buffer, field);
            idx = strval(field[0]);

            HouseInfo[idx][hEntrancex] = floatstr(field[1]);
            HouseInfo[idx][hEntrancey] = floatstr(field[2]);
            HouseInfo[idx][hEntrancez] = floatstr(field[3]);
            HouseInfo[idx][hExitx] = floatstr(field[4]);
            HouseInfo[idx][hExity] = floatstr(field[5]);
            HouseInfo[idx][hExitz] = floatstr(field[6]);
            HouseInfo[idx][hHealthx] = strval(field[7]);
            HouseInfo[idx][hHealthy] = strval(field[8]);
            HouseInfo[idx][hHealthz] = strval(field[9]);
            HouseInfo[idx][hArmourx] = strval(field[10]);
            HouseInfo[idx][hArmoury] = strval(field[11]);
            HouseInfo[idx][hArmourz] = strval(field[12]);
            //printf("HouseInfo hEntrancez %f",HouseInfo[idx][hEntrancez]);
            strmid(HouseInfo[idx][hOwner], field[12], 0, strlen(field[13]), 255);
            strmid(HouseInfo[idx][hDiscription], field[13], 0, strlen(field[14]), 255);
            HouseInfo[idx][hValue] = strval(field[15]);
            HouseInfo[idx][hHel] = strval(field[16]);
            HouseInfo[idx][hArm] = strval(field[17]);
            HouseInfo[idx][hInt] = strval(field[18]);
            HouseInfo[idx][hLock] = strval(field[19]);
            HouseInfo[idx][hOwned] = strval(field[20]);
            HouseInfo[idx][hRooms] = strval(field[21]);
            HouseInfo[idx][hRent] = strval(field[22]);
            HouseInfo[idx][hRentabil] = strval(field[23]);
            HouseInfo[idx][hTakings] = strval(field[24]);
            HouseInfo[idx][hVec] = strval(field[25]);
            if(HouseInfo[idx][hVec] == 457)
            {
                HouseInfo[idx][hVec] = 411;
            }
            HouseInfo[idx][hVcol1] = strval(field[26]);
            HouseInfo[idx][hVcol2] = strval(field[27]);
            HouseInfo[idx][hDate] = strval(field[28]);
            HouseInfo[idx][hLevel] = strval(field[29]);
            HouseInfo[idx][hWorld] = strval(field[30]);
            HouseInfo[idx][hSetted] = strval(field[31]);
            //printf("HouseInfo:%d Owner:%s hTakings %d hVec %d",idx,HouseInfo[idx][hOwner],HouseInfo[idx][hTakings],HouseInfo[idx][hVec]);
        }
        printf("[SCRIPT]: Loaded %d Houses from Database", idx);
    }

    mysql_free_result();

    return 1;
}
But it just doesn't work... and I don't have any idea why.
There are no error logs about this either.

What am I doing wrong?


Another issue (during compiling) is this:

Код:
Header size:          16252 bytes
Code size:          3278728 bytes
Data size:         16190088 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:19501452 bytes
I'm getting this since the conversion of the LoadProperty() function.

Does anybody know why?

Thanks in advance.

Kind regards,
Thomas
Reply


Messages In This Thread
Converting to MySQL issues - by Thomas. - 04.09.2010, 13:14
Re: Converting to MySQL issues - by MadeMan - 04.09.2010, 13:55
Re: Converting to MySQL issues - by Thomas. - 04.09.2010, 14:13
Re: Converting to MySQL issues - by Thomas. - 04.09.2010, 19:04
Re: Converting to MySQL issues - by Ironboy500[TW] - 04.09.2010, 19:20
Re: Converting to MySQL issues - by Thomas. - 04.09.2010, 19:30
Re: Converting to MySQL issues - by Vince - 04.09.2010, 19:48
Re: Converting to MySQL issues - by Thomas. - 04.09.2010, 19:57
Re: Converting to MySQL issues - by Thomas. - 05.09.2010, 07:24
Re: Converting to MySQL issues - by armyoftwo - 05.09.2010, 07:46

Forum Jump:


Users browsing this thread: 3 Guest(s)