summaryrefslogtreecommitdiff
path: root/src/sqlitestorage.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-06-12 22:44:11 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-06-12 22:44:11 +0000
commit7c7a1348faa3867f6f2e5fcaf2b671774b1b018a (patch)
treee2a8e67d76547f0d83e07687fefdee65aee3497b /src/sqlitestorage.h
parent9fa9cb8fa13049fa4ba28d31159b4e1a0c6c0432 (diff)
downloadmanaserv-7c7a1348faa3867f6f2e5fcaf2b671774b1b018a.tar.gz
manaserv-7c7a1348faa3867f6f2e5fcaf2b671774b1b018a.tar.bz2
manaserv-7c7a1348faa3867f6f2e5fcaf2b671774b1b018a.tar.xz
manaserv-7c7a1348faa3867f6f2e5fcaf2b671774b1b018a.zip
Moved SQLiteStorage to subclass of Storage, made Storage a singleton and
updated SQL tables a bit.
Diffstat (limited to 'src/sqlitestorage.h')
-rw-r--r--src/sqlitestorage.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/sqlitestorage.h b/src/sqlitestorage.h
new file mode 100644
index 00000000..7f11e0f6
--- /dev/null
+++ b/src/sqlitestorage.h
@@ -0,0 +1,72 @@
+/*
+ * The Mana World Server
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World 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; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World 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 The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+#ifndef TMWSERV_SQLITESTORAGE_H
+#define TMWSERV_SQLITESTORAGE_H
+
+#include "sqlite/SQLiteWrapper.h"
+#include "storage.h"
+
+/**
+ * SQLite implemention of persistent dynamic data storage.
+ */
+class SQLiteStorage : public Storage
+{
+ public:
+ /**
+ * Constructor.
+ */
+ SQLiteStorage();
+
+ /**
+ * Destructor.
+ */
+ ~SQLiteStorage();
+
+ /**
+ * Save changes to database.
+ */
+ void flush();
+
+ /**
+ * Account count (test function)
+ */
+ unsigned int getAccountCount();
+
+ /**
+ * Get account & associated data
+ */
+ Account* getAccount(const std::string &username);
+
+ protected:
+ SQLiteWrapper sqlite; /**< Database */
+ std::vector<Account*> accounts; /**< Loaded accounts */
+ std::vector<Being*> characters; /**< Loaded characters */
+
+ /**
+ * Create tables if master is empty.
+ */
+ void createTablesIfNecessary();
+};
+
+#endif /* TMWSERV_SQLITESTORAGE_H */