Commit Graph

96 Commits

Author SHA1 Message Date
Machiavelli
62946f9ef6 Core/DBLayer:
- 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-25 01:05:24 +02:00
Machiavelli
154d11acc0 Core/DBLayer:
- Fix another pesky linux specific compile error. (Thanks to Derex/Aokromes)
- Fix a typo in an assertion. (Thanks to Derex/Aokromes)
- Add proper zero termination in SetStructuredValue to get rid of memory issues that arose in the last few commits.
- Fix a crash caused by vsprintf´ing std::string in SystemMgr::LoadVersion()

--HG--
branch : trunk
2010-09-25 01:02:40 +02:00
Machiavelli
09aeff1027 Core/DBLayer: Return proper connection handle from DatabaseWorkerPool<T>::GetConnection
Updates issue #4062
Updates issue #4058

--HG--
branch : trunk
2010-09-24 22:41:24 +02:00
Machiavelli
e3bf89b6f7 Core/DBLayer:
- Fix memory leak introduced in previous rev
- Fix linux compile, thanks to Playon for reporting

--HG--
branch : trunk
2010-09-24 22:36:35 +02:00
Machiavelli
3c6dc32030 Core/DBLayer:
- 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-24 22:16:21 +02:00
Shauren
d8ddf38453 Core/Items: Implemented trading soulbound loot items
Core/DBLayer: Converted more more player-related queries into prepared statements
Core/Items: Fixed loading of enchantments

Closes issue #4130.

--HG--
branch : trunk
2010-09-21 21:55:16 +02:00
Machiavelli
ce2d4e9a20 Core/DBLayer: Correctly print relevant mysql prepared statement creation error to give the end-user an idea of what exactly went wrong (missing SQL updates are the culprit of creation failure 99% of the time)
--HG--
branch : trunk
2010-09-20 20:53:32 +02:00
Shauren
a509976369 Core/DBLayer: Converted player login queries into prepared statements
Core/DBLayer: Added missing implementation for SQLQueryHolder::SetPreparedQuery

--HG--
branch : trunk
2010-09-20 18:20:40 +02:00
click
907203fdd9 Core/DBLayer: Shuffle an #include-statement around (initialize mysql connections before working on the rest) - Fixes nonPCH-builds.
--HG--
branch : trunk
2010-09-19 17:53:45 +02:00
Shauren
97aeb251b8 Core/Players: Added support for single character bans
Core/Commands: Renamed .ban character to .ban playeraccount (.ban character will ban only the player, not account)

This revision reaches 10000, congratulations and thanks to everyone who contributed!

--HG--
branch : trunk
2010-09-19 17:02:14 +02:00
Machiavelli
019103cb5a Core/DBLayer: Correct size for storing MYSQL_TYPE_FLOAT
--HG--
branch : trunk
2010-09-19 15:28:35 +02:00
Machiavelli
22571e9443 Core/DBLayer:
- Allow storing floats in prepared statements explicitly (previously would be casted to double)
- Add GetBool ¨wrapper/hack¨ to PreparedResultset class.

--HG--
branch : trunk
2010-09-19 15:25:50 +02:00
Machiavelli
b50c931d6e Core/DBLayer: Move QueryHolder and BasicStatement operations to their own file and remove SQLOperation.cpp from revision control
--HG--
branch : trunk
2010-09-19 12:36:48 +02:00
Machiavelli
0982719f5f Core/DBLayer:
- 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-19 12:16:29 +02:00
Machiavelli
12acb7dd8f Core/DBLayer: Fix syntax of some recently added prepared statements that might have caused statement creation failure on certain platforms
--HG--
branch : trunk
2010-09-19 10:40:10 +02:00
Machiavelli
27dd112c97 Core/DBLayer: Add an assert to trace down when a prepared statement creation has failed (99% it will be because of a bad query) - to prevent crashes at a later stage
--HG--
branch : trunk
2010-09-19 10:36:48 +02:00
silinoron
65a50ed3a2 Core/DBLayer: Some more prepared statements in ObjectMgr.
Core/ObjectMgr: Some additional cleanup.

