aboutsummaryrefslogtreecommitdiff
path: root/include/modules/sql.h
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-03-30 20:24:41 +0100
committerGravatar Sadie Powell2021-03-30 20:24:41 +0100
commit03058a043ac50ec985b08e374e6e116774a5b970 (patch)
tree0294b4a06d21ca6b49a03671c42280454dd1a59d /include/modules/sql.h
parentStop installing inspircd-genssl and delete the now useless manpage. (diff)
Convert SQL::Field to be a typedef of optional<string>.
Diffstat (limited to 'include/modules/sql.h')
-rw-r--r--include/modules/sql.h37
1 files changed, 3 insertions, 34 deletions
diff --git a/include/modules/sql.h b/include/modules/sql.h
index 985b273dd..986479d85 100644
--- a/include/modules/sql.h
+++ b/include/modules/sql.h
@@ -27,7 +27,6 @@
namespace SQL
{
class Error;
- class Field;
class Provider;
class Query;
class Result;
@@ -38,6 +37,9 @@ namespace SQL
/** A map of parameter replacement values. */
typedef std::map<std::string, std::string> ParamMap;
+ /** A single SQL field. */
+ typedef std::optional<std::string> Field;
+
/** A list of SQL fields from a specific row. */
typedef std::vector<Field> Row;
@@ -67,39 +69,6 @@ namespace SQL
void PopulateUserInfo(User* user, ParamMap& userinfo);
}
-/** Represents a single SQL field. */
-class SQL::Field
-{
- private:
- /** Whether this SQL field is NULL. */
- bool null;
-
- /** The underlying SQL value. */
- std::string value;
-
- public:
- /** Creates a new NULL SQL field. */
- Field()
- : null(true)
- {
- }
-
- /** Creates a new non-NULL SQL field.
- * @param v The value of the field.
- */
- Field(const std::string& v)
- : null(false)
- , value(v)
- {
- }
-
- /** Determines whether this SQL entry is NULL. */
- inline bool IsNull() const { return null; }
-
- /** Retrieves the underlying value. */
- inline operator const std::string&() const { return value; }
-};
-
/** Represents the result of an SQL query. */
class SQL::Result : public Cullable
{