Galactic Bloodshed
sql.cc
Go to the documentation of this file.
1 // Copyright 2019 The Galactic Bloodshed Authors. All rights reserved.
2 // Use of this source code is governed by a license that can be
3 // found in the COPYING file.
4 
5 /* disk input/output routines & msc stuff
6  * all read routines lock the data they just accessed (the file is not
7  * closed). write routines close and thus unlock that area.
8  */
9 
10 #include "gb/sql/sql.h"
11 
12 #include <fcntl.h>
13 #include <sqlite3.h>
14 #include <sys/stat.h>
15 #include <unistd.h>
16 
17 #include <cerrno>
18 #include <cstdio>
19 #include <cstdlib>
20 #include <cstring>
21 #include <iostream>
22 #include <memory>
23 #include <stdexcept>
24 
25 #include "gb/files.h"
26 #include "gb/power.h"
27 #include "gb/races.h"
28 #include "gb/ships.h"
29 #include "gb/sql/dbdecl.h"
30 #include "gb/tweakables.h"
31 #include "gb/vars.h"
32 
33 Sql::Sql() {
34  int err = sqlite3_open(PKGSTATEDIR "gb.db", &dbconn);
35  if (err) {
36  fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(dbconn));
37  exit(0);
38  }
39 }
40 
41 Sql::~Sql() {}
sqlite3 * dbconn
Definition: files_shl.cc:35