SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 18/06/2012, 04:33 PM   #2541
Nightmare[TR]
Big Clucker
 
Join Date: Jan 2010
Location: Turkey
Posts: 86
Reputation: 5
Default Re: [REL] MySQL Plugin (R7 released)

Quote:
Originally Posted by Sergei View Post
Turn on debug and post it here.
Well,i solved the crash.But login doesn't works.If login doesn't works,players cannot be spawned.
Quote from mysql debug file;
Code:
[20:28:10] CMySQLHandler::Query(SELECT orgut FROM smf_members WHERE member_name='') - Successfully executed.

[20:28:10] >> mysql_store_result( Connection handle: 1 )

[20:28:10] CMySQLHandler::StoreResult() - Result was stored.

[20:28:10] >> mysql_num_rows( Connection handle: 1 )

[20:28:10] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:10] >> mysql_free_result( Connection handle: 1 )

[20:28:10] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:12] >> mysql_query( Connection handle: 1 )

[20:28:12] CMySQLHandler::Query(SELECT * FROM smf_members WHERE member_name=' ') - Successfully executed.

[20:28:12] >> mysql_store_result( Connection handle: 1 )

[20:28:12] CMySQLHandler::StoreResult() - Result was stored.

[20:28:12] >> mysql_num_rows( Connection handle: 1 )

[20:28:12] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:12] >> mysql_free_result( Connection handle: 1 )

[20:28:12] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:14] >> mysql_query( Connection handle: 1 )

[20:28:14] CMySQLHandler::Query(SELECT * FROM smf_members WHERE member_name=' ') - Successfully executed.

[20:28:14] >> mysql_store_result( Connection handle: 1 )

[20:28:14] CMySQLHandler::StoreResult() - Result was stored.

[20:28:14] >> mysql_num_rows( Connection handle: 1 )

[20:28:14] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:14] >> mysql_free_result( Connection handle: 1 )

[20:28:14] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:15] >> mysql_query( Connection handle: 1 )

[20:28:16] CMySQLHandler::Query(SELECT * FROM smf_members WHERE member_name=' ') - Successfully executed.

[20:28:16] >> mysql_store_result( Connection handle: 1 )

[20:28:16] CMySQLHandler::StoreResult() - Result was stored.

[20:28:16] >> mysql_num_rows( Connection handle: 1 )

[20:28:16] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:16] >> mysql_free_result( Connection handle: 1 )

[20:28:16] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:16] >> mysql_query( Connection handle: 1 )

[20:28:16] CMySQLHandler::Query(SELECT * FROM smf_members WHERE member_name=' ') - Successfully executed.

[20:28:16] >> mysql_store_result( Connection handle: 1 )

[20:28:16] CMySQLHandler::StoreResult() - Result was stored.

[20:28:16] >> mysql_num_rows( Connection handle: 1 )

[20:28:16] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:16] >> mysql_free_result( Connection handle: 1 )

[20:28:16] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:17] >> mysql_query( Connection handle: 1 )

[20:28:17] CMySQLHandler::Query(SELECT * FROM smf_members WHERE member_name=' ') - Successfully executed.

[20:28:17] >> mysql_store_result( Connection handle: 1 )

[20:28:17] CMySQLHandler::StoreResult() - Result was stored.

[20:28:17] >> mysql_num_rows( Connection handle: 1 )

[20:28:17] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:17] >> mysql_free_result( Connection handle: 1 )

[20:28:17] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:18] >> mysql_query( Connection handle: 1 )

[20:28:18] CMySQLHandler::Query(SELECT * FROM smf_members WHERE member_name=' ') - Successfully executed.

[20:28:18] >> mysql_store_result( Connection handle: 1 )

[20:28:18] CMySQLHandler::StoreResult() - Result was stored.

[20:28:18] >> mysql_num_rows( Connection handle: 1 )

[20:28:18] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:18] >> mysql_free_result( Connection handle: 1 )

[20:28:18] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:19] >> mysql_query( Connection handle: 1 )

[20:28:19] CMySQLHandler::Query(SELECT * FROM smf_members WHERE member_name=' ') - Successfully executed.

[20:28:19] >> mysql_store_result( Connection handle: 1 )

