[Plugin] [REL] MySQL Plugin (Now on github!)

I need working mysql plugin for ubuntu! Please give me one!
Reply

Quote:
Originally Posted by sheenidgs
Посмотреть сообщение
Hi I wanna ask about my problem. I want load some my data with function mysql_tquery, but the callback doesn't called. Here's my code:
[...]
Sorry for my bad English
It's possible that your gamemode or another filterscript has a callback with the same name ("CarPriceLoadInit") and that this callback is called instead of the one in your filterscript.
This misleading behavior is going to be fixed in R40.
Reply

What would be, if you create another thread for connenection to the database? Because now mysql_connect() will hang up the server.

Best solution would be create thread for this and call a callback, when connection success or failed.
Reply

Quote:
Originally Posted by kurta999
Посмотреть сообщение
What would be, if you create another thread for connenection to the database? Because now mysql_connect() will hang up the server.

Best solution would be create thread for this and call a callback, when connection success or failed.
That's how it works now. All connections (except the unthreaded connection ofc) are established in another thread than the main thread, so 'mysql_connect' doesn't hang up the server.
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
It's possible that your gamemode or another filterscript has a callback with the same name ("CarPriceLoadInit") and that this callback is called instead of the one in your filterscript.
This misleading behavior is going to be fixed in R40.
I've changed it to another name, but it doesn't work too.
Reply

Fix the download links returns to a forbidden page.
Reply

Quote:
Originally Posted by devil shill
Посмотреть сообщение
Fix the download links returns to a forbidden page.
No? https://github.com/pBlueG/SA-MP-MySQL/releases
Reply

Quote:
Originally Posted by iZN
Посмотреть сообщение
No as i use R5 Version.
Reply

Quote:
Originally Posted by sheenidgs
Посмотреть сообщение
I've changed it to another name, but it doesn't work too.
Are you sure that this callback does not exist anywhere else in any of your scripts (neither a 'public' nor a 'forward' definition)?
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
Are you sure that this callback does not exist anywhere else in any of your scripts (neither a 'public' nor a 'forward' definition)?
Yes, I'm sure. I 've changed it to another and it's one and only on that script, but stiil nothing.
Reply

Quote:
Originally Posted by sheenidgs
Посмотреть сообщение
Hi I wanna ask about my problem. I want load some my data with function mysql_tquery, but the callback doesn't called. Here's my code:

pawn Код:
public OnFilterScriptInit()
{
    print( "> Connecting to MySQL server..." );
    sqlconn = mysql_connect( "127.0.0.1", "root", "samp", "thepassistrue" );

    ManualVehicleEngineAndLights();
    mysql_tquery( sqlconn, "SELECT * FROM `prices`;", "CarPriceLoadInit" );
    return 1;
}

forward CarPriceLoadInit();
public CarPriceLoadInit()
{
    new tmp[16];
    print("Loading Car Prices data.....");
   
    for( new i = 0; i < cache_get_row_count( sqlconn ); i++ ) {
        cache_get_field_content( i, "model", tmp, sqlconn ); VehInfo[i][Model] = strval(tmp);
        cache_get_field_content( i, "type", tmp, sqlconn ); VehInfo[i][Type] = strval(tmp);
        cache_get_field_content( i, "name", VehInfo[i][Name], sqlconn, 64 );
        cache_get_field_content( i, "price", tmp, sqlconn ); VehInfo[i][Price][0] = strval(tmp);
    }
    printf("|- %d Car Prices loaded from database. -|", cache_get_row_count( sqlconn ));
    return 1;
}
And here's the log: (from mysql_log.txt)
Код:
[23:01:24] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `prices`;", callback: "CarPriceLoadInit", format: "(null)"
[23:01:24] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[23:01:24] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[23:01:24] [DEBUG] CMySQLConnection::Connect - connection was successful
[23:01:24] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:01:24] [DEBUG] CMySQLConnection::Connect - connection was successful
[23:01:24] [DEBUG] CMySQLConnection::Connect - connection was successful
[23:01:24] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:01:24] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:01:24] [DEBUG] CMySQLQuery::Execute[CarPriceLoadInit] - starting query execution
[23:01:24] [DEBUG] CMySQLQuery::Execute[CarPriceLoadInit] - query was successfully executed within 0.580 milliseconds
[23:01:24] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[23:01:24] [DEBUG] Calling callback "CarPriceLoadInit"..
[23:01:24] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
And this one from server_log.txt:
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3z-R4, ©2005-2014 SA-MP Team

[23:02:09] 
[23:02:09] Server Plugins
[23:02:09] --------------
[23:02:09]  Loading plugin: streamer
[23:02:09]   Loaded.
[23:02:09]  Loading plugin: sscanf
[23:02:09] 

[23:02:09]  ===============================

[23:02:09]       sscanf plugin loaded.     

[23:02:09]          Version:  2.8.1        

[23:02:09]    © 2012 Alex "******" Cole  

[23:02:09]  ===============================

