05.04.2017, 17:35
Doing the change Wopss wrote is okay, here's the commit that introduced this.
However I'd suggest you incorporate the source of the MySQL plugin R40 or higher directly into your C++ gamemode. I've redesigned the internal API with the potential usage in a sampgdk gamemode back in my mind. Creating a connection, sending a query and processing the result is as easy as this:
You basically just have to copy over (almost) all plugin source files into your project and link it with the MySQL C connector library. Oh, and your compiler should be C++11-compliant.
However I'd suggest you incorporate the source of the MySQL plugin R40 or higher directly into your C++ gamemode. I've redesigned the internal API with the potential usage in a sampgdk gamemode back in my mind. Creating a connection, sending a query and processing the result is as easy as this:
Code:
CError<CHandle> handle_error; Handle_t handle = CHandleManager::Get()->Create( "localhost", "root", "pass", "database", options, handle_error); if (handle_error) { // some error happened return 0; } Query_t query = CQuery::Create("SELECT * FROM stuff"); query->OnExecutionFinished([callback](ResultSet_t resultset) { Result_t result = resultset->GetActiveResult(); std::string stuff; result->GetRowDataByName(0, "fieldname", stuff); printf("stuff is %s\n", stuff.c_str()); }); handle->Execute(CHandle::ExecutionType::PARALLEL, query);