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
#2

What MySQL plugin are you using?
Reply
#3

StrickenKid's SA:MP MySQL Plugin
Reply
#4

Ok, I'm completely stuck in this problem, nothing seems to work.

Anybody an idea?
Reply
#5

Код:
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
This got nothing with your problem. It is showing size of your script.

If there is nothing in mysql log, you probably got debugging turned off.

Is debugging turned on in your script?
Reply
#6

I understand that it's not the cause of this problem, but it's not something positive either according to this post.

Yes, debugging is turned on.
Reply
#7

Quote:
Originally Posted by Ironboy500[TW]
Посмотреть сообщение
Код:
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
This got nothing with your problem. It is showing size of your script.
This indicates that you're using more memory than is available, which will ultimately lead to a server crash and loss of data.
I have bookmarked the topic which explains it. So I can paste it here, for people like you to understand. https://sampforum.blast.hk/showthread.php?tid=55261
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
This indicates that you're using more memory than is available
This is something I still don't really understand.
What exactly decides how much memory is available?

Anyway, let's not try to deviate too much from the main problem; the LoadProperty() function.
Any ideas on that?
Reply
#9

Just a bump
Reply
#10

Have you checked mysql_logs file?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)