1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 22:36:39 +02:00

Automatically determine SQL column type from the field.

Also add more column types to ensure we are storing data in the
best format in the database.
This commit is contained in:
Sadie Powell
2024-08-14 02:40:48 +01:00
parent 03bee17063
commit 528b5938ec
36 changed files with 330 additions and 222 deletions
+6 -6
View File
@@ -19,7 +19,7 @@ namespace SQL
public:
typedef std::map<Anope::string, std::stringstream *> Map;
Map data;
std::map<Anope::string, Type> types;
std::map<Anope::string, Serialize::DataType> types;
~Data()
{
@@ -60,17 +60,17 @@ namespace SQL
this->data.clear();
}
void SetType(const Anope::string &key, Type t) override
void SetType(const Anope::string &key, Serialize::DataType dt) override
{
this->types[key] = t;
this->types[key] = dt;
}
Type GetType(const Anope::string &key) const override
Serialize::DataType GetType(const Anope::string &key) const override
{
std::map<Anope::string, Type>::const_iterator it = this->types.find(key);
auto it = this->types.find(key);
if (it != this->types.end())
return it->second;
return DT_TEXT;
return Serialize::DataType::TEXT;
}
};