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

Quote:
Originally Posted by Dodo9655
Посмотреть сообщение
The links for R7 and below are dead!
Yes because aint nobody got time for those old versions.
Reply

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
@Anou : To use cache functions in your code after a mysql_tquery, you MUST specify a callback in parameter of mysql_tquery.

Doing like this is the good way :

pawn Код:
forward myCallback();
public myCallback()
{
      new count = cache_get_row_count();
      // etc
}

// in some function

mysql_tquery(1, "SELECT * FROM myTable", "myCallback");
Whereas doing like this isn't :

pawn Код:
mysql_tquery(1, "SELECT * FROM myTable");
new count = cache_get_row_count();
// etc
The problem is that the cache is turned on only when the callback is called.
Look inline functions it does exactly the same as what you want.
Reply

Quote:
Originally Posted by Patrick
Посмотреть сообщение
Look inline functions it does exactly the same as what you want.
Exactly, Better than making a lot of public functions.
Reply

@Patrick : inline functions can be accessed from a plugin, like public ones ?

@iFarbod : In any case, we'll have to create a public function, as specified in the wiki page of the plugin.
Reply

Код:
SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team

[02:50:51] 
[02:50:51] Server Plugins
[02:50:51] --------------
[02:50:51]  Loading plugin: streamer
[02:50:51] 

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[02:50:51]   Loaded.
[02:50:51]  Loading plugin: mysql
[02:50:51] 

  > MySQL plugin R5 successfully loaded.

[02:50:51]   Loaded.
[02:50:51]  Loading plugin: nativechecker
[02:50:51]   Loaded.
[02:50:51]  Loaded 3 plugins.

[02:50:51] 
[02:50:51] Filterscripts
[02:50:51] ---------------
[02:50:51]   Loaded 0 filterscripts.

[02:50:51]    Error: Function not registered: 'cache_get_data'
[02:50:51]    Error: Function not registered: 'cache_get_row'
[02:50:51]    Error: Function not registered: 'mysql_tquery'
[02:50:51]    Error: Function not registered: 'cache_get_row_int'
[02:50:51]    Error: Function not registered: 'cache_get_row_float'
[02:50:51]    Error: Function not registered: 'mysql_log'
[02:50:51] Script[gamemodes/LFG.amx]: Run time error 19: "File or function is not found"
[02:50:51] Number of vehicle models: 0
How to fix it ?
Reply

Quote:
Originally Posted by AmirSlaYeR
Посмотреть сообщение
SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team

[02:50:51]
[02:50:51] Server Plugins
[02:50:51] --------------
[02:50:51] Loading plugin: streamer
[02:50:51]

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[02:50:51] Loaded.
[02:50:51] Loading plugin: mysql
[02:50:51]

> MySQL plugin R5 successfully loaded.



How to fix it ?
update to R7
http://files.g-stylezzz.com/mysql/re...-win32_vs9.rar Windows
Reply

Quote:
Originally Posted by AmirSlaYeR
Посмотреть сообщение
Код:
SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team

[02:50:51] 
[02:50:51] Server Plugins
[02:50:51] --------------
[02:50:51]  Loading plugin: streamer
[02:50:51] 

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[02:50:51]   Loaded.
[02:50:51]  Loading plugin: mysql
[02:50:51] 

  > MySQL plugin R5 successfully loaded.

[02:50:51]   Loaded.
[02:50:51]  Loading plugin: nativechecker
[02:50:51]   Loaded.
[02:50:51]  Loaded 3 plugins.

[02:50:51] 
[02:50:51] Filterscripts
[02:50:51] ---------------
[02:50:51]   Loaded 0 filterscripts.

[02:50:51]    Error: Function not registered: 'cache_get_data'
[02:50:51]    Error: Function not registered: 'cache_get_row'
[02:50:51]    Error: Function not registered: 'mysql_tquery'
[02:50:51]    Error: Function not registered: 'cache_get_row_int'
[02:50:51]    Error: Function not registered: 'cache_get_row_float'
[02:50:51]    Error: Function not registered: 'mysql_log'
[02:50:51] Script[gamemodes/LFG.amx]: Run time error 19: "File or function is not found"
[02:50:51] Number of vehicle models: 0
How to fix it ?
Quote:

