Permalink
Cannot retrieve contributors at this time
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?
ROGUE/link.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
58 lines (42 sloc)
1.3 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |