mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-18 13:28:09 +00:00
Completely broken minor changes, just caching changes while moving machines
This commit is contained in:
@@ -90,6 +90,11 @@ public:
|
||||
|
||||
// Mail Delete
|
||||
virtual void DeleteMail(uint64_t id) = 0;
|
||||
|
||||
// Property Get
|
||||
virtual uint64_t GetPropertyFromTemplateAndClone(uint32_t templateId, uint32_t cloneId) = 0;
|
||||
virtual std::vector<uint32_t> GetBBBModlesForProperty(uint32_t propertyId) = 0;
|
||||
virtual std::istream GetLXFMLFromID(uint32_t id) = 0;
|
||||
private:
|
||||
|
||||
};
|
||||
|
@@ -102,7 +102,8 @@ std::unique_ptr<sql::PreparedStatement> MySQLDatabase::CreatePreppedStmtUnique(c
|
||||
}
|
||||
|
||||
std::unique_ptr<sql::ResultSet> MySQLDatabase::GetResultsOfStatement(sql::Statement* stmt) {
|
||||
std::unique_ptr<sql::ResultSet> result(stmt->executeQuery());
|
||||
auto* res = stmt->executeQuery();
|
||||
std::unique_ptr<sql::ResultSet> result(res);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -604,4 +605,47 @@ void MySQLDatabase::RemoveAttachmentFromMail(uint64_t id) {
|
||||
auto stmt = CreatePreppedStmtUnique("UPDATE mail SET attachment_lot = 0 WHERE id = ?;");
|
||||
stmt->setUInt64(1, id);
|
||||
stmt->execute();
|
||||
}
|
||||
|
||||
uint64_t MySQLDatabase::GetPropertyFromTemplateAndClone(uint32_t templateId, uint32_t cloneId) {
|
||||
auto stmt = CreatePreppedStmtUnique("SELECT id FROM properties WHERE template_id = ? AND clone_id = ? LIMIT 1;");
|
||||
stmt->setUInt(1, templateId);
|
||||
stmt->setUInt(2, cloneId);
|
||||
|
||||
auto res = GetResultsOfStatement(stmt.get());
|
||||
|
||||
while (res->next()) {
|
||||
return res->getUInt64("id");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> MySQLDatabase::GetBBBModlesForProperty(uint32_t propertyId) {
|
||||
auto stmt = CreatePreppedStmtUnique("SELECT ugc_id FROM properties_contents WHERE lot = 14 AND property_id = ?;");
|
||||
stmt->setUInt(1, propertyId);
|
||||
|
||||
auto res = GetResultsOfStatement(stmt.get());
|
||||
|
||||
std::vector<uint32_t> models;
|
||||
|
||||
while (res->next()) {
|
||||
models.push_back(res->getUInt("ugc_id"));
|
||||
}
|
||||
|
||||
return models;
|
||||
}
|
||||
|
||||
std::istream* MySQLDatabase::GetLXFMLFromID(uint32_t id) {
|
||||
auto stmt = CreatePreppedStmtUnique("SELECT lxfml FROM ugc WHERE id = ? LIMIT 1;");
|
||||
stmt->setUInt(1, id);
|
||||
|
||||
auto res = GetResultsOfStatement(stmt.get());
|
||||
|
||||
while (res->next()) {
|
||||
std::istream* blob = res->getBlob("lxfml");
|
||||
return blob;
|
||||
}
|
||||
|
||||
return new std::istream();
|
||||
}
|
@@ -83,6 +83,10 @@ public:
|
||||
void RemoveAttachmentFromMail(uint64_t id) override;
|
||||
|
||||
void DeleteMail(uint64_t id) override;
|
||||
|
||||
uint64_t GetPropertyFromTemplateAndClone(uint32_t templateId, uint32_t cloneId) override;
|
||||
std::vector<uint32_t> GetBBBModlesForProperty(uint32_t propertyId) override;
|
||||
std::istream GetLXFMLFromID(uint32_t id) override;
|
||||
private:
|
||||
std::string m_Host;
|
||||
std::string m_Database;
|
||||
|
Reference in New Issue
Block a user