Posts: 845
Threads: 3
Joined: Jun 2010
Quote:
Originally Posted by FanHamMer
Where I can get libmysqlclient.so.18?
|
It is included in the mysql-client-5.5 package. If you get an error like "libmysqlclient.so.18 not found" use the 5.1-version, available in downloads.
Quote:
Originally Posted by DarkSlyder
Why does 'mysql_connect' always returns a positive handle with a failed connection? Even 'mysql_errno' doesn't seem to be working.
pawn Код:
//Testing code printf("%d", mysql_connect(SQL_HOST, SQL_USER, "db1", SQL_PWD)); //Correct db printf("%d", mysql_errno()); printf("%d", mysql_connect(SQL_HOST, SQL_USER, "123456", SQL_PWD)); //Invalid db printf("%d", mysql_errno()); printf("%d", mysql_connect(SQL_HOST, SQL_USER, "db2", SQL_PWD)); //Correct db printf("%d", mysql_errno());
Код:
//Output
1
0
2
0
3
0
|
1. the connection is always created. If it's actually connected to the database, that's another question.
2. your code is wrong. You are calling mysql_errno always with the same (default) handle.
Posts: 232
Threads: 4
Joined: Apr 2013
Hi Again,
I've got new error with mysql
Server Log:
Код:
[15:35:18] Loading plugin: mysql.so
[15:35:18] Failed (libmysqlclient_r.so.16: cannot open shared object file: No such file or directory)
I'm running CentOS 6 64bit HELLLLLLLLLLLLP
Posts: 845
Threads: 3
Joined: Jun 2010
Quote:
Originally Posted by zPain
Every time I use it, cache_get_field_content returns NULL. Could it be a bug on r33?
|
Enable the default logging ("mysql_log();"), run your script again and check the mysql_log.txt for any errors.
Posts: 665
Threads: 6
Joined: Sep 2013
Reputation:
0
I've deleted mysql_log.txt and restarted my samp-server, but the file wasn't created. I suppose there aren't errors.
Sorry for my english (if that's wrong)
Posts: 845
Threads: 3
Joined: Jun 2010
Quote:
Originally Posted by zPain
I've deleted mysql_log.txt and restarted my samp-server, but the file wasn't created. I suppose there aren't errors.
Sorry for my english (if that's wrong)
|
Maybe there really aren't any values in the table? Look, if there would be a problem with cache_get_field_content always returning NULL, this topic would be flooded with such problems.
You can try cache_get_row, if this also returns NULL, there is probably a problem with the query you send or the table really hasn't any values.
Posts: 845
Threads: 3
Joined: Jun 2010
Quote:
Originally Posted by Kyra
Hi, thanks for your plugin but i have a question
I used R5 version now i want to upgrade my GM on R33 on non threaded query cached, but your plugin is faster than R5/R6?
I try to check if is faster i see is same or other check i see R6 is faster, i'm probably wrong.
Example i try this query x 5 k on loop
But i have a problem with the fetch i don't know if is good.
|
Your speed results are probably correct, the unthreaded queries in R33 can be slower than those in R6. Why? Because the R33-queries are still cached (they take the whole result from the MySQL server), but the R6-queries are not (you decide what data you need).
Your code looks generally not very good. Why do you store the sub-numbers of the IP at first in strings and then convert them back into numbers? Why don't you just use "p<.>dddd"?
Posts: 3
Threads: 0
Joined: Jul 2013
Posts: 845
Threads: 3
Joined: Jun 2010
Quote:
Originally Posted by Kyra
[...]
But thanks for your response ! And just for know, why my store result works 1 time and other time returning "NULL" mysql_fetch_row(query); is bad with cache query? What is the similar function with cache function?
|
mysql_fetch_row is in fact just a normal PAWN function which can be found in the MySQL plugin include. It just gets the data in a loop and concatenates it as a string. You really shouldn't use this function, fetch the data with the standard cache_* natives like cache_get_row or cache_get_field_content.
Quote:
Originally Posted by zPain
[...]
But I thought the length parameter was not necessary.
|
That's the well-known problem with enum-arrays.
Take a look at this post, it explains the problem in detail.
Posts: 54
Threads: 15
Joined: Jun 2011
Reputation:
0
When i trying to get mask name if players name longer than 16, name is not showing. And stplayername not working. Why? What is the best way of get string?
new temp[MAX_PLAYER_NAME];
cache_get_field_content(0, "maskname", temp);
strmid(Player[playerid][pMask], temp, 0, strlen(temp), 255);
or
memcpy(Player[playerid][pMask], temp, strlen(Player[playerid][pMask]) * 4, temp * 4, sizeof Player[playerid][pMask]);
or
memcpy(Player[playerid][pMask], temp, 0, 64+8, 64+8 ); //worked but i guess its not good
or
strmid(Player[playerid][pMask], temp, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4);
Posts: 845
Threads: 3
Joined: Jun 2010
Quote:
Originally Posted by Den_Bellik
This is a bug..Sorry my English
|
Okay, I know now where the mistake is, but still, use threaded queries.
The problem is that R33 uses now 2 connections and you only set the character set for one connection. Another solution would be to set the character set once and for ever directly in the table (ALTER TABLE ... SET CHARSET ...).
Posts: 845
Threads: 3
Joined: Jun 2010
Quote:
Originally Posted by saamp
Thanks guys.
Why cache_get_row_count() returns 1 here, when in my bans table I don't have any record?
pawn Код:
mysql_query(databaseConnection, "SELECT COUNT(*) FROM bans WHERE BanIP = '127.0.0.1'"); printf("Count: %d | Int: %d", cache_get_row_count(), cache_get_row_int(0, 0));
Count: 1 | Int: 0
|
You are retrieving the amount of rows per query, so your query returns a value: the number of rows. Because the number itself is in a row, cache_get_row_count returns 1.