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

Help please i cant run any plugin above R20 or the once with .pdb files and i don't know what to do... i have Windows 7 x64bit
Reply

Hey there!

Just wondering, what "cache_get" method you should use when changing integer in SELECT query to a string. I Have tried to use "cache_get_field_content();", but this does nothing. No errors or anything in my logs.

Thanks for your reply in advance!
Reply

Quote:
Originally Posted by CrossUSAAF
Посмотреть сообщение
Hey there!

Just wondering, what "cache_get" method you should use when changing integer in SELECT query to a string. I Have tried to use "cache_get_field_content();", but this does nothing. No errors or anything in my logs.

Thanks for your reply in advance!
I don't really get what you mean, but to convert an integer into string you could use valstr and when you want to convert a string into integer you could use strval, but if you use newer version such as MySQL R8+ I think there is a function for it, try searching.

Example
pawn Код:
new temp[ 15 ];
cache_get_row(0, 1, temp); Variable[playerid] = strval(temp); //convert integer into string
pawn Код:
new temp[ 20 ];
cache_get_row(0, 1, temp); Variable[playerid] = valstr(temp, Variable[playerid]); //convert integer into string
PS - I hope I answered your question, took me 3-4 times to read and understand what you meant.
Reply

https://sampwiki.blast.hk/wiki/MySQL/R33#cache_get_row_int

or

https://sampwiki.blast.hk/wiki/MySQL/R33...ld_content_int
Reply

Thanks for your answers, but... Lets say I Have SELECT query where I Change integer value to a string, e.g changing unix time stamp to a human readable string (with MySQL functions!). How can I Get the string, if doing so? I Tried to use "cache_get_field_content", but it says "field not found" in the log, but it does exist. This might be due to that field is made for integers. But this changes integer to a string when doing SQL-query in phpMyAdmin.

Any ideas how to get the string out then?
Reply

http://dev.mysql.com/doc/refman/5.5/...unix-timestamp
http://dev.mysql.com/doc/refman/5.5/..._from-unixtime
Reply

I Know, but how to print that out as a string, like it does in phpMyAdmin? Lets say I Have "1339843" as integer and I Change it to a string in SELECT query, how I Get that out, e.g "2014-01-04 00:00"? I Need to store that to variable, but how to?
Reply

Quote:
Originally Posted by CrossUSAAF
Посмотреть сообщение
I Know, but how to print that out as a string, like it does in phpMyAdmin? Lets say I Have "1339843" as integer and I Change it to a string in SELECT query, how I Get that out, e.g "2014-01-04 00:00"? I Need to store that to variable, but how to?
Then use cache_get_row and store it to a temporary or a global variable (array).
Reply

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Then use cache_get_row and store it to a temporary or a global variable (array).
pawn Код:
mysql_format(dbHandle, query, sizeof(query), "SELECT FROM_UNIXTIME(`Unban`, '%%Y-%%m-%%d %%l:%%i %%p') FROM `Bans` WHERE `Nick` = '%e'", params);
                mysql_query(dbHandle, query, true);
                cache_get_data(rows, fields);
                if (rows) {
                    new bannedStamp[20];
                    cache_get_field_content(0, "Unban", bannedStamp);
                    printf("%s", bannedStamp):
                }
Do you now understand, what I Mean? How can I Get the changed result from that query above? This one gives me a warning: "[WARNING] CMySQLResult::GetRowDataByName - field not found ("Unban")". Is this even possible or not?

Thanks for your reply in advance!
Reply

Quote:
Originally Posted by CrossUSAAF
Посмотреть сообщение
pawn Код:
mysql_format(dbHandle, query, sizeof(query), "SELECT FROM_UNIXTIME(`Unban`, '%%Y-%%m-%%d %%l:%%i %%p') FROM `Bans` WHERE `Nick` = '%e'", params);
                mysql_query(dbHandle, query, true);
                cache_get_data(rows, fields);
                if (rows) {
                    new bannedStamp[20];
                    cache_get_field_content(0, "Unban", bannedStamp);
                    printf("%s", bannedStamp):
                }
