malkverbena / mysql Goto Github PK
View Code? Open in Web Editor NEWMySQL connector to Godot Engine.
MySQL connector to Godot Engine.
Hello,
I get some errors when i try to load a scene using this module on android.
On my pc everything work fine but when i want to export and use it on my android device i get these errors
When i remove all the mysql module related code the scene changement work fine.
ps: I gave the internet permission to the app.
Loving the module so far. Thanks for developing it!
I'd like to be able to check if the connection is successful or not (e.g. something like mysql.check_connection()
that could return a boolean for whether or not a connection has been successfully established.
The plan is to support the following platforms:
X11, Windows, MacOS, Web, IOS & Android.
Still studying the possibility of compiling for the Web Assembly.
Dependencies:
Basic tests to check the module's functionality .
Folders "MySQL_exemple_Godot_4" and "MySQL_exemple_Godot_3" both are empty projects without nodes nor scripts.
When a prepared statement is created then immediately executed in the module the statement is not being closed.
Prepared statements are created server-side, and thus consume server resources. If you don't need a statement anymore, you can call connection::close_statement or connection::async_close_statement to instruct the server to deallocate it.
Prepared statements are managed by the server on a per-connection basis. Once you close your connection with the server, all prepared statements you have created using this connection will be automatically deallocated.
If you are creating your prepared statements at the beginning of your program and keeping them alive until the connection is closed, then there is no need to call close_statement(), as closing the connection will do the cleanup for you. If you are creating and destroying prepared statements dynamically, then it is advised to use close_statement() to prevent excessive resource usage in the server.
Finally, note that statement's destructor does not perform any server-side deallocation of the statement. This is because closing a statement involves a network operation that may block or fail.
Example, in execute_prepared()
:
if (type == TCP){
mysql::statement prep_stmt = tcp_conn->prepare_statement(query, ec, diag);
SQL_EXCEPTION(ec, diag, &last_error, Ref<SqlResult>());
tcp_conn->execute(prep_stmt.bind(args.begin(), args.end()), result, ec, diag);
}
The statement is created (on the server), executed, then the reference to that statement is discarded. It should be closed after executing.
The result as it stands is:
# SQL EXCEPTION Caught!
# ERR: SQLException in: modules/mysql/scr/mysql.cpp in function: execute_prepared() on line 291
# ERR: Code: 1461
# ERR: Description: er_max_prepared_stmt_count_reached [mysql.common-server:1461]
# Server error: Can't create more than max_prepared_stmt_count statements (current value: 16382)
Hi , I'm trying to add this module on Windows.
While building godot i get the error : 'mysql_error.h' : no such file or directory
What should I do? Thank you!
This looks like a pathing error, as it's trying to find SSL within boost....
FileNotFoundError: [Errno 2] No such file or directory: '/home/matt/godot/modules/mysql/3party/boost/3party/openssl':
Hello! The module is not working on my linux server. I compiled the Godot Engine from source and it worked on windows and connected to MySQL database but then I created a linux export template and whenever I run the file it doesn't work and doesn't say anything in the console after it has tried to connect to the database.
Godot version: 3.2.3
Linux version: Ubuntu Linux 20.04.2
Compile commands: scons platform=server target=release tools=no
I think there is some problems in the mysqlcppconn library, I installed the library with the command sudo apt-get install libmysqlcppconn-dev.
Platform: Arch Linux
Godot Version: Git HEAD 9b522ac1a85cab1a7a867b7a9f3bb102d9376ac2
Compile command: scons platform=linuxbsd target=editor production=yes lto=full
GCC version: 13.2.1 20230801
Normal Godot compilation is fine. As soon as I add the MySQL module to modules/
compilation fails with linking errors:
/usr/bin/ld: /tmp/ccpg2Gn7.ltrans24.ltrans.o: in function `TextServerAdvanced::FontForSizeAdvanced::~FontForSizeAdvanced() [clone .lto_priv.0]':
<artificial>:(.text+0x646f5): undefined reference to `FT_Done_Face'
/usr/bin/ld: /tmp/ccpg2Gn7.ltrans25.ltrans.o: in function `ft_move_to(FT_Vector_ const*, void*) [clone .lto_priv.0]':
<artificial>:(.text+0x7441): undefined reference to `msdfgen::Shape::addContour()'
/usr/bin/ld: <artificial>:(.text+0x7479): undefined reference to `msdfgen::Vector2::Vector2(double, double)'
/usr/bin/ld: /tmp/ccpg2Gn7.ltrans25.ltrans.o: in function `ft_line_to(FT_Vector_ const*, void*) [clone .lto_priv.0]':
<artificial>:(.text+0x7501): undefined reference to `msdfgen::Vector2::Vector2(double, double)'
/usr/bin/ld: <artificial>:(.text+0x750c): undefined reference to `msdfgen::Vector2::operator!=(msdfgen::Vector2 const&) const'
/usr/bin/ld: <artificial>:(.text+0x756c): undefined reference to `msdfgen::LinearSegment::LinearSegment(msdfgen::Vector2, msdfgen::Vector2, msdfgen::EdgeColor)'
/usr/bin/ld: <artificial>:(.text+0x7577): undefined reference to `msdfgen::EdgeHolder::EdgeHolder(msdfgen::EdgeSegment*)'
/usr/bin/ld: <artificial>:(.text+0x7582): undefined reference to `msdfgen::Contour::addEdge(msdfgen::EdgeHolder const&)'
/usr/bin/ld: <artificial>:(.text+0x758a): undefined reference to `msdfgen::EdgeHolder::~EdgeHolder()'
/usr/bin/ld: /tmp/ccpg2Gn7.ltrans25.ltrans.o: in function `ft_conic_to(FT_Vector_ const*, FT_Vector_ const*, void*) [clone .lto_priv.0]':
<artificial>:(.text+0x761e): undefined reference to `msdfgen::Vector2::Vector2(double, double)'
/usr/bin/ld: <artificial>:(.text+0x765b): undefined reference to `msdfgen::Vector2::Vector2(double, double)'
/usr/bin/ld: <artificial>:(.text+0x7688): undefined reference to `msdfgen::QuadraticSegment::QuadraticSegment(msdfgen::Vector2, msdfgen::Vector2, msdfgen::Vector2, msdfgen::EdgeColor)'
/usr/bin/ld: <artificial>:(.text+0x7693): undefined reference to `msdfgen::EdgeHolder::EdgeHolder(msdfgen::EdgeSegment*)'
/usr/bin/ld: <artificial>:(.text+0x769e): undefined reference to `msdfgen::Contour::addEdge(msdfgen::EdgeHolder const&)'
/usr/bin/ld: <artificial>:(.text+0x76a6): undefined reference to `msdfgen::EdgeHolder::~EdgeHolder()'
/usr/bin/ld: <artificial>:(.text+0x76db): undefined reference to `msdfgen::Vector2::Vector2(double, double)'
/usr/bin/ld: /tmp/ccpg2Gn7.ltrans25.ltrans.o: in function `ft_cubic_to(FT_Vector_ const*, FT_Vector_ const*, FT_Vector_ const*, void*) [clone .lto_priv.0]':
<artificial>:(.text+0x7783): undefined reference to `msdfgen::Vector2::Vector2(double, double)'
/usr/bin/ld: <artificial>:(.text+0x77c5): undefined reference to `msdfgen::Vector2::Vector2(double, double)'
/usr/bin/ld: <artificial>:(.text+0x7803): undefined reference to `msdfgen::Vector2::Vector2(double, double)'
/usr/bin/ld: <artificial>:(.text+0x783d): undefined reference to `msdfgen::CubicSegment::CubicSegment(msdfgen::Vector2, msdfgen::Vector2, msdfgen::Vector2, msdfgen::Vector2, msdfgen::EdgeColor)'
/usr/bin/ld: <artificial>:(.text+0x7848): undefined reference to `msdfgen::EdgeHolder::EdgeHolder(msdfgen::EdgeSegment*)'
/usr/bin/ld: <artificial>:(.text+0x7853): undefined reference to `msdfgen::Contour::addEdge(msdfgen::EdgeHolder const&)'
/usr/bin/ld: <artificial>:(.text+0x785b): undefined reference to `msdfgen::EdgeHolder::~EdgeHolder()'
/usr/bin/ld: <artificial>:(.text+0x7890): undefined reference to `msdfgen::Vector2::Vector2(double, double)'
/usr/bin/ld: /tmp/ccpg2Gn7.ltrans25.ltrans.o: in function `TextServerAdvanced::_generateMTSDF_threaded(void*, unsigned int)':
<artificial>:(.text+0x7913): undefined reference to `msdfgen::OverlappingContourCombiner<msdfgen::MultiAndTrueDistanceSelector>::OverlappingContourCombiner(msdfgen::Shape const&)'
/usr/bin/ld: <artificial>:(.text+0x791b): undefined reference to `msdfgen::Shape::edgeCount() const'
/usr/bin/ld: <artificial>:(.text+0x7998): undefined reference to `msdfgen::PseudoDistanceSelectorBase::EdgeCache::EdgeCache()'
/usr/bin/ld: <artificial>:(.text+0x7a3e): undefined reference to `msdfgen::Vector2::Vector2(double, double)'
/usr/bin/ld: <artificial>:(.text+0x7a49): undefined reference to `msdfgen::Projection::unproject(msdfgen::Vector2 const&) const'
/usr/bin/ld: <artificial>:(.text+0x7a64): undefined reference to `msdfgen::OverlappingContourCombiner<msdfgen::MultiAndTrueDistanceSelector>::reset(msdfgen::Vector2 const&)'
/usr/bin/ld: <artificial>:(.text+0x7acd): undefined reference to `msdfgen::OverlappingContourCombiner<msdfgen::MultiAndTrueDistanceSelector>::edgeSelector(int)'
/usr/bin/ld: <artificial>:(.text+0x7af0): undefined reference to `msdfgen::EdgeHolder::operator msdfgen::EdgeSegment const*() const'
/usr/bin/ld: <artificial>:(.text+0x7b03): undefined reference to `msdfgen::EdgeHolder::operator msdfgen::EdgeSegment const*() const'
/usr/bin/ld: <artificial>:(.text+0x7b2b): undefined reference to `msdfgen::EdgeHolder::operator msdfgen::EdgeSegment const*() const'
/usr/bin/ld: <artificial>:(.text+0x7b47): undefined reference to `msdfgen::MultiDistanceSelector::addEdge(msdfgen::PseudoDistanceSelectorBase::EdgeCache&, msdfgen::EdgeSegment const*, msdfgen::EdgeSegment const*, msdfgen::EdgeSegment const*)'
/usr/bin/ld: <artificial>:(.text+0x7b88): undefined reference to `msdfgen::OverlappingContourCombiner<msdfgen::MultiAndTrueDistanceSelector>::distance() const'
/usr/bin/ld: /tmp/ccpg2Gn7.ltrans25.ltrans.o: in function `TextServerAdvanced::_font_get_face_count(RID const&) const':
<artificial>:(.text+0x8e6e): undefined reference to `FT_Open_Face'
/usr/bin/ld: <artificial>:(.text+0x8ec1): undefined reference to `FT_Done_Face'
/usr/bin/ld: <artificial>:(.text+0x8f20): undefined reference to `FT_Init_FreeType'
/usr/bin/ld: <artificial>:(.text+0x8f49): undefined reference to `FT_Property_Set'
/usr/bin/ld: <artificial>:(.text+0x900c): undefined reference to `FT_Error_String'
/usr/bin/ld: /tmp/ccpg2Gn7.ltrans25.ltrans.o: in function `TextServerAdvanced::_font_set_style(RID const&, BitField<TextServer::FontStyle>)':
<artificial>:(.text+0x19045): undefined reference to `FT_Open_Face'
/usr/bin/ld: <artificial>:(.text+0x19069): undefined reference to `FT_Done_Face'
/usr/bin/ld: <artificial>:(.text+0x1909e): undefined reference to `FT_Open_Face'
/usr/bin/ld: <artificial>:(.text+0x191ad): undefined reference to `FT_Select_Size'
/usr/bin/ld: <artificial>:(.text+0x1923c): undefined reference to `FT_MulFix'
/usr/bin/ld: <artificial>:(.text+0x19286): undefined reference to `FT_MulFix'
/usr/bin/ld: <artificial>:(.text+0x19300): undefined reference to `FT_Get_MM_Var'
/usr/bin/ld: <artificial>:(.text+0x1936a): undefined reference to `FT_Get_Var_Design_Coordinates'
/usr/bin/ld: <artificial>:(.text+0x19623): undefined reference to `FT_Set_Var_Design_Coordinates'
/usr/bin/ld: <artificial>:(.text+0x1966c): undefined reference to `FT_Done_MM_Var'
/usr/bin/ld: <artificial>:(.text+0x197c0): undefined reference to `FT_Set_Pixel_Sizes'
/usr/bin/ld: <artificial>:(.text+0x1983c): undefined reference to `FT_Done_Face'
/usr/bin/ld: <artificial>:(.text+0x1987b): undefined reference to `FT_Error_String'
/usr/bin/ld: <artificial>:(.text+0x19928): undefined reference to `FT_Init_FreeType'
/usr/bin/ld: <artificial>:(.text+0x1995d): undefined reference to `FT_Property_Set'
/usr/bin/ld: <artificial>:(.text+0x19c5b): undefined reference to `FT_Get_Sfnt_Table'
/usr/bin/ld: <artificial>:(.text+0x1a356): undefined reference to `FT_Error_String'
/usr/bin/ld: <artificial>:(.text+0x1a579): undefined reference to `FT_Get_MM_Var'
/usr/bin/ld: <artificial>:(.text+0x1a702): undefined reference to `FT_Done_MM_Var'
/usr/bin/ld: <artificial>:(.text+0x1bf7e): undefined reference to `FT_Get_Var_Design_Coordinates'
/usr/bin/ld: /tmp/ccpg2Gn7.ltrans25.ltrans.o: in function `TextServerAdvanced::_font_get_style(RID const&) const':
<artificial>:(.text+0x1c553): undefined reference to `FT_Open_Face'
/usr/bin/ld: <artificial>:(.text+0x1c577): undefined reference to `FT_Done_Face'
/usr/bin/ld: <artificial>:(.text+0x1c5ab): undefined reference to `FT_Open_Face'
/usr/bin/ld: <artificial>:(.text+0x1c6bf): undefined reference to `FT_Select_Size'
/usr/bin/ld: <artificial>:(.text+0x1c74e): undefined reference to `FT_MulFix'
/usr/bin/ld: <artificial>:(.text+0x1c798): undefined reference to `FT_MulFix'
/usr/bin/ld: <artificial>:(.text+0x1c810): undefined reference to `FT_Get_MM_Var'
/usr/bin/ld: <artificial>:(.text+0x1c883): undefined reference to `FT_Get_Var_Design_Coordinates'
/usr/bin/ld: <artificial>:(.text+0x1cb44): undefined reference to `FT_Set_Var_Design_Coordinates'
/usr/bin/ld: <artificial>:(.text+0x1cb8d): undefined reference to `FT_Done_MM_Var'
/usr/bin/ld: <artificial>:(.text+0x1ccc0): undefined reference to `FT_Set_Pixel_Sizes'
/usr/bin/ld: <artificial>:(.text+0x1cd3d): undefined reference to `FT_Done_Face'
/usr/bin/ld: <artificial>:(.text+0x1cd7e): undefined reference to `FT_Error_String'
/usr/bin/ld: <artificial>:(.text+0x1ce28): undefined reference to `FT_Init_FreeType'
/usr/bin/ld: <artificial>:(.text+0x1ce5e): undefined reference to `FT_Property_Set'
/usr/bin/ld: <artificial>:(.text+0x1d145): undefined reference to `FT_Get_Sfnt_Table'
/usr/bin/ld: <artificial>:(.text+0x1d849): undefined reference to `FT_Error_String'
/usr/bin/ld: <artificial>:(.text+0x1da69): undefined reference to `FT_Get_MM_Var'
/usr/bin/ld: <artificial>:(.text+0x1dbe8): undefined reference to `FT_Done_MM_Var'
/usr/bin/ld: <artificial>:(.text+0x1f45e): undefined reference to `FT_Get_Var_Design_Coordinates'
... etc ...
I believe these errors are coming from the text_server_adv
module which is being broken by the MySQL module in some way.
It seems that when using this module and using the "INSERT"
query, the application will crash with no error thrown. Data will successfully be sent to the database, however.
I tried to reproduce this bug many, many times, but cannot find the reason behind it.
The only pattern I noticed was that the longer my code was, the less the chance for the query to work (the query works fine on a new, empty project).
Finally, I exported my project and ran it on the command line to see what error I would get.
Here it is:
https://gist.github.com/christoffersch/0c519c830a2445b5fa3d3bb5c7d146aa
Hope you can make something out of this, since this is the only MySQL connector for Godot that connects to online databases right now :-)
I need help with Mac OS support. Since I don't have a machine to test it.
modules/mysql/scr/mysql.cpp:403:121: error: no match for 'operator=' (operand types are 'std::tuple<boost::system::error_code&, boost::mysql::statement&>' and 'std::tuple<boost::system::error_code>')
Caused by this line:
std::tie(ec, prep_stmt) = co_await unix_ssl_conn->async_close_statement(prep_stmt, diag, tuple_awaitable);
within MySQL::coro_execute_prepared()
.
This is probably related to the fix from #27
scons: done reading SConscript files.
scons: Building targets ...
[Initial build] Compiling ==> modules/MySQL/MySQL.cpp
In file included from /usr/include/cppconn/variant.h:38:0,
from /usr/include/cppconn/connection.h:35,
from /usr/include/cppconn/driver.h:30,
from /usr/include/mysql_driver.h:32,
from modules/MySQL/MySQL.h:8,
from modules/MySQL/MySQL.cpp:3:
/usr/include/cppconn/exception.h:100:2: error: ISO C++1z does not allow dynamic exception specifications
MEMORY_ALLOC_OPERATORS(SQLException)
^
/usr/include/cppconn/exception.h:100:2: error: ISO C++1z does not allow dynamic exception specifications
MEMORY_ALLOC_OPERATORS(SQLException)
^
modules/MySQL/MySQL.cpp: In member function 'Array MySQL::make_query(String, int, Array, bool)':
modules/MySQL/MySQL.cpp:198:25: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
for (int i = 1; i <= res_meta->getColumnCount(); i++)
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/MySQL/MySQL.cpp:206:25: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
for (int i = 1; i <= res_meta->getColumnCount(); i++)
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/MySQL/MySQL.cpp:222:24: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
for (int i = 1; i <= res_meta->getColumnCount(); i++)
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/MySQL/MySQL.cpp: In member function 'void MySQL::determine_datatype(std::shared_ptr<sql::PreparedStatement>, Array)':
modules/MySQL/MySQL.cpp:366:48: error: 'REAL' is not a member of 'Variant'
else if ( prep_val[i].get_type() == Variant::REAL) { prep_stmt->setDouble(d, float(prep_val[i])); }
^~~~
cc1plus: all warnings being treated as errors
scons: *** [modules/MySQL/MySQL.linuxbsd.tools.64.o] Error 1
scons: building terminated because of errors.
Hello. I am having trouble running the project outside of Godot. When I run it I get the error: "The identifier" MySQL "isn't declared in the current scope". I have copied the files from MySQL but it doesn't work for me. If I run it from Godot it does not give me problems. Could you help me? Thanks!
But I'm getting an error while trying to compile Godot with SCons on Windows :
https://pastebin.com/FEWrez9T
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.