--HG--
branch : trunk
2010-09-18 19:49:17 -07:00
silinoron
1e127eef73 Core/DBLayer: Change some regular statements to prepared statements.
Patch by thyros82@gmx.de.
Fixes issue #3774

--HG--
branch : trunk
2010-09-18 19:21:03 -07:00
linencloth
ae13e7354a Core/DBLayer: Fix a typo. Author: 41782992@qq.com
Fixes issue 4071.

--HG--
branch : trunk
2010-09-18 15:34:01 +02:00
Shauren
6ba1aec80c Core/Pools: Converted quest-related pool queries into prepared statements
--HG--
branch : trunk
2010-09-17 21:01:58 +02:00
click
726e5cf466 Buildsystem/Core: Add new build-flag WITH_SQLDEBUG - adds support for enabling/disabling SQL-query logging
--HG--
branch : trunk
2010-09-17 20:36:29 +02:00
Shauren
102e51d620 Core/Pools: Implemented quest pooling
Core/DBLayer: Added GetNumRows() method to PreparedResultSet

--HG--
branch : trunk
2010-09-14 13:56:27 +02:00
Machiavelli
88f378e7ae Core/DBLayer: Fix a memory leak in prepared statement parameter/result binds. Original author: raczman
--HG--
branch : trunk
2010-09-13 17:07:27 +02:00
Shauren
e0ffae436c Core/Quests: Fixed remaining issues with quest crediting (note: previous commits did not introduce issues, only revealed them)
Core/DBLayer: Fixed more compile warnings
Core/Spells: Corrected code style from revision 634af79146

Closes issue #3956.

