SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 04/09/2010, 02:14 PM   #1
Thomas.
Big Clucker
 
Thomas.'s Avatar
 
Join Date: Aug 2010
Location: The Netherlands
Posts: 130
Reputation: 17
Default Converting to MySQL issues

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 Code:
public OnGameModeInit()
{
...
    new MySQL:connection = mysql_init(LOG_ONLY_ERRORS, 1);
    ConnectToDB();
...
    LoadProperty();
...
}

The LoadProperty() function:

pawn Code:
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:

Code:
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

Last edited by Thomas.; 05/09/2010 at 12:15 PM.
Thomas. is offline  
Old 04/09/2010, 02:55 PM   #2
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,488
Reputation: 256
Default Re: Converting to MySQL issues

What MySQL plugin are you using?
MadeMan is offline  
Old 04/09/2010, 03:13 PM   #3
Thomas.
Big Clucker
 
Thomas.'s Avatar
 
Join Date: Aug 2010
Location: The Netherlands
Posts: 130
Reputation: 17
Default Re: Converting to MySQL issues

StrickenKid's SA:MP MySQL Plugin
Thomas. is offline  
Old 04/09/2010, 08:04 PM   #4
Thomas.
Big Clucker
 
Thomas.'s Avatar
 
Join Date: Aug 2010
Location: The Netherlands
Posts: 130
Reputation: 17
Default Re: Converting to MySQL issues

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

Anybody an idea?
Thomas. is offline  
Old 04/09/2010, 08:20 PM   #5
Ironboy500[TW]
Gangsta
 
Join Date: Jul 2010
Location: Croatia
Posts: 527
Reputation: 31
Default Re: Converting to MySQL issues

Code:
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?
Ironboy500[TW] is offline  
Old 04/09/2010, 08:30 PM   #6
Thomas.
Big Clucker
 
Thomas.'s Avatar
 
Join Date: Aug 2010
Location: The Netherlands
Posts: 130
Reputation: 17
Default Re: Converting to MySQL issues

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.
Thomas. is offline  
Old 04/09/2010, 08:48 PM   #7
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,090
Reputation: 2655
Default Re: Converting to MySQL issues

Quote:
Originally Posted by Ironboy500[TW] View Post
Code:
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. http://forum.sa-mp.com/showthread.php?t=55261
__________________
Vince is offline  
Old 04/09/2010, 08:57 PM   #8
Thomas.
Big Clucker
 
Thomas.'s Avatar
 
Join Date: Aug 2010
Location: The Netherlands
Posts: 130
Reputation: 17
Default Re: Converting to MySQL issues

Quote:
Originally Posted by Vince View Post
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?
Thomas. is offline  
Old 05/09/2010, 08:24 AM   #9
Thomas.
Big Clucker
 
Thomas.'s Avatar
 
Join Date: Aug 2010
Location: The Netherlands
Posts: 130
Reputation: 17
Default Re: Converting to MySQL issues

Just a bump
Thomas. is offline  
Old 05/09/2010, 08:46 AM   #10
armyoftwo
Gangsta
 
armyoftwo's Avatar
 
Join Date: Nov 2009
Posts: 636
Reputation: 5
Default Re: Converting to MySQL issues

Have you checked mysql_logs file?
armyoftwo is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL error (Plugin or DB issues) Jake__ Server Support 5 25/07/2010 02:58 AM
Converting A Map From MTA > SA:MP? GTAPod Help Archive 8 30/12/2009 11:59 AM
Help with converting map? DeltaAirlines12 Help Archive 11 19/12/2009 04:05 PM
about converting map help Sfinx_17 Help Archive 10 24/11/2009 06:10 PM


All times are GMT. The time now is 03:39 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.