This commit is contained in:
T1ti
2023-04-07 23:29:18 +02:00
parent 905d97acf5
commit 96d2ee30ad
3 changed files with 104 additions and 21 deletions

View File

@@ -87,10 +87,32 @@ namespace mysql
sql::SQLString password = settings.value("project/mysql/pwd").toString().toStdString();
sql::SQLString schema = settings.value("project/mysql/db").toString().toStdString();
QMessageBox prompt;
prompt.setWindowFlag(Qt::WindowStaysOnTopHint);
try
{
/*
try
{
// For some reasons sometimes it gets std::bad_alloc especially in debug mode (edit : solution : use debug connector binaries)
auto con = get_driver_instance()->connect(hostname, userName, password);
}
catch (std::bad_alloc& exception)
{
std::cerr << "bad_alloc detected: " << exception.what();
prompt.setIcon(QMessageBox::Warning);
prompt.setText("Failed to load MySQL database.");
prompt.setWindowTitle("Noggit MYSQL Error");
std::stringstream promptText;
promptText << "\n# ERR: " << exception.what();
promptText << "\nFailed to allocate memory to connect to the database";
prompt.setInformativeText(promptText.str().c_str());
prompt.exec();
return false;
}*/
std::unique_ptr<sql::Connection> Con(get_driver_instance()->connect(hostname, userName, password));
prompt.setIcon(QMessageBox::Information);

View File

@@ -302,6 +302,26 @@ public:
static std::vector<std::string> getWMOAreaNames(int WMOId);
};
class GameObjectDisplayInfoDB : public DBCFile
{
public:
GameObjectDisplayInfoDB() :
DBCFile("DBFilesClient\\GameObjectDisplayInfo.dbc")
{ }
/// Fields
static const size_t ID = 0; // uint
static const size_t ModelName = 1; // string
static const size_t Sounds = 2; // int[10]
static const size_t GeoBoxMinX = 12; // float
static const size_t GeoBoxMinY = 13; // float
static const size_t GeoBoxMinZ = 14; // float
static const size_t GeoBoxMaxX = 15; // float
static const size_t GeoBoxMaxY = 16; // float
static const size_t GeoBoxMaxZ = 17; // float
static const size_t ObjectEffectPackageID = 18; // int
};
void OpenDBs(std::shared_ptr<BlizzardArchive::ClientData> clientData);
const char * getGroundEffectDoodad(unsigned int effectID, int DoodadNum);
@@ -323,3 +343,4 @@ extern ZoneMusicDB gZoneMusicDB;
extern ZoneIntroMusicTableDB gZoneIntroMusicTableDB;
extern SoundEntriesDB gSoundEntriesDB;
extern WMOAreaTableDB gWMOAreaTableDB;
extern GameObjectDisplayInfoDB gGameObjectDisplayInfoDB;

View File

@@ -1201,7 +1201,7 @@
<bool>false</bool>
</property>
<property name="title">
<string>MySQL</string>
<string>MySQL (Noggit UID storage)</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@@ -1295,26 +1295,36 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_66">
<item>
<widget class="QLabel" name="label_48">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="_mysql_port_field"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_66">
<item>
<widget class="QLabel" name="label_48">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="_mysql_port_field">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="mysql_warning">
<property name="minimumSize">
@@ -1331,6 +1341,36 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="mysql_connect_test">
<property name="minimumSize">
<size>
<width>93</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Test Connection</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>