]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_sqlite3.cpp
Merge pull request #1157 from SaberUK/insp20+fix-cron-restart
[user/henk/code/inspircd.git] / src / modules / extra / m_sqlite3.cpp
index 3809ac738ddde440c5ecd78536543490fb97171e..1e3a65a18fdea27e4483daff11f05fd366534116 100644 (file)
@@ -1,20 +1,33 @@
-/*              +------------------------------------+
- *              | Inspire Internet Relay Chat Daemon |
- *              +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
  *
- *     InspIRCd: (C) 2002-2010 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2007-2009 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2007, 2009 Craig Edwards <craigedwards@brainbox.cc>
+ *   Copyright (C) 2008 Pippijn van Steenhoven <pip88nl@gmail.com>
  *
- * This program is free but copyrighted software; see
- *                       the file COPYING for details.
+ * This file is part of InspIRCd.  InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
  *
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+
 #include "inspircd.h"
 #include <sqlite3.h>
 #include "sql.h"
 
+#ifdef _WIN32
+# pragma comment(lib, "sqlite3.lib")
+#endif
+
 /* $ModDesc: sqlite3 provider */
 /* $CompileFlags: pkgconfversion("sqlite3","3.3") pkgconfincludes("sqlite3","/sqlite3.h","") */
 /* $LinkerFlags: pkgconflibs("sqlite3","/libsqlite3.so","-lsqlite3") */
@@ -84,8 +97,11 @@ class SQLConn : public SQLProvider
 
        ~SQLConn()
        {
-               sqlite3_interrupt(conn);
-               sqlite3_close(conn);
+               if (conn)
+               {
+                       sqlite3_interrupt(conn);
+                       sqlite3_close(conn);
+               }
        }
 
        void Query(SQLQuery* query, const std::string& q)
@@ -206,7 +222,7 @@ class ModuleSQLite3 : public Module
                ReadConf();
 
                Implementation eventlist[] = { I_OnRehash };
-               ServerInstance->Modules->Attach(eventlist, this, 1);
+               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
        virtual ~ModuleSQLite3()