Do you now understand, what I Mean? How can I Get the changed result from that query above? This one gives me a warning: "[WARNING] CMySQLResult::GetRowDataByName - field not found ("Unban")". Is this even possible or not?

Thanks for your reply in advance!
It's a query issue, not a plugin issue. Scripting discussion would be more appropriate subforum for the question.

Anyways, change "FROM_UNIXTIME(`Unban`, '%%Y-%%m-%%d %%l:%%i %%p')" to "FROM_UNIXTIME(`Unban`, '%%Y-%%m-%%d %%l:%%i %%p') AS `Unban`" and it should work.
Reply

Thank you very much Finnish boy, it worked. The original one worked in phpMyAdmin's query box, but I Did not know it has to be used like this.

I Saw many discussions regarding the plugin and MySQL here, so I Decided to ask in here. Thank you once again!
Reply

Lol I realized I posted in the wrong topic last time, with the r35 beta. LOL.

Anyway new issue.. The procedure entry point GetLogicalProcessorInformation could not be located in the dynamic link library KERNEL32.dll

any ideas?
Reply

Quote:
Originally Posted by Kar
Посмотреть сообщение
Lol I realized I posted in the wrong topic last time, with the r35 beta. LOL.
hnngh

Quote:
Originally Posted by Kar
Посмотреть сообщение
Anyway new issue.. The procedure entry point GetLogicalProcessorInformation could not be located in the dynamic link library KERNEL32.dll

any ideas?
I bet you are running Win XP. Have you installed the Service Pack 3?
Reply

Trying to run a query like this:

Код:
SELECT blah.id, blah.name, blahblah.number, hey.message FROM blah
LEFT JOIN blahblah ON blah.id = blahblah.id
LEFT JOIN hey ON blah.name = hey.id
WHERE blah.age = 2
(same concept as the actual query I'm running)

The result is:

Quote:

Error: Unknown table 'blah' in field list

The main "from" table is apparently AWOL.

While running the same query in PHPMyadmin it runs fine and fetchs all 8 values correctly. I am using R7. Considering the query works fine otherwise, I don't see what the problem is unless its in the plugin. The connection is active and yes it is to the right database. It can also see/access the table in a simpler query.
Reply

No I don't have SP3, if you know the true background on SP3, it's not really 'perfect' with some computers. It's not perfect with mine so that's why I've stopped installing it. (I have used it before, this PC has been flashes many times, but SP3 was a reason behind many of those flashes.. flashes = wipe with CD)
Reply

Quote:
Originally Posted by Kar
View Post
No I don't have SP3, if you know the true background on SP3, it's not really 'perfect' with some computers. It's not perfect with mine so that's why I've stopped installing it. (I have used it before, this PC has been flashes many times, but SP3 was a reason behind many of those flashes.. flashes = wipe with CD)
Does R34 run without any problems?
Reply

yes, it's smooth
Reply

Thanks for the plugin.
Now I've a problem, I tried to use it in the host, but I got this error:
[03:38:31] Loading plugin: mysql.so
[03:38:31] Failed (plugins/mysql.so: symbol __cxa_pure_virtual, version libmysqlclient_16 not defined in file libmysqlclient_r.so.16 with link time reference)
Anyone can help me?
Thanks.
Reply

Quote:
Originally Posted by Su37Erich
View Post
Thanks for the plugin.
Now I've a problem, I tried to use it in the host, but I got this error:
[03:38:31] Loading plugin: mysql.so
[03:38:31] Failed (plugins/mysql.so: symbol __cxa_pure_virtual, version libmysqlclient_16 not defined in file libmysqlclient_r.so.16 with link time reference)
Anyone can help me?
Thanks.
Use the static version.
Reply

Quote:
Originally Posted by BlueG
View Post
[*]Linux: (x86 (32-bit) version is cross compatible)
I run on debian 7 64b and R5 mysql plugin I need the plugin for debian 5 or x86 or other?
Reply


Forum Jump:


Users browsing this thread: 20 Guest(s)