[20:28:19] CMySQLHandler::StoreResult() - Result was stored.

[20:28:19] >> mysql_num_rows( Connection handle: 1 )

[20:28:19] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:19] >> mysql_free_result( Connection handle: 1 )

[20:28:19] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:20] >> mysql_query( Connection handle: 1 )

[20:28:20] CMySQLHandler::Query(SELECT * FROM smf_members WHERE member_name=' ') - Successfully executed.

[20:28:20] >> mysql_store_result( Connection handle: 1 )

[20:28:20] CMySQLHandler::StoreResult() - Result was stored.

[20:28:20] >> mysql_num_rows( Connection handle: 1 )

[20:28:20] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:20] >> mysql_free_result( Connection handle: 1 )

[20:28:20] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:21] >> mysql_query( Connection handle: 1 )

[20:28:21] CMySQLHandler::Query(SELECT * FROM smf_members WHERE member_name=' ') - Successfully executed.

[20:28:21] >> mysql_store_result( Connection handle: 1 )

[20:28:21] CMySQLHandler::StoreResult() - Result was stored.

[20:28:21] >> mysql_num_rows( Connection handle: 1 )

[20:28:21] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:21] >> mysql_free_result( Connection handle: 1 )

[20:28:21] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:22] >> mysql_query( Connection handle: 1 )

[20:28:22] CMySQLHandler::Query(SELECT * FROM smf_members WHERE member_name=' ') - Successfully executed.

[20:28:22] >> mysql_store_result( Connection handle: 1 )

[20:28:22] CMySQLHandler::StoreResult() - Result was stored.

[20:28:22] >> mysql_num_rows( Connection handle: 1 )

[20:28:22] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:22] >> mysql_free_result( Connection handle: 1 )

[20:28:22] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:23] >> mysql_query( Connection handle: 1 )

[20:28:24] CMySQLHandler::Query(SELECT * FROM smf_members WHERE member_name=' ') - Successfully executed.

[20:28:24] >> mysql_store_result( Connection handle: 1 )

[20:28:24] CMySQLHandler::StoreResult() - Result was stored.

[20:28:24] >> mysql_num_rows( Connection handle: 1 )

[20:28:24] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:24] >> mysql_free_result( Connection handle: 1 )

[20:28:24] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:47] >> mysql_query( Connection handle: 1 )

[20:28:47] CMySQLHandler::Query(SELECT * FROM smf_members WHERE member_name=' ') - Successfully executed.

[20:28:47] >> mysql_store_result( Connection handle: 1 )

[20:28:47] CMySQLHandler::StoreResult() - Result was stored.

[20:28:47] >> mysql_num_rows( Connection handle: 1 )

[20:28:47] CMySQLHandler::NumRows() - Returned 0 row(s)

[20:28:47] >> mysql_free_result( Connection handle: 1 )

[20:28:47] CMySQLHandler::FreeResult() - Result was successfully free'd.

[20:28:57] >> mysql_query( Connection handle: 1 )

[20:28:57] CMySQLHandler::Query(UPDATE smf_members SET exp='0' WHERE member_name='Snakeman') - Successfully executed.

Last edited by Nightmare[TR]; 18/06/2012 at 05:43 PM.
Nightmare[TR] is offline   Reply With Quote
Old 18/06/2012, 08:58 PM   #2542
Michalec
Big Clucker
 
Michalec's Avatar
 
Join Date: Jun 2009
Location: Poland
Posts: 94
Reputation: 2
Default Re: [REL] MySQL Plugin (R7 released)

How to check if player logged ?

Code:
    format(Query,sizeof(Query),"SELECT `id` FROM `Gracze` WHERE `gracz` = '%s';",PlayerName(playerid));
    mysql_query(Query, -1, -1, MySQL);
    mysql_store_result();
    if(mysql_num_rows(MySQL) == 1)
    {
        LoginPlayer(playerid, 0);
    	}else{
        RegisterPlayer(playerid, 0);
    }
    mysql_free_result();
Didn't work... Help xd
Michalec is offline   Reply With Quote
Old 18/06/2012, 09:34 PM   #2543
Sergei
High-roller
 
Sergei's Avatar
 
