Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include <iostream>
#include "sqlite3.h"
#include <string>
int main(int num_argument, char** str_argument)
{
sqlite3* db;
int exit = 0;
exit = sqlite3_open("rogue.db", &db);
if (exit != SQLITE_OK)
{
std::cout << "DB Open Error: " << sqlite3_errmsg(db) << std::endl;
}
else
{
std::cout << "Opened Database Successfully!" << std::endl;
}
sqlite3_close(db);
return (0);
std::string sql = "CREATE TABLE PLAYERID("
"PLAYERID INT PRIMARY KEY NOT NULL,"
"level INT NOT NULL,"
"health INT NOT NULL,"
"attack INT NOT NULL,"
"defense INT NOT NULL,"
"experience INT NOT NULL);"
//"CREATE TABLE SCORE("
//"highscore INT PRIMARY KEY);";
exit = sqlite3_open("rogue.db", &db);
char* error;
exit = sqlite3_exec(db, sql.c_str(), NULL, 0, &error);
if (exit!= SQLITE_OK)
{
std::cerr << "table could not be created" << std::endl;
sqlite3_free(error);
}
else
{
std::cerr << "tables created" << std::endl;
}
sqlite3_close(db);
return 0;
}