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

I was wondering if you can do a callback function which is called after an INSERT or UPDATE. It will be very usefull to synchronize a panel with the server without a timer or a separate table of recent actions.
Reply

You can execute any SQL statement you want; the result callback is always called if the statement was successfully executed by the server.
All cache_get_ natives will obviously not work if you send an INSERT or UPDATE query, however these three will:
Код:
native cache_affected_rows(connectionHandle = 1);
native cache_insert_id(connectionHandle = 1);
native cache_warning_count(connectionHandle = 1);
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
You can execute any SQL statement you want; the result callback is always called if the statement was successfully executed by the server.
All cache_get_ natives will obviously not work if you send an INSERT or UPDATE query, however these three will:
Код:
native cache_affected_rows(connectionHandle = 1);
native cache_insert_id(connectionHandle = 1);
native cache_warning_count(connectionHandle = 1);
DELETE too, right?
Reply

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
DELETE too, right?
cache_affected_rows() should work for delete too.
Reply

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
DELETE too, right?
Quote:
Originally Posted by Spmn
Посмотреть сообщение
cache_affected_rows() should work for delete too.
cache_affected_rows() works for UPDATE, REPLACE, INSERT and DELETE queries.
If you're on MySQL 5.5.5 or higher, ALTER TABLE and LOAD DATA INFILE queries will also work.
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
cache_affected_rows() works for UPDATE, REPLACE, INSERT and DELETE queries.
If you're on MySQL 5.5.5 or higher, ALTER TABLE and LOAD DATA INFILE queries will also work.
When release mysql r40?
Reply

Please can you help me here? Problem with ID!
https://sampforum.blast.hk/showthread.php?tid=592279
Reply

Oh, this plugin changed a lot from the last version I remember... what is pool_size from mysql_connect used for? I don't understand mysql_pquery neither, can you add more information to it? Thanks a lot.

Great plugin by the way.
Reply

Quote:
Originally Posted by [DOG]irinel1996
Посмотреть сообщение
Oh, this plugin changed a lot from the last version I remember... what is pool_size from mysql_connect used for? I don't understand mysql_pquery neither, can you add more information to it? Thanks a lot.

Great plugin by the way.
https://sampwiki.blast.hk/wiki/MySQL/R33
Reply

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
Already saw it dude, explain it to me if you got it.
Reply

Quote:
Originally Posted by [DOG]irinel1996
Посмотреть сообщение
Already saw it dude, explain it to me if you got it.
Quote:
Originally Posted by SA-MP Wiki
The difference between this native and mysql_tquery() is, that this type of query uses multi-threading, thus it's faster depending on how many connections are used. The number of connections can be specified in mysql_connect() through the pool_size parameter. Each connection resembles a thread.
Pool size in mysql_connect() is only used with mysql_pquery.

You can ****** about "connection pool SQL" in ****** and you'll find tons of article written about it.
Reply

That doesn't make sense since for union statements both select statements must have matching column types.
Reply

R39-4 has been released.

Changes:
- bug-fix: queries are not completely executed before disconnection
- bug-fix: 'orm_select' / 'orm_load' crashes when a NULL value is being loaded

Download is, as always, on GitHub.
Reply

As always, good job and thank you for your time to make this plugin even better.
Reply

Quote:
Originally Posted by Gigi-The-Beast
Посмотреть сообщение
As always, good job and thank you for your time to make this plugin even better.
Thanks!


I'm now looking for beta testers to test and play around with R40.
If anyone wants to participate, doesn't use any ORM functions, mysql_unprocessed_queries, mysql_format, cache_get_query_exec_time and cache_get_query_string (because they're currently unimplemented) and can provide regular feedback on stability and performance, PM me.
Note that this is an early beta version, that means it's not suited for productional use.
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
R39-4 has been released.

Changes:
- bug-fix: queries are not completely executed before disconnection
- bug-fix: 'orm_select' / 'orm_load' crashes when a NULL value is being loaded

Download is, as always, on GitHub.
Wow Thank you When release r40?
Reply

Quote:
Originally Posted by eco1999
Посмотреть сообщение
Wow Thank you When release r40?
Sometime next month.
Reply

Which is the best option?

Option 1:
Код HTML:
mysql_format(MySQLCon, QuerY, sizeof(QuerY), "UPDATE `players` SET `Money`=%d WHERE `ID`=%d", pInfo[playerid][pMoney],pInfo[playerid][pID]);
mysql_tquery(MySQLCon, QuerY);
Option 2:
Код HTML:
mysql_format(MySQLCon, QuerY, sizeof(QuerY), "UPDATE `players` SET `Money`=%d WHERE `ID`=%d", pInfo[playerid][pMoney],pInfo[playerid][pID]);
mysql_pquery(MySQLCon, QuerY);
pQuery or tQuery for Update? In table `players` are over 4,000+ created accounts.
Reply

I've got crazy.

Idk,how to connect to mysql,n how to setting up mysql?
Like make columm?
How?
Reply

You should learn the SQL syntax first before starting with this API. MySQL is not a magic wand that will instantly make your server more awesome. It is a very powerful system, but only when used right and to its full potential. If used incorrectly it can prove to be dreadful and hard manage, and in some cases may even turn out to be a lot slower than file IO.
Reply


Forum Jump:


Users browsing this thread: 16 Guest(s)