Join Date: Mar 2008
Location: Slovenia
Posts: 2,729
Reputation: 134
Default Re: [REL] MySQL Plugin (R7 released)

You cut your log at the place where it became useful. It's useless to post logs from searching for user "y" because it doesn't exist right? Query some actual user name and post log here.

And it would be useful to psot your whole login code, not just this snipped.

PS: You should really do some checks so if you don't send query with empty player name.

PS2: HAve you even used my code I gave you? I don't see that plugin is escpaing anything anywhere ...
Sergei is offline   Reply With Quote
Old 19/06/2012, 07:21 AM   #2544
Nightmare[TR]
Big Clucker
 
Join Date: Jan 2010
Location: Turkey
Posts: 86
Reputation: 5
Default Re: [REL] MySQL Plugin (R7 released)

Forget it.

Last edited by Nightmare[TR]; 21/06/2012 at 07:03 AM.
Nightmare[TR] is offline   Reply With Quote
Old 19/06/2012, 10:39 AM   #2545
Michalec
Big Clucker
 
Michalec's Avatar
 
Join Date: Jun 2009
Location: Poland
Posts: 94
Reputation: 2
Default Re: [REL] MySQL Plugin (R7 released)

Help xd

Code:
[12:43:30] Passing query SELECT `id` FROM `Gracze` WHERE `gracz` = '[]Damianos[]'; | siii
[12:43:30] ProcessQueryThread(OnQueryFinish) - Query was successful. (SELECT `id` FROM `Gracze` WHERE `gracz` = '[]Damianos[]';)
[12:43:30] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[12:43:41] >> mysql_query_callback( Connection handle: 1 )
[12:43:41] CMySQLHandler::ProcessQueryThread() - Reconnection attempt in background thread.
[12:43:41] CMySQLHandler::Connect() - Connection was successful.
[12:43:41] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
This is log.
Where mistake ?

Code:
format(Query,sizeof(Query),"SELECT `id` FROM `Gracze` WHERE `gracz` = '%s';",PlayerName(playerid));
    mysql_query(Query, -1, -1, MySQL);
    mysql_store_result();
    if(mysql_num_rows(MySQL) == 1)
    {
        LoginPlayer(playerid, 0);
    	}else{
        RegisterPlayer(playerid, 0);
    }
    mysql_free_result();
Cya.
Michalec is offline   Reply With Quote
Old 19/06/2012, 10:51 AM   #2546
[NoV]LaZ
High-roller
 
Join Date: May 2008
Posts: 1,464
Reputation: 85
Default Re: [REL] MySQL Plugin (R7 released)

All mysql functions require a connection handle if you use any.
pawn Code:
format(Query,sizeof(Query),"SELECT `id` FROM `Gracze` WHERE `gracz` = '%s';",PlayerName(playerid));
    mysql_query(Query, -1, -1, MySQL);
    mysql_store_result(MySQL);
    if(mysql_num_rows(MySQL) == 1)
    {
        LoginPlayer(playerid, 0);
        }else{
        RegisterPlayer(playerid, 0);
    }
    mysql_free_result(MySQL);
[NoV]LaZ is offline   Reply With Quote
Old 19/06/2012, 12:18 PM   #2547
Michalec
Big Clucker
 
Michalec's Avatar
 
Join Date: Jun 2009
Location: Poland
Posts: 94
Reputation: 2
Default Re: [REL] MySQL Plugin (R7 released)

Didn't help. In log returns 1 if player name didn't exists and in game (with my debug) returns -1 or 1 O.o

