Skip to content

Commit de13bf4

Browse files
feat(Core/DBLayer): replace char const* to std::string_view (#10211)
* feat(Core/DBLayer): replace `char const*` to `std::string_view` * CString * 1 * chore(Core/Misc): code cleanup * cl * db fix * fmt style sql * to fmt * py * del old * 1 * 2 * 3 * 1 * 1
1 parent d6ead1d commit de13bf4

140 files changed

Lines changed: 4966 additions & 4793 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/Fmt/FormatReplace.py

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,26 @@ def islog(line):
4141
# else :
4242
# return False
4343

44-
# def isPQuery(line):
45-
# substring = 'PQuery'
46-
# if substring in line:
47-
# return True
48-
# else :
49-
# return False
44+
def isPQuery(line):
45+
substring = 'PQuery'
46+
if substring in line:
47+
return True
48+
else :
49+
return False
5050

51-
# def isPExecute(line):
52-
# substring = 'PExecute'
53-
# if substring in line:
54-
# return True
55-
# else :
56-
# return False
51+
def isPExecute(line):
52+
substring = 'PExecute'
53+
if substring in line:
54+
return True
55+
else :
56+
return False
5757

58-
# def isPAppend(line):
59-
# substring = 'PAppend'
60-
# if substring in line:
61-
# return True
62-
# else :
63-
# return False
58+
def isPAppend(line):
59+
substring = 'PAppend'
60+
if substring in line:
61+
return True
62+
else :
63+
return False
6464

6565
# def isStringFormat(line):
6666
# substring = 'StringFormat'
@@ -83,12 +83,15 @@ def checkSoloLine(line):
8383
return handleCleanup(line), False
8484
elif islog(line):
8585
return handleCleanup(line), False
86-
# elif isPExecute(line):
87-
# return handleCleanup(line), False
88-
# elif isPQuery(line):
89-
# return handleCleanup(line), False
90-
# elif isPAppend(line):
91-
# return handleCleanup(line), False
86+
elif isPExecute(line):
87+
line = line.replace("PExecute", "Execute");
88+
return handleCleanup(line), False
89+
elif isPQuery(line):
90+
line = line.replace("PQuery", "Query");
91+
return handleCleanup(line), False
92+
elif isPAppend(line):
93+
line = line.replace("PAppend", "Append");
94+
return handleCleanup(line), False
9295
# elif isSendSysMessage(line):
9396
# return handleCleanup(line), False
9497
# elif isPSendSysMessage(line):
@@ -110,12 +113,15 @@ def startMultiLine(line):
110113
# return handleCleanup(line), True
111114
# elif isPSendSysMessage(line):
112115
# return handleCleanup(line), True
113-
# elif isPQuery(line):
114-
# return handleCleanup(line), True
115-
# elif isPExecute(line):
116-
# return handleCleanup(line), True
117-
# elif isPAppend(line):
118-
# return handleCleanup(line), True
116+
elif isPQuery(line):
117+
line = line.replace("PQuery", "Query");
118+
return handleCleanup(line), True
119+
elif isPExecute(line):
120+
line = line.replace("PExecute", "Execute");
121+
return handleCleanup(line), True
122+
elif isPAppend(line):
123+
line = line.replace("PAppend", "Append");
124+
return handleCleanup(line), True
119125
# elif isStringFormat(line):
120126
# return handleCleanup(line), True
121127
else :
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1643662892603722900');
2+
3+
UPDATE `creature_template` SET `RegenHealth` = 0 WHERE `RegenHealth` >= 2;
4+
UPDATE `creature_onkill_reputation` SET `IsTeamAward1` = 0 WHERE `IsTeamAward1` >= 2;
5+
UPDATE `creature_onkill_reputation` SET `IsTeamAward2` = 0 WHERE `IsTeamAward2` >= 2;
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
## How to upgrade
2+
- `PrepareStatment`
3+
4+
```diff
5+
- setNull(...)
6+
+ SetData(...)
7+
```
8+
```diff
9+
- setBool(...)
10+
+ SetData(...)
11+
```
12+
```diff
13+
- setUInt8(...)
14+
+ SetData(...)
15+
```
16+
```diff
17+
- setInt8(...)
18+
+ SetData(...)
19+
```
20+
```diff
21+
- setUInt16(...)
22+
+ SetData(...)
23+
```
24+
```diff
25+
- setInt16(...)
26+
+ SetData(...)
27+
```
28+
```diff
29+
- setUInt32(...)
30+
+ SetData(...)
31+
```
32+
```diff
33+
- setUInt64(...)
34+
+ SetData(...)
35+
```
36+
```diff
37+
- setInt64(...)
38+
+ SetData(...)
39+
```
40+
```diff
41+
- setFloat(...)
42+
+ SetData(...)
43+
```
44+
```diff
45+
- setDouble(...)
46+
+ SetData(...)
47+
```
48+
```diff
49+
- setString(...)
50+
+ SetData(...)
51+
```
52+
```diff
53+
- setStringView(...)
54+
+ SetData(...)
55+
```
56+
```diff
57+
- setBinary(...)
58+
+ SetData(...)
59+
```
60+
61+
- `Fields`
62+
63+
```diff
64+
- GetBool()
65+
+ Get<bool>()
66+
```
67+
```diff
68+
- GetUInt8()
69+
+ Get<uint8>()
70+
```
71+
```diff
72+
- GetInt8()
73+
+ Get<int8>()
74+
```
75+
```diff
76+
- GetUInt16()
77+
+ Get<uint16>()
78+
```
79+
```diff
80+
- GetInt16()
81+
+ Get<int16>()
82+
```
83+
```diff
84+
- GetUInt32()
85+
+ Get<uint32>()
86+
```
87+
```diff
88+
- GetInt32()
89+
+ Get<int32>()
90+
```
91+
```diff
92+
- GetUInt64()
93+
+ Get<uint64>()
94+
```
95+
```diff
96+
- GetInt64()
97+
+ Get<int64>()
98+
```
99+
```diff
100+
- GetFloat()
101+
+ Get<float>()
102+
```
103+
```diff
104+
- GetDouble()
105+
+ Get<double>()
106+
```
107+
```diff
108+
- GetString()
109+
+ Get<std::string>()
110+
```
111+
```diff
112+
- GetStringView()
113+
+ Get<std::string_view>()
114+
```
115+
```diff
116+
- GetBinary()
117+
+ Get<Binary>()
118+
```

src/cmake/compiler/msvc/settings.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ target_compile_options(acore-compile-option-interface
107107
/wd4351 # C4351: new behavior: elements of array 'x' will be default initialized
108108
/wd4091) # C4091: 'typedef ': ignored on left of '' when no variable is declared
109109

110+
# Define NOMINMAX
111+
target_compile_definitions(acore-compile-option-interface
112+
INTERFACE
113+
-DNOMINMAX)
114+
message(STATUS "MSVC: Enable NOMINMAX")
115+
110116
if(NOT WITH_WARNINGS)
111117
target_compile_options(acore-warning-interface
112118
INTERFACE

src/common/Common.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,6 @@ AC_COMMON_API extern char const* localeNames[TOTAL_LOCALES];
9595
AC_COMMON_API LocaleConstant GetLocaleByName(const std::string& name);
9696
AC_COMMON_API void CleanStringForMysqlQuery(std::string& str);
9797

98-
// we always use stdlibc++ std::max/std::min, undefine some not C++ standard defines (Win API and some other platforms)
99-
#ifdef max
100-
#undef max
101-
#endif
102-
103-
#ifdef min
104-
#undef min
105-
#endif
106-
10798
#define MAX_QUERY_LEN 32*1024
10899

109100
namespace Acore

src/common/Utilities/StringFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define _STRING_FORMAT_H_
2020

2121
#include "Define.h"
22-
#include <fmt/core.h>
22+
#include <fmt/format.h>
2323
#include <fmt/printf.h>
2424

2525
namespace Acore

src/common/Utilities/Util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ inline T ApplyPct(T& base, U pct)
7878
template <class T>
7979
inline T RoundToInterval(T& num, T floor, T ceil)
8080
{
81-
return num = std::min(std::max(num, floor), ceil);
81+
return num = std::min<T>(std::max<T>(num, floor), ceil);
8282
}
8383

8484
// UTF8 handling

0 commit comments

Comments
 (0)