+
+ /**
+ * Return the number of columns in the result.
+ * If you performed an UPDATE or INSERT which
+ * does not return a dataset, this value will
+ * be 0.
+ * @returns Number of columns in the result set.
+ */
+ virtual int Cols() = 0;
+
+ /**
+ * Get a string name of the column by an index number
+ * @param column The id number of a column
+ * @returns The column name associated with the given ID
+ */
+ virtual std::string ColName(int column) = 0;
+
+ /**
+ * Get an index number for a column from a string name.
+ * An exception of type SQLbadColName will be thrown if
+ * the name given is invalid.
+ * @param column The column name to get the ID of
+ * @returns The ID number of the column provided
+ */
+ virtual int ColNum(const std::string &column) = 0;
+
+ /**
+ * Get a string value in a given row and column
+ * This does not effect the internal cursor.
+ * @returns The value stored at [row,column] in the table
+ */
+ virtual SQLfield GetValue(int row, int column) = 0;
+
+ /**
+ * Return a list of values in a row, this should
+ * increment an internal counter so you can repeatedly
+ * call it until it returns an empty vector.
+ * This returns a reference to an internal object,
+ * the same object is used for all calls to this function
+ * and therefore the return value is only valid until
+ * you call this function again. It is also invalid if
+ * the SQLresult object is destroyed.
+ * The internal cursor (row counter) is incremented by one.
+ * @returns A reference to the current row's SQLfieldList
+ */
+ virtual SQLfieldList& GetRow() = 0;
+
+ /**
+ * As above, but return a map indexed by key name.
+ * The internal cursor (row counter) is incremented by one.
+ * @returns A reference to the current row's SQLfieldMap
+ */
+ virtual SQLfieldMap& GetRowMap() = 0;
+
+ /**
+ * Like GetRow(), but returns a pointer to a dynamically
+ * allocated object which must be explicitly freed. For
+ * portability reasons this must be freed with SQLresult::Free()
+ * The internal cursor (row counter) is incremented by one.
+ * @returns A newly-allocated SQLfieldList
+ */
+ virtual SQLfieldList* GetRowPtr() = 0;
+
+ /**
+ * As above, but return a map indexed by key name
+ * The internal cursor (row counter) is incremented by one.
+ * @returns A newly-allocated SQLfieldMap
+ */
+ virtual SQLfieldMap* GetRowMapPtr() = 0;
+
+ /**
+ * Overloaded function for freeing the lists and maps
+ * returned by GetRowPtr or GetRowMapPtr.
+ * @param fm The SQLfieldMap to free
+ */
+ virtual void Free(SQLfieldMap* fm) = 0;
+
+ /**
+ * Overloaded function for freeing the lists and maps
+ * returned by GetRowPtr or GetRowMapPtr.
+ * @param fl The SQLfieldList to free
+ */
+ virtual void Free(SQLfieldList* fl) = 0;
+};
+
+
+/** SQLHost represents a <database> config line and is useful
+ * for storing in a map and iterating on rehash to see which
+ * <database> tags was added/removed/unchanged.
+ */
+class SQLhost
+{
+ public:
+ std::string id; /* Database handle id */
+ std::string host; /* Database server hostname */
+ std::string ip; /* resolved IP, needed for at least pgsql.so */
+ unsigned int port; /* Database server port */
+ std::string name; /* Database name */
+ std::string user; /* Database username */
+ std::string pass; /* Database password */
+ bool ssl; /* If we should require SSL */
+
+ SQLhost()
+ {
+ }
+
+ SQLhost(const std::string& i, const std::string& h, unsigned int p, const std::string& n, const std::string& u, const std::string& pa, bool s)
+ : id(i), host(h), port(p), name(n), user(u), pass(pa), ssl(s)
+ {
+ }
+
+ /** Overload this to return a correct Data source Name (DSN) for
+ * the current SQL module.
+ */
+ std::string GetDSN();