Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Support [Server] MYSQL R41-4

 
  • 0 Vote(s) - 0 Average
Server MYSQL R41-4
israel_Oliveira
Offline

Burgershot Member
Posts: 9
Threads: 4
Joined: Dec 2020
Reputation: 0
Location: Brasil
#1
2021-04-28, 02:38 PM
Good afternoon, I am using the mysql plugin and I have this problem.

[color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif]
Code:
[/font][/size][/color]
[04/28/21 11:14:16] [ERROR] mysql_format: invalid connection handle '0'
[04/28/21 11:14:16] [ERROR] mysql_format: invalid connection handle '0'
[04/28/21 11:14:16] [ERROR] mysql_format: invalid connection handle '0'
[04/28/21 11:14:16] [ERROR] error #1065 while executing query "": Query was empty
[04/28/21 11:14:16] [ERROR] error #1065 while executing query "": Query was empty
[04/28/21 11:14:16] [ERROR] error #1065 while executing query "": Query was empty
[04/28/21 11:14:23] [ERROR] mysql_format: invalid connection handle '0'
[04/28/21 11:14:23] [ERROR] error #1065 while executing query "": Query was empty
[04/28/21 11:14:24] [ERROR] mysql_format: invalid connection handle '0'
[04/28/21 11:14:24] [ERROR] error #1065 while executing query "": Query was empty
[04/28/21 11:16:48] [ERROR] error #1064 while executing query "er Logs:{ffffff} ComandoLog
": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'er Logs:{ffffff} ComandoLog' at line 1


My server and linux and I'm using another windows vps with xampp to use the database
I've managed to make the connection but I can't add or consult anything in the database

Can someone help me?
Chessy
Offline

Burgershot Member
Posts: 11
Threads: 4
Joined: Feb 2021
Reputation: 1
Location: Argentina
#2
2021-04-28, 05:19 PM
To see where those errors are coming from you have to put at the top of the OnGamemodeInit callback the function "mysql_log(ALL);" so in logs > mysql > mysql.log you can see what query it was

And i recommend you to see the github code breaker mysql thing in the page of it.
Argentinian SA-MP Programmer. Playing since 2013.
israel_Oliveira
Offline

Burgershot Member
Posts: 9
Threads: 4
Joined: Dec 2020
Reputation: 0
Location: Brasil
#3
2021-04-28, 05:47 PM (This post was last modified: 2021-04-28, 05:48 PM by israel_Oliveira.)
I changed to R41-3

[04/28/21 14:36:15] [DEBUG] CConnection::CConnection(this=0xec67c008, host='IP', user='USER', passw='PASS', db='logs_servidor', options=0x97ede98)
[04/28/21 14:36:15] [DEBUG] CConnection::CConnection - new connection = 0x9888af8
[04/28/21 14:36:15] [DEBUG] CThreadedConnection::CThreadedConnection(this=0xec67c008, connection=0xec67c008)
[04/28/21 14:36:15] [DEBUG] CThreadedConnection::WorkerFunc(this=0xec67c008, connection=0xec67c008)
[04/28/21 14:36:15] [INFO] Connection handle with id '1' successfully created.
[04/28/21 14:36:15] [DEBUG] CHandleManager::Create - new handle = 0x97a2758
[04/28/21 14:36:15] [DEBUG] mysql_connect: return value: '1'

[04/28/21 14:42:26] [ERROR] mysql_format: invalid connection handle '0'
[04/28/21 14:42:26] [ERROR] error #1065 while executing query "": Query was empty
[04/28/21 14:42:26] [ERROR] mysql_format: invalid connection handle '0'
[04/28/21 14:42:26] [ERROR] error #1065 while executing query "": Query was empty
[04/28/21 14:42:29] [ERROR] error #1064 while executing query "er Logs:{ffffff} ComandoLog
": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'er Logs:{ffffff} ComandoLog' at line 1

I am not able to find the error, only that the version of mysql server is different
RhaegarX
Offline

Burgershot Member
Posts: 66
Threads: 12
Joined: Nov 2020
Reputation: 4
#4
2021-04-30, 12:26 AM
on localhost on the linux vps itself the code works normally?
Chessy
Offline

