22 Commits

Author SHA1 Message Date
hg
95249889a6
[Code] Add mysql prepared statement support (#4530)
This adds support for using prepared statements for MySQL queries. It is
intended for use in a database quest API but it can be used in source
with some caveats:

 - It uses exceptions for error handling instead of returning a fake
   result that needs checked. Usage must be wrapped in try/catch.

 - DBcore has a connection mutex which indicates the connection might be
   shared with other threads. This mutex is locked for certain stmt
   operations in an attempt to make it safe to use with multi threaded
   connections.

 - Prepared statements should only be used on the main thread since the
   internal logging is not synchronized.

 - Unlike the current query API which retrieves all results as strings,
   results are stored in buffers that represent the db field type.
   Getter functions are available to retrieve values as desired types.
2024-11-05 20:12:17 -06:00
Alex King
53169ae217
[Cleanup] Delete errmsg.h in common and zone (#3821)
* [Cleanup] Delete errmsg.h in common and zone

# Notes
- These files were mostly unused.
- Moved the stuff that was used to the `dbcore.h` file since it's already used.

* Remove references
2023-12-30 11:21:57 -05:00
Chris Miles
b45e0e80b5
[Database] Add query multi statement execution support (#3414) 2023-06-17 18:20:13 -05:00
Alex King
7d03479f41
[Cleanup] Use constant reference and check for empty string properly in dbcore.cpp (#3203)
# Notes
- Passing by constant reference is more performant.
- Checking for empty string with `!= '\0'` is more performant.
- https://pvs-studio.com/en/docs/warnings/v805/
- https://pvs-studio.com/en/docs/warnings/v813/
2023-04-05 11:27:50 -04:00
Aeadoin
1ffdd4cb34
[Performance] Change to use Pass by reference where valid. (#3163)
* [Performance] Change to use Pass by reference where valid.

* typo
2023-04-01 22:55:40 -04:00
Alex
de2dfc1a7e
[Bug Fix] Fix for undefined MySQL library behavior. (#2834)
* MYSQL objects cannot be copied in a well defined way, this removes the copy and replaces it with another connection

* Change to share underlying pointers.

* Push up mutex changes

* Post rebase

* Formatting

---------

Co-authored-by: KimLS <KimLS@peqtgc.com>
Co-authored-by: Akkadius <akkadius1@gmail.com>
2023-02-24 20:14:55 -06:00
Chris Miles
33bb5aa8e5
[Database] Address deadlock in player events (#2974)
* DB mutex testing

* Mutex tweaks, native string escaping
2023-02-20 22:32:29 -06:00
Akkadius
cfa3e88bb2 Add command #gearup as a fairly decent start to a expansion specific way of gearing up a GM test character 2020-07-30 21:10:15 -05:00
Akkadius
7ee28d6361 Migrate shared memory to use content database source; add logic in DB::core to prevent double freeing [skip ci] 2020-03-12 01:23:06 -05:00
Akkadius
dde9b98e4f Beginning of multi-tenancy work 2020-03-11 02:43:21 -05:00
Michael Cook (mackal)
c43d436b1f Fix more windows.h/winsock.h/winsock2.h issues
We want to use winsock2.h rather than winsock.h. This was mostly enforced
from the global_defines.h file, but I wanted to make it consistent.

Most of these includes can be removed since they're included via
global_defines.h, but someone on windows should clean that up
2016-05-25 13:46:47 -04:00
Akkadius
359bbb8df1 dbcore.cpp * .h header include cleanup 2014-12-15 20:04:49 -06:00
Akkadius
e4f45d7b35 Removed DBCore::RunQuery
Converted last corpse.cpp function that mixed database code with corpse code
2014-11-23 22:57:46 -06:00
KimLS
d987ccf289 Added transactions for corpse creation, added sql to fix a bug in raid member saving in some situations, fixed a bug in encounters 2014-11-08 15:22:03 -08:00
KimLS
504a8b19ce Missed Mutex.h 2014-08-21 19:36:50 -07:00
KimLS
7fc21b9e3a Tons of renames 2014-08-21 19:33:02 -07:00
KimLS
06f18225ce Renaming headers is hard work 2014-08-21 17:26:32 -07:00
Arthur Ice
c175369ff6 string based QueryDatabase 2014-07-06 16:15:54 -07:00
Arthur Ice
3054a4c307 Database interface improvement with stl style iterators 2014-06-18 15:58:26 -07:00
Arthur Ice
e9577db9c2 removed DBMemLeak.cpp and DBMemLeak.h, unused. 2013-05-21 22:51:19 -07:00
j883376
ffcff4aea1 Remove trailing whitespace 2013-05-09 11:13:16 -04:00
KimLS
da7347f76f svn -> git Migration 2013-02-16 16:14:39 -08:00