[Plugin] [REL] SA:MP MySQL Plugin 2.1.1 - Released (1/25/2011
#21

Quote:
Originally Posted by Dreft
Ok, i turned off mysql_log() which was printing that all row and crash gone I wish that you fix this problem :P

Thanks for plugin again, it will change old G-Stylezz plugin for sure
Ah ok, so it's with the log feature, I will see what's wrong with it when I get back home, I'm on iPhone ATM.
Reply
#22

Nice work Ethan...
Reply
#23

Erm...
pawn Code:
stock ConfigRace()
{
    new CpCfgStr[4][56];
    sInfo[MaxRaces] = -1;
    for(new cfg = 0; cfg < 50; cfg++)
    {
        format(query,sizeof(query),"SELECT * FROM races WHERE raceid = %d",cfg);
        mysql_query(query);
        mysql_store_result();
       
        if(mysql_num_rows() != 0)
        {
            mysql_fetch_row(line);
           
            mysql_get_field("name",sql);
            format(rInfo[cfg][Name],128,"%s",sql);
           
            mysql_get_field("minx",sql);
            rInfo[cfg][minX] = floatstr(sql);
           
            mysql_get_field("maxx",sql);
            rInfo[cfg][maxX] = floatstr(sql);
           
            mysql_get_field("miny",sql);
            rInfo[cfg][minY] = floatstr(sql);
           
            mysql_get_field("maxy",sql);
            rInfo[cfg][maxY] = floatstr(sql);
           
            mysql_get_field("Z", sql);
            rInfo[cfg][spawnZ] = floatstr(sql);
           
            for(new ccfg = 1; ccfg < 26; ccfg++)
            {
                format(CpCfgStr[0],56,"cp%d_x",ccfg);
                format(CpCfgStr[1],56,"cp%d_y",ccfg);
                format(CpCfgStr[2],56,"cp%d_z",ccfg);
                format(CpCfgStr[3],56,"cp%d_param",ccfg);
               
                mysql_get_field(CpCfgStr[0], sql);
                rCP[cfg][ccfg][Xr] = floatstr(sql);
               
                mysql_get_field(CpCfgStr[1], sql);
                rCP[cfg][ccfg][Yr] = floatstr(sql);
               
                mysql_get_field(CpCfgStr[2], sql);
                rCP[cfg][ccfg][Zr] = floatstr(sql);
               
                mysql_get_field(CpCfgStr[3], rCP[cfg][ccfg][option]);
            }
            sInfo[MaxRaces]++;
        }
        mysql_free_result();
    }
    return 1;
}
As you can see i have mysql_free_result() at the end, but it doesn't free RAM memory usage. I started this ConfigRace() function 500 times and it increased my samp-server.exe by ~20MB. Is mysql_free_result() bugged in this plugin like in another two?

P.S. I have mysql_get_field...
pawn Code:
#define mysql_get_field(%1,%2) mysql_fetch_field(%1,%2)
Reply
#24

#define mysql_get_field(%1,%2) mysql_fetch_field(%1,%2)
What's that for?
Reply
#25

Quote:
Originally Posted by MenaceX^
#define mysql_get_field(%1,%2) mysql_fetch_field(%1,%2)
What's that for?
Everywhere i have mysql_get_field and I every time write mysql_get_field so instead of writing mysql_fetch_field i make that define and use mysql_get_field but problem not there. What about that memory usage and free_result() ?
Reply
#26

I've no idea.
You'll have to wait for Ethan.


Ethan:
Will you make the mysql_next_field?
Reply
#27

Ah, ok, I have fixed it, it was a small memory leak. I will post it in a sec.
Reply
#28

StrickenKid - <__Ǝthan__> very good thanks for your plugin!
Reply
#29

Keep up the great work.

I see we have a new MySQL plugin more stable and with a creator who is interested in his proper working order and that fixes the flaws that are noted by the rest of the community.

Again congratulations.


I will use this!!!
Reply
#30

Whoa! Cool! mysql_Free_result() works Thx
Reply
#31

version 1.0.1 update ? :P
Reply
#32

Problems again o_O
pawn Code:
new RegUserID;     
        format(query,sizeof(query),"SELECT user_id FROM vartotojai ORDER BY user_id DESC LIMIT 0, 1");
        mysql_query(query);
        mysql_store_result();
        mysql_fetch_row(line);     
        mysql_get_field("user_id",sql);
        RegUserID = strval(sql)+1;
        printf("NEW USER ID: %d",RegUserID);
        printf("FROM DATABASE: %s",sql);
Last user_id is 9313 so i need to get this:
Code:
NEW USER ID: 9314
FROM DATABASe: 9313
But i get this:
Code:
NEW USER ID: 1
FROM DATABASE: [here nothing]
from mysql logs:
Code:
[01/25/10 13:33:03] 'mysql_query' executed: "SELECT user_id FROM vartotojai ORDER BY user_id DESC LIMIT 0, 1" with result: "0".
[01/25/10 13:33:03] 'mysql_fetch_row' called with result: "9313".
and for mysql_get_field i have this:
pawn Code:
#define mysql_get_field(%1,%2) mysql_fetch_field(%1,%2)
Maybe this is some problems with plugin ? Because i can't login to my account too. Maybe you did some mistakes in yesterdays update ?
Reply
#33

This is the first time i have used MySql in sa-mp and decided to try this plugin.

Iv got as far as making the tables and storing the but thats it.

Could someone make an example login/register script using this plugin?

I'm still reading over the example in the first post but I'm not getting any further. Infact i seem to be going backwards

Thanks.
Reply
#34

Quote:
Originally Posted by Dreft
Problems again o_O
pawn Code:
new RegUserID;     
        format(query,sizeof(query),"SELECT user_id FROM vartotojai ORDER BY user_id DESC LIMIT 0, 1");
        mysql_query(query);
        mysql_store_result();
        mysql_fetch_row(line);     
        mysql_get_field("user_id",sql);
        RegUserID = strval(sql)+1;
        printf("NEW USER ID: %d",RegUserID);
        printf("FROM DATABASE: %s",sql);
Last user_id is 9313 so i need to get this:
Code:
NEW USER ID: 9314
FROM DATABASe: 9313
But i get this:
Code:
NEW USER ID: 1
FROM DATABASE: [here nothing]
from mysql logs:
Code:
[01/25/10 13:33:03] 'mysql_query' executed: "SELECT user_id FROM vartotojai ORDER BY user_id DESC LIMIT 0, 1" with result: "0".
[01/25/10 13:33:03] 'mysql_fetch_row' called with result: "9313".
and for mysql_get_field i have this:
pawn Code:
#define mysql_get_field(%1,%2) mysql_fetch_field(%1,%2)
Maybe this is some problems with plugin ? Because i can't login to my account too. Maybe you did some mistakes in yesterdays update ?
You do not need to use mysql_fetch_row before you use mysql_fetch_field.

EDIT: I also forgot to say, but I had a request from MenaceX to add mysql_fetch_int(), and mysql_fetch_float().
I've added those into the plugin and they're working, and I'll upload it when I get home from school.

So with mysql_fetch_int(), you can do:

Code:
new RegUserID;		
		format(query,sizeof(query),"SELECT user_id FROM vartotojai ORDER BY user_id DESC LIMIT 0, 1");
		mysql_query(query);
		mysql_store_result();
		RegUserID = mysql_fetch_int();
which is way more efficient when dealing with single fields.

Quote:
Originally Posted by OnTop2K9
This is the first time i have used MySql in sa-mp and decided to try this plugin.

Iv got as far as making the tables and storing the but thats it.

Could someone make an example login/register script using this plugin?

I'm still reading over the example in the first post but I'm not getting any further. Infact i seem to be going backwards

Thanks.
I could make another simple example on how to make a full login/register system when I get home from school.
Reply
#35

Quote:
Originally Posted by StrickenKid
I could make another simple example on how to make a full login/register system when I get home from school.
That would be awesome mate. Thanks.
Reply
#36

thanks man ! alot thanks !
keep on making such things man!

thanks
Reply
#37

pawn Code:
mysql_connect(SQL_HOST,SQL_USER,SQL_PASS,SQL_DB,1);
    mysql_set_character_set("utf8");
As you can see I set character set to utf8, but:


EDIT: If i set character set to utf-8 then:


:/ Maybe I do something wrong ?
Reply
#38

Hi all.

I have this problem:
Quote:
Originally Posted by Rooter username
MySQL error: Failed to connect. Access denied for user 'root'@'localhost' (using password: YES).
Quote:
Originally Posted by XAMPP username
MySQL error: Failed to connect. Access denied for user 'postmaster'@'localhost' (using password: YES).
Quote:
Originally Posted by PC username
MySQL error: Failed to connect. Access denied for user 'King'@'localhost' (using password: YES).
Information
_________________________________________________

Operating System: Windows 7 Ultimate (32Bits)

Rooter: Yes (User: root | Password: None)
MySQL DB: localhost (IP: 172.0.0.1 | Name: trdm)
Program: XAMPP 1.7.3

Ports Open
TCP/UDP 80 (XAMPP PHP Port) - Useless
TCP/UDP 7777 (SA-MP Server port) - Useless

Script

pawn Code:
#define MYSQL_HOST "127.0.0.1"
#define MYSQL_USER "root"
#define MYSQL_PASS ""
#define MYSQL_DB  "trdm"
Reply
#39

Also i don't find in any of downloads file libmysqlclient.so. I thought that i need to compile it myself but:

Code:
# $ apt-get install g++
# $ apt-get install mysql-client
# $ apt-get install libmysqlclient15-dev
I'm doing "yum" instead of "apt-get" because I have CentOS, and g++, mysql-client, libmysqlclient15-dev are not found
Also when I'm doing make i receive this:
Code:
[root@z14 source_1.0.1]# make
gcc -c -O3 -w -DLINUX -ISDK/amx/ SDK/amx/*.c
g++ -c -O3 -w -DLINUX -ISDK/amx/ SDK/*.cpp
g++ -c -O3 -w -DLINUX -ISDK/amx/ mysql.cpp
g++ -O2 -fshort-wchar -shared -o "mysql.so" *.o -I/usr/include/mysql/ -L/usr/lib/mysql/ -lmysqlclient
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
make: *** [all] Error 1
Reply
#40

Quote:
Originally Posted by Dreft
pawn Code:
mysql_connect(SQL_HOST,SQL_USER,SQL_PASS,SQL_DB,1);
    mysql_set_character_set("utf8");
As you can see I set character set to utf8, but:


EDIT: If i set character set to utf-8 then:


:/ Maybe I do something wrong ?
It may not show you UTF-8 letters, because of your regional settings.. (On WinXP Control Panel > Date, Time, Language, and Regional Options > Regional and Language Settings > Advanced > Select Lithuania
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)