Burgershot Member
Posts: 11
Threads: 4
Joined: Feb 2021
Reputation: 1
Location: Argentina
#5
2021-04-30, 04:16 PM
(2021-04-28, 05:47 PM)israel_Oliveira Wrote: I changed to R41-3

[04/28/21 14:36:15] [DEBUG] CConnection::CConnection(this=0xec67c008, host='IP', user='USER', passw='PASS', db='logs_servidor', options=0x97ede98)
[04/28/21 14:36:15] [DEBUG] CConnection::CConnection - new connection = 0x9888af8
[04/28/21 14:36:15] [DEBUG] CThreadedConnection::CThreadedConnection(this=0xec67c008, connection=0xec67c008)
[04/28/21 14:36:15] [DEBUG] CThreadedConnection::WorkerFunc(this=0xec67c008, connection=0xec67c008)
[04/28/21 14:36:15] [INFO] Connection handle with id '1' successfully created.
[04/28/21 14:36:15] [DEBUG] CHandleManager::Create - new handle = 0x97a2758
[04/28/21 14:36:15] [DEBUG] mysql_connect: return value: '1'

[04/28/21 14:42:26] [ERROR] mysql_format: invalid connection handle '0'
[04/28/21 14:42:26] [ERROR] error #1065 while executing query "": Query was empty
[04/28/21 14:42:26] [ERROR] mysql_format: invalid connection handle '0'
[04/28/21 14:42:26] [ERROR] error #1065 while executing query "": Query was empty
[04/28/21 14:42:29] [ERROR] error #1064 while executing query "er Logs:{ffffff} ComandoLog
": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'er Logs:{ffffff} ComandoLog' at line 1

I am not able to find the error, only that the version of mysql server is different

[04/28/21 14:42:26] [ERROR] mysql_format: invalid connection handle '0'

It says that you are using a wrong connection handle in your MySQL Format.

You are using something like mysql_format(0, query, sizeof(query), "INSERT INTO..." instead of mysql_format(Dtabase, query, sizeof(query), "INSERT INTO..."

And how you define Database?

Well, using it in the mysql_connect at the OnGamemodeInit.

new MySQL: Database; // This is going at the start of the gamemode.

new MySQLOpt: option_id = mysql_init_options(); // This, in GamemodeInit as the two below this one.
mysql_set_option(option_id, AUTO_RECONNECT, true); // We will set that option to automatically reconnect on timeouts.
Database = mysql_connect(IP_SQL, USER_SQL, PASSWORD_SQL, DATABASE_SQL, option_id);
Argentinian SA-MP Programmer. Playing since 2013.
israel_Oliveira
Offline

Burgershot Member
Posts: 9
Threads: 4
Joined: Dec 2020
Reputation: 0
Location: Brasil
#6
2021-04-30, 04:59 PM
Thanks to everyone, I had already solved the problem but I ended up not commenting here, it was a simple syntax error
Kwarde
Offline

Burgershot Member
Posts: 99
Threads: 2
Joined: Sep 2020
Reputation: 8
Location: The Netherlands
#7
2021-05-21, 08:13 AM
(2021-04-30, 04:59 PM)israel_Oliveira Wrote: Thanks to everyone, I had already solved the problem but I ended up not commenting here, it was a simple syntax error
There was indeed a syntax error in the logs. However:

Quote:[04/28/21 14:36:15] [INFO] Connection handle with id '1' successfully created.
A connection with id 1 was created (as literally stated in the logs). But then there's this log:
Quote:[04/28/21 11:14:16] [ERROR] mysql_format: invalid connection handle '0'
That has nothing to do with a syntax error. When you create a variable without a value, it's initial value will be 0. It is quite possible you used a wrong variable or created a new one (or the value of the variable with the MySQL connection ID was set to 0) for the connection handle:

Code:
//Global variable:
new MySQL:dbHandle;

//In your script initialisation:
dbHandle = mysql_connect(...);

//In the script that says "invalid connection handle '0'"
new MySQL:somethingElse;
mysql_format(somethingElse, ...);
//Correct: mysql_format(dbHandle, ...);
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode