forked from nyrocron/eve-skills
-
Notifications
You must be signed in to change notification settings - Fork 1
/
evestatic.py
43 lines (35 loc) · 1.45 KB
/
evestatic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""evestatic.py: """
import sqlite3
class StaticDB(object):
def __init__(self):
self._connection = sqlite3.connect('evestatic.db')
self._cursor = self._connection.cursor()
def __del__(self):
self._connection.close()
def skill_id(self, skill_name):
self._cursor.execute("SELECT typeID FROM invtypes"
" WHERE typeName = :name",
{'name': skill_name})
result = self._cursor.fetchone()
self._cursor.fetchall()
return result[0]
def skill_name(self, skillID):
self._cursor.execute("SELECT typeName"
" FROM invtypes WHERE typeID = :id",
{'id': skillID})
result = self._cursor.fetchone()
self._cursor.fetchall()
return result[0]
def skill_group(self, skillID):
self._cursor.execute("SELECT g.groupName"
" FROM invtypes t"
" JOIN invgroupd g"
" ON t.groupID = g.groupID"
" WHERE t.typeID = :id",
{'id': skillID})
result = self._cursor.fetchone()
self._cursor.fetchall()
return result[0]