Completed
Push — master ( cc2800...40418d )
by Marek
15s queued 13s
created

dbtool   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 57
rs 10
c 0
b 0
f 0
wmc 0
1
#!/usr/bin/env python2
2
#
3
#  Copyright 2001 - 2016 Ludek Smid [http://www.ospace.net/]
4
#
5
#  This file is part of Outer Space.
6
#
7
#  Outer Space is free software; you can redistribute it and/or modify
8
#  it under the terms of the GNU General Public License as published by
9
#  the Free Software Foundation; either version 2 of the License, or
10
#  (at your option) any later version.
11
#
12
#  Outer Space is distributed in the hope that it will be useful,
13
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
#  GNU General Public License for more details.
16
#
17
#  You should have received a copy of the GNU General Public License
18
#  along with Outer Space; if not, write to the Free Software
19
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
#
21
22
# tweak PYTHONPATH
23
import os
24
import sys
25
from optparse import OptionParser
26
27
# setup system path
28
baseDir = os.path.abspath(os.path.dirname(__file__))
29
sys.path.insert(0, os.path.join(baseDir, '..', 'server', "lib"))
30
31
import ige
32
from ige import log
33
import ige.ospace.Const as Const
34
from ige.SQLiteDatabase import Database, DatabaseString
35
36
# parse command line arguments
37
parser = OptionParser(usage = "usage: %prog [options]")
38
parser.add_option("",  "--configdir", dest = "configDir",
39
    metavar = "DIRECTORY", default = os.path.join(os.path.expanduser("~"), ".outerspace"),
40
    help = "Override default configuration directory",)
41
options, args = parser.parse_args()
42
43
gameName = 'Alpha'
44
45
gameDB = Database(os.path.join(options.configDir,"db_data"), "game_%s" % gameName, cache = 15000)
46
clientDB = DatabaseString(os.path.join(options.configDir,"db_data"), "accounts", cache = 100)
47
msgDB = DatabaseString(os.path.join(options.configDir,"db_data"), "messages", cache = 1000)
48
bookingDB = DatabaseString(os.path.join(options.configDir,"db_data"), "bookings", cache = 100)
49
50
# insert code
51
52
53
# 
54
55
for db in gameDB, clientDB, msgDB, bookingDB:
56
    db.shutdown()
57
58