Code:
[14:23:43] Passing query SELECT `id` FROM `Gracze` WHERE `gracz` = '[]Damianos[]' LIMIT 1; | siii
[14:23:44] ProcessQueryThread(OnQueryFinish) - Query was successful. (SELECT `id` FROM `Gracze` WHERE `gracz` = '[]Damianos[]' LIMIT 1;)
[14:23:44] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[14:24:12] >> mysql_query_callback( Connection handle: 1 )
[14:24:12] >> mysql_store_result( Connection handle: 1 )
[14:24:12] CMySQLHandler::StoreResult() - Result was stored.
[14:24:12] >> mysql_num_rows( Connection handle: 1 )
[14:24:12] CMySQLHandler::NumRows() - Returned 1 row(s)
[14:24:12] >> mysql_num_rows( Connection handle: 1 )
[14:24:12] CMySQLHandler::NumRows() - Returned 1 row(s)
[14:24:12] >> mysql_free_result( Connection handle: 1 )
[14:24:12] CMySQLHandler::FreeResult() - Result was successfully free'd.
[14:24:12] Passing query SELECT `id` FROM `Gracze` WHERE `gracz` = '[]Damianos[]22' LIMIT 1; | siii
[14:24:12] ProcessQueryThread(OnQueryFinish) - Query was successful. (SELECT `id` FROM `Gracze` WHERE `gracz` = '[]Damianos[]22' LIMIT 1;)
[14:24:12] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
If enter as []Damianos[] it returns -1
If enter as []Damianos[]22 it returns 1
[]Damianos[] exists in database, []Damianos[]22 not. WTF ?
Michalec is offline   Reply With Quote
Old 20/06/2012, 01:40 AM   #2548
Nicolas_Castillo
Big Clucker
 
Join Date: May 2010
Location: Bucaramanga/Colombia
Posts: 194
Reputation: 5
Default Respuesta: [REL] MySQL Plugin (R7 released)

Hello, I have a problem with the plugin in ubuntu.

with the plugin to R7

"x86 (compiled on Ubuntu)"


I get this error:
pawn Code:
Failed (plugins / mysql.so: undefined symbol: _Z13stringvprintfPKcPc)

While in the other version of the plugin R7

"Ubuntu"


I get this error
pawn Code:
Failed (libmysqlclient_r.so.16: can not open shared object file: No such file or
__________________
Hola Mundo(
pawnoscript.com
Nicolas_Castillo is offline   Reply With Quote
Old 20/06/2012, 02:55 PM   #2549
Coicatak
Huge Clucker
 
Join Date: Nov 2008
Posts: 354
Reputation: 0
Default Re: [REL] MySQL Plugin (R7 released)

Is is normal that
Code:
mysql_query("SELECT * FROM players");
gives me: " error 017: undefined symbol "mysql_query""?

I checked the a_mysql.inc file and I've noticed that mysql_query() is a macro, not a function, that must take 4 parameters whereas on the first post it says only the query must be passed as the other parameters are optional.

And there is no mysql_fetch_int() function, wtf lol

EDIT: Well, after reading http://forum.sa-mp.com/showthread.php?t=337810, I understood why all of the above happened. It would be good to update first post and wiki though.

Last edited by Coicatak; 20/06/2012 at 07:15 PM.
Coicatak is offline   Reply With Quote
Old 20/06/2012, 09:18 PM   #2550
Michalec
Big Clucker
 
Michalec's Avatar
 
Join Date: Jun 2009
Location: Poland
Posts: 94
Reputation: 2
Default Re: [REL] MySQL Plugin (R7 released)

Code:
    format(Query,sizeof(Query),"SELECT `id` FROM `Gracze` WHERE `gracz` = '%s' LIMIT 1;",PlayerName(playerid));
    mysql_query(Query, -1, -1, MySQL);
    mysql_store_result(MySQL);
    new rows = mysql_num_rows(MySQL);
    if(rows)
    {
        LoginPlayer(playerid, 0);
    	}else{
        RegisterPlayer(playerid, 0);
    }
    FormatMessage(playerid, "Rows: %d", rows);
    mysql_free_result(MySQL);
Didn't work... Help. I have to use the method of callback ?
On debug (formatmessage) if nick exists it returns -1 (WTF?)
Michalec is offline   Reply With Quote
Reply

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
Google Project: Glass int3s0 Everything and Nothing 99 26/02/2013 05:22 PM
MySQL Plugin R5 plugin problem dud Scripting Help 12 05/12/2011 07:28 PM
Strikens Mysql vs BlueG's Mysql plugin PrawkC Scripting Help 4 30/09/2011 10:30 AM
[help][plugin] Can't load mysql plugin mariomako Help Archive 8 16/07/2011 02:37 PM
mysql plugin. loading plugin failed ikkentim Help Archive 2 10/02/2011 03:32 PM


All times are GMT. The time now is 04:22 PM.


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