> MySQL plugin R5 successfully loaded.

WTF? You must update to MySQL Plugin's latest version!

No! Not this! Can you see the MySQL's R33+ Version? Can you check GitHub at least?

https://github.com/pBlueG/SA-MP-MySQL/releases
Please DOWNLOAD R39-2!!!
Reply

----------
Loaded log file: "server_log.txt".
----------

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

[15:01:03] filterscripts = "" (string)
[15:01:03]
[15:01:03] Server Plugins
[15:01:03] --------------
[15:01:03] Loading plugin: mysql
[15:01:03] Failed.
[15:01:03] Loaded 0 plugins.

[15:01:03]
[15:01:03] Filterscripts
[15:01:03] ---------------
[15:01:03] Loaded 0 filterscripts.

[15:01:03] Script[gamemodes/slymind.amx]: Run time error 19: "File or function is not found"
[15:01:03] Number of vehicle models: 0

I've this problem, like other people. My mysql plugin is at last version, I downloaded which is posted laslty
Reply

Quote:
Originally Posted by Omirrow
Посмотреть сообщение
----------
Loaded log file: "server_log.txt".
----------

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

[15:01:03] filterscripts = "" (string)
[15:01:03]
[15:01:03] Server Plugins
[15:01:03] --------------
[15:01:03] Loading plugin: mysql
[15:01:03] Failed.
[15:01:03] Loaded 0 plugins.

[15:01:03]
[15:01:03] Filterscripts
[15:01:03] ---------------
[15:01:03] Loaded 0 filterscripts.

[15:01:03] Script[gamemodes/slymind.amx]: Run time error 19: "File or function is not found"
[15:01:03] Number of vehicle models: 0

I've this problem, like other people. My mysql plugin is at last version, I downloaded which is posted laslty
Your plugin isn't loaded, also, try debugging it using 'nativechecker' plugin.
Reply

The nativechecker plugin won't help here, you probably just don't have the required C++ redistributables installed. Check the FAQ for a solution.
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
The nativechecker plugin won't help here, you probably just don't have the required C++ redistributables installed. Check the FAQ for a solution.
Still same problem

I am really in need of help about that.

EDIT: by the way my operation system is windows 8, is there any problem with that?
Reply

No, there shouldn't be a problem.
Are you sure you installed the x86 redistributables (and not the x64 ones)? Did you place the libmysql.dll in the server directory?
Reply

How to use y_inline with the tqueries/pqueries ?
Reply

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
How to use y_inline with the tqueries/pqueries ?
Код:
#include <YSI/y_inline>
#include <a_mysql>

//...
inline Callback(number, Float:float)
{
	printf("inline callback called! (number: %d, float: %f)", number, float);
}
mysql_tquery_inline(sql, "SELECT 1", using inline Callback, "df", 123, 456.7777);
Reply

Failed (libmysqlclient_r.so.16: cannot open shared object file: No such file or directory)
for centos6 pls help!
Reply

Quote:
Originally Posted by maxisaibot
Посмотреть сообщение
Failed (libmysqlclient_r.so.16: cannot open shared object file: No such file or directory)
for centos6 pls help!
If you only had bothered reading the GitHub page. Try mysql_static.so if you have the library installed.

Q: I get a Failed (libmysqlclient_r.so.16: cannot open shared object file: No such file or directory) error, how do I fix this?
A: You don't have the MySQL client library installed. Install the "mysql-client" package.
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
No, there shouldn't be a problem.
Are you sure you installed the x86 redistributables (and not the x64 ones)? Did you place the libmysql.dll in the server directory?
I will try it one more time.
Reply

Are we allowe to use this plugin or we have to take perm from BlueG first?
Reply

what exactly are you asking good sir? are you asking if you can use it on a server...? then yes ok
Reply

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
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)