--HG--
branch : trunk
2010-09-12 19:17:58 +02:00
click
976cc3f8c4 Core/DBLayer: Make GCC happy (initialize variables in the correct order in ResultBind()
--HG--
branch : trunk
2010-09-12 18:52:06 +02:00
Machiavelli
123163dc41 Core/DBLayer: Check for potential mysql client/server version mismatch. Version mismatch may lead to undefined behaviour with prepared statements.
--HG--
branch : trunk
2010-09-12 15:57:36 +02:00
Machiavelli
bb8438c09b Core/DBLayer: Add GetCString method for PreparedResultSet (dynamic copy is responsibility of the high level code)
--HG--
branch : trunk
2010-09-12 15:11:08 +02:00
Machiavelli
6a4c798867 Core/DBLayer: Replace all ad-hoc queries in AuthSocket with prepared statements
--HG--
branch : trunk
2010-09-12 11:06:26 +02:00
Machiavelli
0612359f4b Core/DBLayer:
- Fix a crash related to prepared resultset bind buffering. Fixes issue #3975
- Implement 64bit int fetching functions for preparedresultset
NOTE: *Still* experimental, use at own risk.

--HG--
branch : trunk
2010-09-12 11:02:58 +02:00
click
bf664b7a44 Cleanup/Core: Remove whitespace and tabs
--HG--
branch : trunk
2010-09-12 01:40:27 +02:00
Machiavelli
6fa05cfa3e Core/DBLayer: Last of the QueryResult related warnings on linux
--HG--
branch : trunk
2010-09-11 22:27:56 +02:00
Machiavelli
d1174be1fd Core/DBLayer: Fix gcc warnings related to changes added to QueryResult.h/cpp recently
--HG--
branch : trunk
2010-09-11 22:20:57 +02:00
Machiavelli
1de7e5bed1 Core/DBLayer:
* Example implementation of prepared statements with resultset in RealmList and AuthSocket code (selectively)
* Also correct a few bobo´s from previous commit.

--HG--
branch : trunk
2010-09-11 21:22:15 +02:00
Machiavelli
a41e99223e Core/DBLayer:
* Rename QueryResult class to ResultSet
* Rename QueryResult_AutoPtr to QueryResult
* Declare ACE refcounted auto pointer for PreparedResultSet class

--HG--
branch : trunk
2010-09-11 21:10:54 +02:00
Shauren
a52982195f Fixed compile
--HG--
branch : trunk
2010-09-11 12:15:34 +02:00
Machiavelli
1dce5b78d5 Core/DBLayer: Implement lower level classes for prepared statements with resultsets. (Implementation in upper level code not yet possible)
--HG--
branch : trunk
2010-09-11 09:17:14 +02:00
Machiavelli
d54225189e Core/DBLayer: Fix a warning
--HG--
branch : trunk
2010-09-06 17:55:12 +02:00
Spp
cdef980af4 Core: Fix some warnings
--HG--
branch : trunk
2010-09-06 15:23:08 +02:00
Machiavelli
1608ebf7bf Core/DBLayer: Move some syncrhonisation error prone methods into the guarded scope in MySQLConnection:Execute(PreparedStatement*)
--HG--
branch : trunk
2010-09-05 10:34:46 +02:00
Machiavelli
27c00a8cbb Core/DBLayer:
- Allow transactions to contain both raw ad-hoc queries and prepared statement elements
* When coding on high level code, just make sure you use the right argument type for Transaction::Append and the proper execution will be done automagically

--HG--
branch : trunk
2010-09-04 16:49:23 +02:00
Machiavelli
fd1c6c5440 Core/DBLayer: Add an assert in TransactionTask::Execute to make sure valid queries are held
Core/Logging: Tiny cleanup in sLog.outSQLDriver

--HG--
branch : trunk
2010-09-04 16:06:04 +02:00
Machiavelli
5469af3775 Core/DBLayer: Add an assert to detetct calls to invalid prepared statements.
--HG--
branch : trunk
2010-09-03 17:30:23 +02:00
Machiavelli
273679c5ba Core/DBLayer
- Store threadbundlemask internally per database pool and prevent direct access to config file post startup
- Fix threadbundlemask flag checking for ReactorRunnable, WorldRunnable
- Remove CLI threadbundlemask flag, CLI doesn´t need a seperate mysql connection nor thread
- Remove unused Character Database connection from WorldSocketMgr / ReactorRunnable
- Add proper LoginDatabase connection to RA Runnable (soon to be overhauled)

Note: still experimental and not tested for live use

--HG--
branch : trunk
2010-09-03 10:52:32 +02:00
Machiavelli
387ee751a9 Core/DBLayer
- Add some small documentation on prepared statement defines naming contention (placed in the 3 database implementation header files so it can´t be missed)
- Remove obsolete mutex declaration in DatabaseWorkerPool (was unused as of recently)

--HG--
branch : trunk
2010-09-03 09:21:28 +02:00
runningnak3d
7433768a55 Core/Build: Partial work of fixing non-PCH Linux compile
--HG--
branch : trunk
2010-09-02 17:19:53 -06:00
Machiavelli
7982cc0f7d Core/DBLayer:
- A few prepared statement implementations in authsocket as example.
- Add an ASSERT in MySQLConnection::Execute(PreparedStatement*) to catch faulty created statements

--HG--
branch : trunk
2010-09-03 01:00:49 +02:00
Machiavelli
2c1c391597 Core/DBLayer:
- Example implementation of prepared statement in ObjectMgr::SaveCreatureRespawntime
- #include "MYSQLThreading.h" -> #include "MySQLThreading.h" (*really* fixes Linux build)

--HG--
branch : trunk
2010-09-03 00:44:27 +02:00
Machiavelli
1e8a294659 Missing include from previous rev.
--HG--
branch : trunk
2010-09-03 00:08:20 +02:00
Machiavelli
39027133e4 Fix Linux build
--HG--
branch : trunk
2010-09-03 00:04:14 +02:00
Machiavelli
1198591bac Core/DBLayer:
- 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-02 20:54:43 +02:00