aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Database/MySQLConnection.h
AgeCommit message (Collapse)Author
2015-08-21Core/Build: Merge common library and move database out of sharedStormBytePP
2015-03-21Core/Updates: Add an automatic database update system. Automatically detects ↵Naios
new and edited sql updates through file lists and hashing. Detects renames, deletes and is able to create and auto import full databases. * cleanups in main.cpp of world & bnetserver * refactoring in DatabaseWorkerPool.h & MySQLConnection.cpp Make sure you re-run cmake, because boost::iostreams was added as dependency. Maybe you need to install libboost-iostreams1.55-dev on unix as well. Import every update manual until (included) those INSERT IGNORE updates for each database. Thanks DDuarte and Shauren for your amazing ideas, help and advises. In hope that nobody gets a "Your database structure is not up to date..." anymore ,-) Signed-off-by: Naios <naios-dev@live.de> Signed-off-by: Nayd <dnpd.dd@gmail.com>
2015-02-04Shared/Database: Fix transactions not being recommitted on dead-lock errorjackpoz
Fix transactions not being recommitted on dead-lock error (error code 1213) because of calling http://dev.mysql.com/doc/refman/5.0/en/mysql-errno.html after sending the ROLLBACK command. This way the returned error code was related to the ROLLBACK command, not the failed transaction. (cherry picked from commit d4db0c15c7e59f7139619720be3c26a48e6ff259)
2015-01-01Update copyright note for 2015Vincent-Michael
Happy new year
2014-07-01Replaced all remaining ACE based Singletonsleak
Replaced ACE base AutoPtr class with shared_ptr Note: worldserver currently broken due to MapUpdater threading failure (ACE ofc, what else could it be)
2014-06-30Replaced ACE_Task_Base based DatabaseWorker with PCQleak
Note: Not exactly sure how shutdown should be handled, currently the queue clears itself out before shutting down This might need to be changed if the queue should be fully processed before being deleted
2014-04-29Core/Misc: Remove obsolete C++11 backward compatibility macrosDehravor
OVERRIDE, FINAL, DELETE_MEMBER
2014-04-20Core/Misc: Fixed some -Weffc++ warningsShauren
2014-01-01Update copyright note for 2014.Vincent_Michael
Happy new year.
2013-10-27Core/Code: Unify codestyle for brackets: {} to { }.Ascathor
Also added missing copyright to some files.
2013-01-02Core/Mysql: Multiple changesSpp
- added support for setting NULL column values to MySQL wrapper in core - replaced nonstandard strdup function and manual memory management with std::string - fixed bug in MySQLPreparedStatement::getQueryString method, it failed when string parameter contained embedded '?' symbols - fixed memory leak in MySQLPreparedStatement::setString method
2013-01-01Update copyright note for 2013.Vincent_Michael
Happy new year.
2012-11-27Core/Misc: Set mode 0644 for filesSpp
2012-10-02Core/Utilities: Do not expose internal store structure in Tokens and rename ↵Spp
it to Tokenizer
2012-09-10Core: Warning fixes (Also some -pedantic under game folder)Spp
2012-02-15Core/DBLayer: Remove unused structleak
2012-01-01Update headers for 2012. HAPPY NEW YEAR!!!kiper
2011-12-19Update src/server/shared/Database/MySQLConnection.hMachiavelli
2011-12-19Fix SQL file name after pull request, and fix compile on linux.Machiavelli
2011-05-07Core: Warning fixesShauren
2011-04-07 Core/DBLayer: make use of return result of Connection::Open method and ↵Azazel
allow core to output all the errors in prepared statements instead of aborting on first error.
2011-01-26Restore unix buildleak
2011-01-26Core/DBLayer: Replace prepared statement arrays with a map to avoid ↵leak
asynchronous indexes at query logging or error output - Add values to prepared statement query log messages - Killed a bit Engrish and trailing white whitespaces
2011-01-13Core/DBLayer:Machiavelli
- Implement DatabaseWorkerPool::DirectCommitTransaction for synchronous transaction execution (as opposed to asynchronous/enqueued). - Add MySQL errno 1213 "Deadlock found when trying to get lock; try restarting transaction" handler. If 1213 is called the core will retry to directly execute the transaction a maximum of 5 times.
2011-01-08Core/DBLayer: Define prepared statements in an array per database instead of ↵Machiavelli
explicit calls to MySQL::PrepareStatement. Now the core will show the raw query (without bound arguments) in related log entries instead of PreparedStatement id: X on database Y.
2011-01-01Update copyright note for 2011.Machiavelli
Happy new year.
2010-12-19Core/DBLayer:Machiavelli
- Add generic HandleMySQLErrno() method. - Add the ability to re-execute a certain statement if errorhandler resolved the situation succesfuly. - Add support for MySQL errno´s 2006, 2013, 2048, 2055 - fixes automatic reconnection behaviour. - Cleanup in affected code NOTE: You should still be smart enough to configure your worldserver and authserver´s MaxPingTime to be lower than your MySQL´s wait_time. --HG-- branch : trunk
2010-12-17Core/DBLayer: Don´t prepare asynchronous statements on synchronous ↵Machiavelli
connections and vice versa. Prevents allocating RAM that will never be used. --HG-- branch : trunk
2010-12-13Backed out changeset: 8326a2411148Machiavelli
--HG-- branch : trunk
2010-12-04Core/DBLayer:Machiavelli
- Make the mysql connectionpool shared for async and syncrhonous connections. - Allow configurable amount of connections for the pool - Allow configurable amount of delaythreads Note that delaythreads now only represent in-core threads. Whenever they execute a task they will pick a free connection from the pool instead of using their previously unique assigned connection. The purpose of this design change is better distribution of SQL requests (no bottlenecks paired with idling) among available resources. This also prevents a ¨memory waste¨ of preparing async prepared statements on synchronous connections (that were never called) - and vice versa. Now, connections aren´t explicitly async or synchronous, they serve both purposes. Use at own risk, might cause instabilities. Don´t forget to update your config files and clear your cmake cache. --HG-- branch : trunk
2010-10-21Core: optimize string splittinglinencloth
- Mainly affects item loading performance - Reduces guild loading time a lot --HG-- branch : trunk
2010-10-07REALLY fix the CRLF-crap...click
--HG-- branch : trunk
2010-10-07Yet more copyright header updatesclick
--HG-- branch : trunk
2010-09-30Remove const from MySQLConnectionInfo, can't use non const functions in a ↵Anubisss
const struct. This fixes the compile error. --HG-- branch : trunk
2010-09-29Core/DBLayer: Pass connection info down to lower level class MySQLConnection ↵Machiavelli
and use relevant data in logging messages in its methods --HG-- branch : trunk
2010-09-29Fix linux compile. Thanks to click, hunshijie and tomkuzyno for spotting the ↵Machiavelli
culprits. --HG-- branch : trunk
2010-09-29Core/DBLayer: Store MySQL connection details in a struct and print relevant ↵Machiavelli
data in sql driver messages --HG-- branch : trunk
2010-09-28Core/DBLayer: Remove obsolete parameter in PreparedResultSet constructor.Machiavelli
Thanks to Spp for pointing out. --HG-- branch : trunk
2010-09-27Core/DBLayer:Machiavelli
- DB Threading model update * Get rid of ThreadBundleMask and bundled connection * Implement configurable amount of Synch threads for databasepools * Use modulus based algorithm to check for free synchronous connections instead of previous ¨get connection by thread key or bundlemask¨ feature * Locks on mysql context objects are now managed outside the mysql query methods Fixes issue #4058 Fixes issue #4059 Introduces a ton of more issues. Use at own risk. You were warned. Really. Don´t forget to update your worldserver.conf --HG-- branch : trunk
2010-09-25Core/DBLayer:Machiavelli
- Rewrite KeepAlive method for DatabaseWorkerPool. Use mysql_ping instead of explicit select queries, and also schedule KeepAlives for asynchronous threads. NOTE: While the function is implemented and previous keepalive calls were transformed, it´s possible the keepalive call will need to be placed in several other locations in the code. Please leave feedback on whether or not this fixes your timeout issues. Update issue #4062 --HG-- branch : trunk
2010-09-24Core/DBLayer:Machiavelli
- Rewrite Field class to be able to store both binary prepared statement data and data from adhoc query resultsets - Buffer the data of prepared statements using ResultSet and Field classes and let go of mysql c api structures after PreparedResultSet constructor. Fixes a race condition and thus a possible crash/data corruption (issue pointed out to Derex, basic suggestion by raczman) - Conform PreparedResultSet and ResultSet to the same design standards, and using Field class as data buffer class for both * NOTE: This means the fetching methods are uniform again, using ¨Field* fields = result->Fetch();¨ and access to elements trough fields[x]. * NOTE: for access to the correct row in prepared statements, ¨Field* fields = result->Fetch();¨ must ALWAYS be called inside the do { }while(result->NextRow()) loop. * NOTE: This means that Field::GetString() returns std::string object and Field::GetCString() returns const char* pointer. Still experimental and all that jazz, not recommended for production servers until feedback is given. --HG-- branch : trunk
2010-09-19Core/DBLayer:Machiavelli
- Declare the datatypes used to determine transaction element data (prepared statement/adhoc query string) on a generic level in SQLOperation.h - Implement variable SQL element data for SQLQueryHolder class so it can execute both prepared statements and adhoc queries - Make MySQLConnection::Query for adhoc queries return pointer to type instead of an autopointer, the autopointer is now applied on higher level code just like the function for querying prepared statements --HG-- branch : trunk
2010-09-11Core/DBLayer:Machiavelli
* Rename QueryResult class to ResultSet * Rename QueryResult_AutoPtr to QueryResult * Declare ACE refcounted auto pointer for PreparedResultSet class --HG-- branch : trunk
2010-09-11Core/DBLayer: Implement lower level classes for prepared statements with ↵Machiavelli
resultsets. (Implementation in upper level code not yet possible) --HG-- branch : trunk
2010-09-02Core/Build: Partial work of fixing non-PCH Linux compilerunningnak3d
--HG-- branch : trunk
2010-09-03Core/DBLayer:Machiavelli
- Example implementation of prepared statement in ObjectMgr::SaveCreatureRespawntime - #include "MYSQLThreading.h" -> #include "MySQLThreading.h" (*really* fixes Linux build) --HG-- branch : trunk
2010-09-02Core/DBLayer:Machiavelli
- Add basic prepared statement interface (without implementation and thus without testing, without resultset support). - Based on raczman/Albator´s work on TrinityCore3 Build: - Add sLog define ¨hack¨ in DatbaseWorkerPool.h to fix some more sLog errors temporarily FYI: Builds on windows --HG-- branch : trunk
2010-09-02Core/DBLayer:Machiavelli
- Implement deriviate classes of MySQLConnection for every database type (world, realm, characters) - Make DatabaseWorkerPool templatized and use the above mentioned classes as parameter - Implementation of the new types in code (This is in preparation of prepared statement interface) --HG-- branch : trunk
2010-08-18* HIGHLY EXPERIMENTAL - USE AT OWN RISK *Machiavelli
Database Layer: - Implement connection pooling: Instead of 1 delay thread per database, you can configure between 1 and 32 worker threads that have a seperate thread in the core and have a seperate connection to the MySQL server (based on raczman/Albator´s database layer for Trinitycore3) - Implement a configurable thread bundle for synchroneous requests from seperate core threads (see worldserver.conf.dist for more info) - Every mapupdate thread now has its seperate MySQL connection to the world and characters database - Drop inconsistent PExecuteLog function - query logging will be implemented CONSISTENTLY later - Drop current prepared statement interface - this will be done *properly* later - You´ll need to update your worldserver.conf and authserver.conf - You´re recommended to make a backup of your databases before using this. * HIGHLY EXPERIMENTAL - USE AT OWN RISK * * HIGHLY EXPERIMENTAL - USE AT OWN RISK * etc. --HG-- branch : trunk