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

Quote:
Originally Posted by dusk
Посмотреть сообщение
Quick question: does the plugin support multiple caches? For example if in one tquery/pquery callback I send a unthreded query?

Sample code
pawn Код:
for(new i = 0; i < cache_get_row_count(); i++)
{
     new Cache:result = mysql_query("...");
     if(cache_get_row_count())
        // stuff
     cache_delete(result);
}
It works well on the first iteration but on the second I get a "no active cache" warning. If so, I guess I could save the cache from first query, but since the second query is actually in a different module of mine, it doesn't look like a good solution.
That's the only solution. You have to save the cache from the threaded query and re-apply it again.
pawn Код:
new Cache:threaded_cache = cache_save();
for(new i = 0; i < cache_get_row_count(); i++)
{
     new Cache:result = mysql_query("...");
     if(cache_get_row_count())
        // stuff
     cache_delete(result);
     
     cache_set_active(threaded_cache);
}
cache_delete(threaded_cache);
Quote:
Originally Posted by dusk
Посмотреть сообщение
P.S. I'm on 39-3. Will the dreaded HTML log color will ever change?
I don't intend to modify the HTML log in the R39 releases. R39 (including all patch versions like R39-2, R39-3, ...) will be only updated on minor changes and bug fixes. That being said, you should really update to R39-5. You don't even have to recompile your scripts, simply copy-and-replace the plugin (and libmysqlclient if you're on Windows) file.

Oh, and there is no HTML log anymore in R40.
Reply

Quote:
Originally Posted by Kar
Посмотреть сообщение
Can someone compile the latest version of the R-39 plugin for me? I use Ubuntu Trusty.

https://github.com/pBlueG/SA-MP-MySQL/tree/issue-54
UARGHGGHADD
Код:
ubuntu@test-server:/usr/local/SA-MP-MySQL-issue-54$ sudo make
sudo: unable to resolve host test-server
Compiling plugin..
In file included from libs/boost/iostreams/detail/is_dereferenceable.hpp:12:0,
                 from libs/boost/iostreams/detail/resolve.hpp:26,
                 from libs/boost/iostreams/detail/push.hpp:24,
                 from libs/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from libs/boost/iostreams/stream_buffer.hpp:22,
                 from libs/boost/iostreams/stream.hpp:21,
                 from libs/boost/spirit/home/karma/stream/detail/iterator_sink.hpp:13,
                 from libs/boost/spirit/home/karma/stream/stream.hpp:24,
                 from libs/boost/spirit/home/karma/stream.hpp:14,
                 from libs/boost/spirit/home/karma.hpp:27,
                 from libs/boost/spirit/include/karma.hpp:16,
                 from src/COrm.cpp:9:
libs/boost/type_traits/detail/bool_trait_def.hpp:18:79: note: #pragma message: NOTE: Use of this header (bool_trait_def.hpp) is deprecated
 # pragma message("NOTE: Use of this header (bool_trait_def.hpp) is deprecated")
                                                                               ^
In file included from libs/boost/type_traits/detail/bool_trait_def.hpp:21:0,
                 from libs/boost/iostreams/detail/is_dereferenceable.hpp:12,
                 from libs/boost/iostreams/detail/resolve.hpp:26,
                 from libs/boost/iostreams/detail/push.hpp:24,
                 from libs/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from libs/boost/iostreams/stream_buffer.hpp:22,
                 from libs/boost/iostreams/stream.hpp:21,
                 from libs/boost/spirit/home/karma/stream/detail/iterator_sink.hpp:13,
                 from libs/boost/spirit/home/karma/stream/stream.hpp:24,
                 from libs/boost/spirit/home/karma/stream.hpp:14,
                 from libs/boost/spirit/home/karma.hpp:27,
                 from libs/boost/spirit/include/karma.hpp:16,
                 from src/COrm.cpp:9:
libs/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
 # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
                                                                                    ^
In file included from libs/boost/iostreams/detail/is_dereferenceable.hpp:13:0,
                 from libs/boost/iostreams/detail/resolve.hpp:26,
                 from libs/boost/iostreams/detail/push.hpp:24,
                 from libs/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from libs/boost/iostreams/stream_buffer.hpp:22,
                 from libs/boost/iostreams/stream.hpp:21,
                 from libs/boost/spirit/home/karma/stream/detail/iterator_sink.hpp:13,
                 from libs/boost/spirit/home/karma/stream/stream.hpp:24,
                 from libs/boost/spirit/home/karma/stream.hpp:14,
                 from libs/boost/spirit/home/karma.hpp:27,
                 from libs/boost/spirit/include/karma.hpp:16,
                 from src/COrm.cpp:9:
libs/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
 # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
                                                                                    ^
In file included from libs/boost/iostreams/detail/is_dereferenceable.hpp:12:0,
                 from libs/boost/iostreams/detail/resolve.hpp:26,
                 from libs/boost/iostreams/detail/push.hpp:24,
                 from libs/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from libs/boost/iostreams/stream_buffer.hpp:22,
                 from libs/boost/iostreams/stream.hpp:21,
                 from libs/boost/spirit/home/qi/stream/detail/iterator_source.hpp:14,
                 from libs/boost/spirit/home/qi/stream/stream.hpp:16,
                 from libs/boost/spirit/home/qi/stream.hpp:15,
                 from libs/boost/spirit/home/qi.hpp:30,
                 from libs/boost/spirit/include/qi.hpp:16,
                 from src/misc.cpp:6:
libs/boost/type_traits/detail/bool_trait_def.hpp:18:79: note: #pragma message: NOTE: Use of this header (bool_trait_def.hpp) is deprecated
 # pragma message("NOTE: Use of this header (bool_trait_def.hpp) is deprecated")
                                                                               ^
In file included from libs/boost/type_traits/detail/bool_trait_def.hpp:21:0,
                 from libs/boost/iostreams/detail/is_dereferenceable.hpp:12,
                 from libs/boost/iostreams/detail/resolve.hpp:26,
                 from libs/boost/iostreams/detail/push.hpp:24,
                 from libs/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from libs/boost/iostreams/stream_buffer.hpp:22,
                 from libs/boost/iostreams/stream.hpp:21,
                 from libs/boost/spirit/home/qi/stream/detail/iterator_source.hpp:14,
                 from libs/boost/spirit/home/qi/stream/stream.hpp:16,
                 from libs/boost/spirit/home/qi/stream.hpp:15,
                 from libs/boost/spirit/home/qi.hpp:30,
                 from libs/boost/spirit/include/qi.hpp:16,
                 from src/misc.cpp:6:
libs/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
 # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
                                                                                    ^
In file included from libs/boost/iostreams/detail/is_dereferenceable.hpp:13:0,
                 from libs/boost/iostreams/detail/resolve.hpp:26,
                 from libs/boost/iostreams/detail/push.hpp:24,
                 from libs/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from libs/boost/iostreams/stream_buffer.hpp:22,
                 from libs/boost/iostreams/stream.hpp:21,
                 from libs/boost/spirit/home/qi/stream/detail/iterator_source.hpp:14,
                 from libs/boost/spirit/home/qi/stream/stream.hpp:16,
                 from libs/boost/spirit/home/qi/stream.hpp:15,
                 from libs/boost/spirit/home/qi.hpp:30,
                 from libs/boost/spirit/include/qi.hpp:16,
                 from src/misc.cpp:6:
libs/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
 # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
                                                                                    ^
Compiling plugin SDK..
Linking (dynamic)..
/usr/bin/ld: cannot find -lmysqlclient_r
/usr/bin/ld: cannot find -lboost_thread
/usr/bin/ld: cannot find -lboost_chrono
/usr/bin/ld: cannot find -lboost_date_time
/usr/bin/ld: cannot find -lboost_system
/usr/bin/ld: cannot find -lboost_atomic
collect2: error: ld returned 1 exit status
make: *** [dynamic_link] Error 1
ubuntu@test-server:/usr/local/SA-MP-MySQL-issue-54$
Is anyone using R40 on a live server yet?
Reply

ACCIDENTAL DOUBLE POST. PLS REMOVE. MAY THE LORD BE WITH YOU!
Reply

Quote:
Originally Posted by Kar
Посмотреть сообщение
UARGHGGHADD
Код:
ubuntu@test-server:/usr/local/SA-MP-MySQL-issue-54$ sudo make
sudo: unable to resolve host test-server
Compiling plugin..

[stupid deprecated-warnings from Boost]
                                                                                    
Compiling plugin SDK..
Linking (dynamic)..
/usr/bin/ld: cannot find -lmysqlclient_r
/usr/bin/ld: cannot find -lboost_thread
/usr/bin/ld: cannot find -lboost_chrono
/usr/bin/ld: cannot find -lboost_date_time
/usr/bin/ld: cannot find -lboost_system
/usr/bin/ld: cannot find -lboost_atomic
collect2: error: ld returned 1 exit status
make: *** [dynamic_link] Error 1
ubuntu@test-server:/usr/local/SA-MP-MySQL-issue-54$
[...]
You lack the Boost libraries (you have to install/compile Boost itself too).
You're also missing the libmysqlclient library.
Reply

What was the mysql_connect from file function named again?
Reply

Quote:
Originally Posted by dusk
Посмотреть сообщение
What was the mysql_connect from file function named again?
mysql_connect_file.
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
Thanks, but I just downloaded R39-5 and a_mysql.inc doesn't declare that function!
Reply

Quote:
Originally Posted by dusk
Посмотреть сообщение
Thanks, but I just downloaded R39-5 and a_mysql.inc doesn't declare that function!
Yes, that's because mysql_connect_file is a R40 feature.
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
Yes, that's because mysql_connect_file is a R40 feature.
Oh R40 isn't officially released, is it? If I were to build the plugin myself, how safe for deployment is it?
Reply

No, it's not yet released.
I can't say for sure how stable it is. However, pretty much everything has already been tested (thanks to Konstantinos), so there shouldn't be any major bugs or crashes. I wouldn't go as far as to say that it's safe for production use though.
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
You lack the Boost libraries (you have to install/compile Boost itself too).
You're also missing the libmysqlclient library.
I have boost, thats the thing. I installed it using apt-get and I downloaded it manually and put it in /libs/boost/ in the project folder because it seems thats where its looking for boost. Theres no libmysqlclient on ubuntu either.. grrr.
Reply

Take a look at the Travis config file, it's basically a step-by-step instruction to compile the plugin. Make sure all your libraries are 32bit.
Reply

Awesome, it's just the libmysqlclient now..

pawn Код:
ubuntu@complicationserver:~/SA-MP-MySQL-issue-54$ make
Compiling plugin..
Compiling plugin SDK..
Linking (dynamic)..
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
make: *** [dynamic_link] Error 1
ubuntu@complicationserver:~/SA-MP-MySQL-issue-54$
I think the problem is that a symlink needs to be created, because im sure libmysqlclient is installed under mysql-client in ubuntu.

pawn Код:
ldconfig -p  | grep mysql
        libmysqlclient.so.18 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
        libmysqlclient.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libmysqlclient.so
Reply

Your libmysqlclient library is not 32bit. Execute
Код:
sudo apt-get install libmysqlclient-dev:i386
If that doesn't work, try "libmysqlclient18" instead of "libmysqlclient-dev".
Reply

I'm so annoyed lol. The 32bit doesn't work for anything

pawn Код:
ubuntu@complicationserver:~/SA-MP-MySQL-issue-54$ sudo apt-get install libmysqlclient-dev:i386
sudo: unable to resolve host complicationserver
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libmysqlclient-dev
I give up for now.
Reply

Quote:
Originally Posted by Kar
Посмотреть сообщение
I'm so annoyed lol. The 32bit doesn't work for anything

pawn Код:
ubuntu@complicationserver:~/SA-MP-MySQL-issue-54$ sudo apt-get install libmysqlclient-dev:i386
sudo: unable to resolve host complicationserver
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libmysqlclient-dev
I give up for now.
If I understood correctly, this could be your solution for your 32bit problem: https://wiki.debian.org/Multiarch/HOWTO
Reply

Quote:
Originally Posted by ThomasTailor93
Посмотреть сообщение
If I understood correctly, this could be your solution for your 32bit problem: https://wiki.debian.org/Multiarch/HOWTO
You guys are the BEST!

IT WORKS!

Here you guys go! This version is from https://github.com/pBlueG/SA-MP-MySQ...c3a0e6738cc9c6

Compiled under Ubuntu Trusty 14.04

mysql.so | http://www.mediafire.com/download/4n...9lfj5/mysql.so
mysql_static.so | http://www.mediafire.com/download/rf...ysql_static.so

--

Also if anyone is interested I have a version that has improved error logging (prints the query that was executed).. which uses R39-5 still.. E.G

pawn Код:
[21:13:59 07/21/16] [WARNING] CMySQLResult::GetRowData - invalid row ('20') or field index ('0') ("SELECT `T_T`, `T_A`, `T_ACCOUNTID`, `TIMESTAMP` FROM `BANKTRANSACTIONS` WHERE `ACCOUNTID` = 24 ORDER BY `TIMESTAMP` DESC LIMIT 0,20")
Reply

Quote:
Originally Posted by Jeroen52
Посмотреть сообщение
Alright, if there are no new features coming for CentOS 6 builds, will there be a maintenance branch including bugfixes and security fixes?
I thought about this and I still haven't really decided. I'd have to move the R39 code into a new repository to not pollute the releases of the main repository (people would get confused if they'd see a R39-8, then a R41 and after that a R39-7 release). R39 is also pretty much stable as it is, so I'm not sure if there'd even be any kind of fixes afterwards. And keeping track of two versions is bothersome too, I'd rather focus on one and make sure it runs perfectly.
Reply

Quote:
Originally Posted by maddinat0r
Посмотреть сообщение
I thought about this and I still haven't really decided. I'd have to move the R39 code into a new repository to not pollute the releases of the main repository (people would get confused if they'd see a R39-8, then a R41 and after that a R39-7 release). R39 is also pretty much stable as it is, so I'm not sure if there'd even be any kind of fixes afterwards. And keeping track of two versions is bothersome too, I'd rather focus on one and make sure it runs perfectly.
I have thought about this as well. I don't think that it will be much of a problem. Those who end up at GitHub actually read. Most of the people that can't read use R6 or R7 from the original post for some reason.

What could be done in the R40+ branch is to add a check to it, that if you have GCC 4.8+ it will continue, if the person does not have GCC 4.8+ it will show the message asking for them to update their GCC or use R39-*.
Reply

Quote:
Originally Posted by Jeroen52
Посмотреть сообщение
[...]
What could be done in the R40+ branch is to add a check to it, that if you have GCC 4.8+ it will continue, if the person does not have GCC 4.8+ it will show the message asking for them to update their GCC or use R39-*.
If you're talking about a compile-time check: CMake already takes care of this. It simply won't generate any makefiles if the compiler doesn't support all required C++11 features.
If you're talking about a run-time check: that's not possible. If you load a plugin linked to a libstdcpp which has a higher version than the one provided on your system, you'll get a "version GLIBCXX_3.4.15 not found" error or similar.
Reply


Forum Jump:


Users browsing this thread: 12 Guest(s)