Skip to content
Permalink
73f844c7a6
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
51 lines (44 sloc) 1.26 KB
#include <iostream>
#include "../include/libsqlite.hpp" // provided by Hintea, D. in 4005 CEM https://cumoodle.coventry.ac.uk/pluginfile.php/2606853/mod_resource/content/0/libsqlite.hpp
#include <tuple>
using namespace std;
class Effect
{
private:
// tuple<int, string, string, int, float> effect;
vector<int> effect;
public:
Effect(int effectID)
{
// connecting to SQLite database and setting attributes from each record
sqlite::sqlite db("Database/Game_Database.sqlite");
auto cur = db.get_statement();
// cur->set_sql("SELECT * FROM Effects WHERE Effect_ID = ?;");
cur->set_sql("SELECT Effect_ID FROM Ability_Effects WHERE Ability_ID = ?;");
cur->prepare();
cur->bind(1, effectID);
while(cur->step())
{
// effect = make_tuple(cur->get_int(0), cur->get_text(1), cur->get_text(2), cur->get_int(3), cur->get_double(4));
effect.emplace_back(cur->get_int(0));
}
}
vector<int> get_effects()
{
return effect;
}
tuple<int, string, string, int, float> get_effects()
{
return effect;
}
};
int main()
{
Effect e(1);
vector<int> effects = e.get_effects();
for (int i=0; i<effects.size(); i++)
{
cout << effects[i] << endl;
}
return 0;
}