4 DATABASE_NAME = 'contacts.db'
8 def __init__(self, basedir):
9 self._path = os.path.join(basedir, DATABASE_NAME)
11 if not os.path.exists(self._path):
14 self.conn = sqlite3.connect(self._path)
17 """Creates new databse."""
19 self.conn = sqlite3.connect(self._path)
20 self.conn.execute("""CREATE TABLE data (user_id int, field_id int, \
22 self.conn.execute("""CREATE TABLE field (field_id int, name str)""")
23 self.conn.execute("""CREATE TABLE relation (data_id int, \
25 self.conn.execute("""CREATE TABLE struct (id int, name str, \
30 """Closes connection with database."""
36 if __name__ == "__main__":