Skip to content

Commit

Permalink
additional game like features
Browse files Browse the repository at this point in the history
  • Loading branch information
brandiob committed May 26, 2024
1 parent 24fd0d4 commit a674756
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions cpp-things/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ static int createDB(const char* s)
return 0;
}

static int createTable(const char* s)
{
static int createTable(const char* s) {
sqlite3 *DB;
char* messageError;
char *messageError;

string sql = "CREATE TABLE IF NOT EXISTS LEADERBOARD("
"ID INTEGER PRIMARY KEY AUTOINCREMENT, " //no touchy, this is the primary key
Expand All @@ -29,22 +28,19 @@ static int createTable(const char* s)
"PLAYER TEXT NOT NULL, "
"TIME INT, ";

try
{
try {
int exit = 0;
exit = sqlite3_open(s, &DB);
// An open database, SQL to be evaluated, Callback function, 1st argument to callback, Error msg written here
exit = sqlite3_exec(DB, sql.c_str(), NULL, 0, &messageError);
if (exit != SQLITE_OK) {
cerr << "Error in createTable function." << endl;
sqlite3_free(messageError);
}
else
} else
cout << "Table created Successfully" << endl;
sqlite3_close(DB);
}
catch (const exception& e)
{
catch (const exception &e) {
cerr << e.what();
}

Expand Down

0 comments on commit a674756

Please sign in to comment.