[23:02:09]   Loaded.
[23:02:09]  Loading plugin: mysql
[23:02:09]  >> plugin.mysql: R39-2 successfully loaded.
[23:02:09]   Loaded.
[23:02:09]  Loaded 3 plugins.

[23:02:09] 
[23:02:09] Filterscripts
[23:02:09] ---------------
[23:02:09]   Loading filterscript 'ls_mall.amx'...
[23:02:09]   Loading filterscript 'ls_elevator.amx'...
[23:02:09]   Loading filterscript 'VehSys.amx'...
[23:02:09]  
[23:02:09] > Connecting to MySQL server...
[23:02:09]   Loaded 3 filterscripts.

[23:02:09] Loaded 3 vehicles from: vehicles/trains.txt
[23:02:09] Loaded 3 vehicles from: vehicles/pilots.txt
[23:02:09] Loaded 15 vehicles from: vehicles/lv_law.txt
[23:02:09] Loaded 39 vehicles from: vehicles/lv_airport.txt
[23:02:09] Loaded 255 vehicles from: vehicles/lv_gen.txt
[23:02:09] Loaded 38 vehicles from: vehicles/sf_law.txt
[23:02:09] Loaded 35 vehicles from: vehicles/sf_airport.txt
[23:02:09] Loaded 353 vehicles from: vehicles/sf_gen.txt
[23:02:09] Loaded 24 vehicles from: vehicles/ls_law.txt
[23:02:09] Loaded 37 vehicles from: vehicles/ls_airport.txt
[23:02:09] Loaded 98 vehicles from: vehicles/ls_gen_inner.txt
[23:02:09] Loaded 389 vehicles from: vehicles/ls_gen_outer.txt
[23:02:09] Loaded 71 vehicles from: vehicles/whetstone.txt
[23:02:09] Loaded 168 vehicles from: vehicles/bone.txt
[23:02:09] Loaded 61 vehicles from: vehicles/flint.txt
[23:02:09] Loaded 96 vehicles from: vehicles/tierra.txt
[23:02:09] Loaded 96 vehicles from: vehicles/red_county.txt
[23:02:09] Total vehicles from files: 1781
[23:02:09] 
---------------------------------------
[23:02:09] Running Grand Larceny - by the SA-MP team

[23:02:09] ---------------------------------------

[23:02:09] Number of vehicle models: 173
[23:02:10]
Sorry for my bad English
I replay to your thread here. https://sampforum.blast.hk/showthread.php?tid=536003 ...

Quote:
Originally Posted by WopsS
Посмотреть сообщение
Tip: Please put that after mysql_connect and see if it is connected to database or not.

pawn Код:
if(sqlconn && mysql_errno(sqlconn) == 0)
    print("Connection to database was established!");
else
    print("Connection to database failed!");
Edit: I try to find the problem. But I can't, on my PC it work.

Edit #2: I reproduced your problem.

This isn't a MySQL Bug, it is a function which is defined already in another FS of GM. Change name of your callback or find it in other filterscripts or gamemode and includes.
I can't reproduced it in other ways.
Reply

How to set 2 key on ORM?
Reply

when i used mysql_function_query i got this message

Код:
D:\SAMP\gamemodes\mygamemode.pwn(265) : error 017: undefined symbol "mysql_function_query"
Код:
line 265 : 	mysql_function_query(handle,"SET NAMES TIS620",false,sendquery);
Reply

Quote:
Originally Posted by basicllsw
Посмотреть сообщение
when i used mysql_function_query i got this message

Код:
D:\SAMP\gamemodes\mygamemode.pwn(265) : error 017: undefined symbol "mysql_function_query"
Код:
line 265 : 	mysql_function_query(handle,"SET NAMES TIS620",false,sendquery);
You are probably using R5-R7
Reply

Anyone could please update links for older versions.
Reply

Quote:
Originally Posted by iFarbod
Посмотреть сообщение
You are probably using R5-R7
i use R39-2 it's problem?
Reply

Quote:
Originally Posted by basicllsw
Посмотреть сообщение
i use R39-2 it's problem?
Are you sure you're using the R39-2 includes aswell? Or maybe you're compiling your gamemode with different ones?
Reply

Links doesn't work
Reply

Quote:
Originally Posted by PawelQ
Посмотреть сообщение
Links doesn't work
The newest release can be downloaded from github, here.

Older links seem to be down... I've uploaded R6, here.


EDIT: i've got a question of my own.

Quote:

[18:40:08] [ERROR] CMySQLConnection::SetCharset - error 2019: Can't initialize character set windows-1257 (path: C:\mysql\\share\charsets\)

Plugin version: R39-2
OS: Windows
Code used to set charset:
pawn Код:
mysql_pquery(DbHandle,"SET NAMES cp1257");
mysql_set_charset("Windows-1257");
I use WAMP. But it's not even in C:. Why would it search in C drive? Or if I want to use it I have to put it in that folder?
Reply

1. You don't need that query, 'mysql_set_charset' is the equivalent of that query and the only correct way to do it.
2. There is no such charset as "Windows-1257", "cp1257" is the charset you want to set with 'mysql_set_charset'. Here is also a list of all valid charsets.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)