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:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user