summaryrefslogtreecommitdiff
path: root/src/modules/sql.h
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-03-13 16:35:16 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-03-13 16:35:16 +0000
commita45254ff4c15ca23b03bb2dbd52a6cd3b30c2662 (patch)
tree383e10ff6f3d6b96bdf22e5327cb4e733f16ca57 /src/modules/sql.h
parenta5dc76ec96a07211e4b7345e98c919aaca53ca32 (diff)
Change SQLv3 to format queries during submission, not before
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12633 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/sql.h')
-rw-r--r--src/modules/sql.h31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/modules/sql.h b/src/modules/sql.h
index e558d9f6b..0c174e987 100644
--- a/src/modules/sql.h
+++ b/src/modules/sql.h
@@ -127,10 +127,8 @@ class SQLQuery : public classbase
{
public:
ModuleRef creator;
- const std::string query;
- SQLQuery(Module* Creator, const std::string& q)
- : creator(Creator), query(q) {}
+ SQLQuery(Module* Creator) : creator(Creator) {}
virtual ~SQLQuery() {}
virtual void OnResult(SQLResult& result) = 0;
@@ -148,25 +146,26 @@ class SQLProvider : public DataProvider
public:
SQLProvider(Module* Creator, const std::string& Name) : DataProvider(Creator, Name) {}
/** Submit an asynchronous SQL request
- * @param dbid The database ID to apply the request to
- * @param query The query string
- * @param callback The callback that the result is sent to
+ * @param callback The result reporting point
+ * @param query The hardcoded query string. If you have parameters to substitute, see below.
*/
- virtual void submit(SQLQuery* query) = 0;
+ virtual void submit(SQLQuery* callback, const std::string& query) = 0;
- /** Format a parameterized query string using proper SQL escaping.
- * @param q The query string, with '?' parameters
- * @param p The parameters to fill in in the '?' slots
+ /** Submit an asynchronous SQL request
+ * @param callback The result reporting point
+ * @param format The simple parameterized query string ('?' parameters)
+ * @param p Parameters to fill in for the '?' entries
*/
- virtual std::string FormatQuery(const std::string& q, const ParamL& p) = 0;
+ virtual void submit(SQLQuery* callback, const std::string& format, const ParamL& p) = 0;
- /** Format a parameterized query string using proper SQL escaping.
- * @param q The query string, with '$foo' parameters
- * @param p The map to look up parameters in
+ /** Submit an asynchronous SQL request.
+ * @param callback The result reporting point
+ * @param format The parameterized query string ('$name' parameters)
+ * @param p Parameters to fill in for the '$name' entries
*/
- virtual std::string FormatQuery(const std::string& q, const ParamM& p) = 0;
+ virtual void submit(SQLQuery* callback, const std::string& format, const ParamM& p) = 0;
- /** Convenience function */
+ /** Convenience function to prepare a map from a User* */
void PopulateUserInfo(User* user, ParamM& userinfo)
{
userinfo["nick"] = user->nick;