]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_sqlite3.cpp
Fix excessive snomask sending on fitler add/removal
[user/henk/code/inspircd.git] / src / modules / extra / m_sqlite3.cpp
index d174ce8aa1b7d83bd5b5458c3bf7e12bf548954d..548af82cc4715f320b0fa16464a73d627ccb2574 100644 (file)
@@ -3,7 +3,7 @@
  *              +------------------------------------+
  *
  *     InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *                       the file COPYING for details.
@@ -34,12 +34,10 @@ typedef std::deque<SQLite3Result*> ResultQueue;
 unsigned long count(const char * const str, char a)
 {
        unsigned long n = 0;
-       const char *p = reinterpret_cast<const char *>(str);
-
-       while ((p = strchr(p, a)) != NULL)
+       for (const char *p = reinterpret_cast<const char *>(str); *p; ++p)
        {
-               ++p;
-               ++n;
+               if (*p == '?')
+                       ++n;
        }
        return n;
 }
@@ -308,9 +306,6 @@ class SQLConn : public classbase
                /* Total length of the unescaped parameters */
                unsigned long maxparamlen, paramcount;
 
-               /* Total length of query, used for binary-safety */
-               unsigned long querylength = 0;
-
                /* The length of the longest parameter */
                maxparamlen = 0;
 
@@ -406,7 +401,6 @@ class SQLConn : public classbase
                                *queryend = req.query.q[i];
                                queryend++;
                        }
-                       querylength++;
                }
                *queryend = 0;
                req.query.q = query;
@@ -460,7 +454,7 @@ class SQLConn : public classbase
 
        int OpenDB()
        {
-               return sqlite3_open(host.host.c_str(), &conn);
+               return sqlite3_open_v2(host.host.c_str(), &conn, SQLITE_OPEN_READWRITE, 0);
        }
 
        void CloseDB()
@@ -717,7 +711,7 @@ class ModuleSQLite3 : public Module
                }
        }
 
-       virtual void OnRehash(User* user, const std::string &parameter)
+       virtual void OnRehash(User* user)
        {
                ReadConf();
        }